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.
6 #ifndef PASSWORD_STORE_FACTORY_H
7 #define PASSWORD_STORE_FACTORY_H
9 #if defined(TIZEN_AUTOFILL_SUPPORT)
11 #include "base/basictypes.h"
12 #include "base/memory/singleton.h"
13 #include "browser/password_manager/password_manager_driver.h"
15 namespace password_manager {
18 // A wrapper of PasswordStore so we can use it as a profiled keyed service.
19 class PasswordStoreService {
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();
26 scoped_refptr<PasswordStore> GetPasswordStore();
29 scoped_refptr<PasswordStore> password_store_;
30 DISALLOW_COPY_AND_ASSIGN(PasswordStoreService);
33 // Singleton that owns all PasswordStores and associates them with
35 class PasswordStoreFactory {
37 static scoped_refptr<PasswordStore> GetPasswordStore();
39 static PasswordStoreFactory* GetInstance();
40 PasswordStoreService* GetService() { return service_; }
43 friend struct base::DefaultSingletonTraits<PasswordStoreFactory>;
45 PasswordStoreFactory();
46 virtual ~PasswordStoreFactory();
48 PasswordStoreService* service_;
50 DISALLOW_COPY_AND_ASSIGN(PasswordStoreFactory);
53 #endif // TIZEN_AUTOFILL_SUPPORT
55 #endif // PASSWORD_STORE_FACTORY_H