[M47_2526] Chromium upversion to m47_2526 branch
[platform/framework/web/chromium-efl.git] / tizen_src / ewk / efl_integration / browser / webdata / web_data_service_factory.h
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Copyright 2014 Samsung Electronics. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5
6 #ifndef WEB_DATA_SERVICE_FACTORY_H
7 #define WEB_DATA_SERVICE_FACTORY_H
8
9 #if defined(TIZEN_AUTOFILL_SUPPORT)
10
11 #include "base/basictypes.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/memory/singleton.h"
14 #include "components/webdata/common/web_database_service.h"
15 #include "web_data_service.h"
16
17 class WebDataService;
18
19 namespace autofill {
20 class AutofillWebDataService;
21 }  // namespace autofill
22
23 class WebDataServiceWrapper{
24  public:
25   explicit WebDataServiceWrapper();
26
27   virtual ~WebDataServiceWrapper();
28
29   virtual scoped_refptr<autofill::AutofillWebDataService> GetAutofillWebData();
30
31   virtual scoped_refptr<WebDataService> GetWebData();
32
33   static WebDataServiceWrapper* GetInstance();
34  private:
35   scoped_refptr<WebDatabaseService> web_database_;
36
37   scoped_refptr<autofill::AutofillWebDataService> autofill_web_data_;
38   scoped_refptr<WebDataService> web_data_;
39
40   DISALLOW_COPY_AND_ASSIGN(WebDataServiceWrapper);
41 };
42
43 // Singleton that owns all WebDataServiceWrappers
44 class WebDataServiceFactory {
45  public:
46
47   static WebDataServiceWrapper* GetDataService();
48
49   static scoped_refptr<autofill::AutofillWebDataService>
50       GetAutofillWebDataForProfile();
51
52   static WebDataServiceFactory* GetInstance();
53
54  private:
55   friend struct base::DefaultSingletonTraits<WebDataServiceFactory>;
56
57   WebDataServiceFactory();
58   virtual ~WebDataServiceFactory();
59
60   DISALLOW_COPY_AND_ASSIGN(WebDataServiceFactory);
61 };
62
63 #endif // TIZEN_AUTOFILL_SUPPORT
64
65 #endif  // WEB_DATA_SERVICE_FACTORY_H
66