[M47_2526] Chromium upversion to m47_2526 branch
[platform/framework/web/chromium-efl.git] / tizen_src / ewk / efl_integration / browser / password_manager / password_store_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 PASSWORD_STORE_FACTORY_H
7 #define PASSWORD_STORE_FACTORY_H
8
9 #if defined(TIZEN_AUTOFILL_SUPPORT)
10
11 #include "base/basictypes.h"
12 #include "base/memory/singleton.h"
13 #include "browser/password_manager/password_manager_driver.h"
14
15 namespace password_manager {
16 class PasswordStore;
17
18 // A wrapper of PasswordStore so we can use it as a profiled keyed service.
19 class PasswordStoreService {
20  public:
21   // |password_store| needs to be not-NULL, and the constructor expects that
22   // Init() was already called successfully on it.
23   explicit PasswordStoreService(scoped_refptr<PasswordStore> password_store);
24   virtual ~PasswordStoreService();
25
26   scoped_refptr<PasswordStore> GetPasswordStore();
27
28  private:
29   scoped_refptr<PasswordStore> password_store_;
30   DISALLOW_COPY_AND_ASSIGN(PasswordStoreService);
31 };
32
33 // Singleton that owns all PasswordStores and associates them with
34 // Profiles.
35 class PasswordStoreFactory {
36  public:
37   static scoped_refptr<PasswordStore> GetPasswordStore();
38
39   static PasswordStoreFactory* GetInstance();
40   PasswordStoreService* GetService() { return service_; }
41
42  private:
43   friend struct base::DefaultSingletonTraits<PasswordStoreFactory>;
44   void Init();
45   PasswordStoreFactory();
46   virtual ~PasswordStoreFactory();
47
48   PasswordStoreService* service_;
49
50   DISALLOW_COPY_AND_ASSIGN(PasswordStoreFactory);
51 };
52 }
53 #endif // TIZEN_AUTOFILL_SUPPORT
54
55 #endif  // PASSWORD_STORE_FACTORY_H