[M49_2623] Chromium upversion to m49_2623 branch.
[platform/framework/web/chromium-efl.git] / tizen_src / ewk / efl_integration / browser / autofill / personal_data_manager_factory.h
1 // Copyright 2014 Samsung Electronics. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef PERSONAL_DATA_MANAGER_FACTORY_H
6 #define PERSONAL_DATA_MANAGER_FACTORY_H
7
8 #if defined(TIZEN_AUTOFILL_SUPPORT)
9 #include "base/id_map.h"
10 #include "base/strings/string16.h"
11 #include "base/compiler_specific.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/memory/singleton.h"
14 #include "components/autofill/core/browser/personal_data_manager_observer.h"
15
16 namespace base {
17 template <typename T> struct DefaultSingletonTraits;
18 }
19
20 namespace content {
21 class BrowserContext;
22 }
23
24 namespace autofill {
25
26 typedef void (*Ewk_Context_Form_Autofill_Profile_Changed_Callback)(void *data);
27
28 class PersonalDataManager;
29 class AutofillProfile;
30 class CreditCard;
31
32 class PersonalDataManagerFactory : public PersonalDataManagerObserver {
33  public:
34   static PersonalDataManagerFactory* GetInstance();
35
36   void PersonalDataManagerAdd(content::BrowserContext* ctx);
37   void PersonalDataManagerRemove(content::BrowserContext* ctx);
38   PersonalDataManager* PersonalDataManagerForContext(
39       content::BrowserContext* ctx);
40
41   void SetCallback(Ewk_Context_Form_Autofill_Profile_Changed_Callback callback,
42       void* user_data);
43
44   // content::BrowserContextObserver:
45   void OnPersonalDataChanged() override;
46
47  private:
48   friend struct base::DefaultSingletonTraits<PersonalDataManagerFactory>;
49
50   PersonalDataManagerFactory();
51   ~PersonalDataManagerFactory();
52
53   IDMap<PersonalDataManager, IDMapOwnPointer> personal_data_manager_id_map_;
54
55   DISALLOW_COPY_AND_ASSIGN(PersonalDataManagerFactory);
56   Ewk_Context_Form_Autofill_Profile_Changed_Callback callback_;
57   void* callback_user_data_;
58 };
59
60 }  // namespace autofill
61 #endif // TIZEN_AUTOFILL_SUPPORT
62 #endif // PERSONAL_DATA_MANAGER_FACTORY_H