Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / password_manager / password_store_factory.cc
index 93ab2a1..c0c527a 100644 (file)
@@ -39,6 +39,8 @@
 #include "chrome/browser/password_manager/password_store_x.h"
 #endif
 
+using password_manager::PasswordStore;
+
 #if !defined(OS_CHROMEOS) && defined(USE_X11)
 namespace {
 
@@ -97,7 +99,8 @@ PasswordStoreFactory::~PasswordStoreFactory() {}
 #if !defined(OS_CHROMEOS) && defined(USE_X11)
 LocalProfileId PasswordStoreFactory::GetLocalProfileId(
     PrefService* prefs) const {
-  LocalProfileId id = prefs->GetInteger(prefs::kLocalProfileId);
+  LocalProfileId id =
+      prefs->GetInteger(password_manager::prefs::kLocalProfileId);
   if (id == kInvalidLocalProfileId) {
     // Note that there are many more users than this. Thus, by design, this is
     // not a unique id. However, it is large enough that it is very unlikely
@@ -110,7 +113,7 @@ LocalProfileId PasswordStoreFactory::GetLocalProfileId(
       id = rand() & kLocalProfileIdMask;
       // TODO(mdm): scan other profiles to make sure they are not using this id?
     } while (id == kInvalidLocalProfileId);
-    prefs->SetInteger(prefs::kLocalProfileId, id);
+    prefs->SetInteger(password_manager::prefs::kLocalProfileId, id);
   }
   return id;
 }
@@ -122,7 +125,8 @@ KeyedService* PasswordStoreFactory::BuildServiceInstanceFor(
 
   base::FilePath login_db_file_path = profile->GetPath();
   login_db_file_path = login_db_file_path.Append(chrome::kLoginDataFileName);
-  scoped_ptr<LoginDatabase> login_db(new LoginDatabase());
+  scoped_ptr<password_manager::LoginDatabase> login_db(
+      new password_manager::LoginDatabase());
   {
     // TODO(paivanof@gmail.com): execution of login_db->Init() should go
     // to DB thread. http://crbug.com/138903
@@ -155,7 +159,7 @@ KeyedService* PasswordStoreFactory::BuildServiceInstanceFor(
 #elif defined(OS_CHROMEOS) || defined(OS_ANDROID)
   // For now, we use PasswordStoreDefault. We might want to make a native
   // backend for PasswordStoreX (see below) in the future though.
-  ps = new PasswordStoreDefault(
+  ps = new password_manager::PasswordStoreDefault(
       main_thread_runner, db_thread_runner, login_db.release());
 #elif defined(USE_X11)
   // On POSIX systems, we try to use the "native" password management system of
@@ -187,7 +191,7 @@ KeyedService* PasswordStoreFactory::BuildServiceInstanceFor(
   if (desktop_env == base::nix::DESKTOP_ENVIRONMENT_KDE4) {
     // KDE3 didn't use DBus, which our KWallet store uses.
     VLOG(1) << "Trying KWallet for password storage.";
-    backend.reset(new NativeBackendKWallet(id, prefs));
+    backend.reset(new NativeBackendKWallet(id));
     if (backend->Init())
       VLOG(1) << "Using KWallet for password storage.";
     else
@@ -197,7 +201,7 @@ KeyedService* PasswordStoreFactory::BuildServiceInstanceFor(
              desktop_env == base::nix::DESKTOP_ENVIRONMENT_XFCE) {
 #if defined(USE_GNOME_KEYRING)
     VLOG(1) << "Trying GNOME keyring for password storage.";
-    backend.reset(new NativeBackendGnome(id, prefs));
+    backend.reset(new NativeBackendGnome(id));
     if (backend->Init())
       VLOG(1) << "Using GNOME keyring for password storage.";
     else
@@ -216,7 +220,7 @@ KeyedService* PasswordStoreFactory::BuildServiceInstanceFor(
                           login_db.release(),
                           backend.release());
 #elif defined(USE_OZONE)
-  ps = new PasswordStoreDefault(
+  ps = new password_manager::PasswordStoreDefault(
       main_thread_runner, db_thread_runner, login_db.release());
 #else
   NOTIMPLEMENTED();
@@ -233,14 +237,12 @@ KeyedService* PasswordStoreFactory::BuildServiceInstanceFor(
 void PasswordStoreFactory::RegisterProfilePrefs(
     user_prefs::PrefRegistrySyncable* registry) {
 #if !defined(OS_CHROMEOS) && defined(USE_X11)
+  // Notice that the preprocessor conditions above are exactly those that will
+  // result in using PasswordStoreX in BuildServiceInstanceFor().
   registry->RegisterIntegerPref(
-      prefs::kLocalProfileId,
+      password_manager::prefs::kLocalProfileId,
       kInvalidLocalProfileId,
       user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
-
-  // Notice that the preprocessor conditions above are exactly those that will
-  // result in using PasswordStoreX in CreatePasswordStore() below.
-  PasswordStoreX::RegisterProfilePrefs(registry);
 #endif
 }