summaryrefslogtreecommitdiffstats
path: root/chrome/browser/profile.cc
diff options
context:
space:
mode:
authorstuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-03 22:00:41 +0000
committerstuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-03 22:00:41 +0000
commite69d33959a5b34c3796ffc55f187a073d92fd28f (patch)
tree6437de4b98dbd0e89e1e0e6a6431bd4842447c46 /chrome/browser/profile.cc
parentd1d1f9f14a63c8b8a6b882c5e9bf5f67eeb3d574 (diff)
downloadchromium_src-e69d33959a5b34c3796ffc55f187a073d92fd28f.zip
chromium_src-e69d33959a5b34c3796ffc55f187a073d92fd28f.tar.gz
chromium_src-e69d33959a5b34c3796ffc55f187a073d92fd28f.tar.bz2
Change PasswordStoreDefault to access the WebDataService from the UI thread only.
Enables the PasswordStore refactoring yet again (third time's the charm?). BUG=12479 TEST=Password save/autofill should continue to work on Windows. Review URL: http://codereview.chromium.org/118131 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17545 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/profile.cc')
-rw-r--r--chrome/browser/profile.cc54
1 files changed, 54 insertions, 0 deletions
diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc
index 513eb28..5c50259 100644
--- a/chrome/browser/profile.cc
+++ b/chrome/browser/profile.cc
@@ -19,6 +19,7 @@
#include "chrome/browser/extensions/user_script_master.h"
#include "chrome/browser/history/history.h"
#include "chrome/browser/net/chrome_url_request_context.h"
+#include "chrome/browser/password_manager/password_store_default.h"
#include "chrome/browser/profile_manager.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/search_engines/template_url_fetcher.h"
@@ -90,6 +91,14 @@ URLRequestContext* Profile::GetDefaultRequestContext() {
return default_request_context_;
}
+#if defined(OS_LINUX)
+// Temporarily disabled while we figure some stuff out.
+// http://code.google.com/p/chromium/issues/detail?id=12351
+// #include "chrome/browser/password_manager/password_store_gnome.h"
+// #include "chrome/browser/password_manager/password_store_kwallet.h"
+#elif defined(OS_WIN)
+#include "chrome/browser/password_manager/password_store_win.h"
+#endif
////////////////////////////////////////////////////////////////////////////////
//
@@ -191,6 +200,15 @@ class OffTheRecordProfileImpl : public Profile,
}
}
+ virtual PasswordStore* GetPasswordStore(ServiceAccessType sat) {
+ if (sat == EXPLICIT_ACCESS) {
+ return profile_->GetPasswordStore(sat);
+ } else {
+ NOTREACHED() << "This profile is OffTheRecord";
+ return NULL;
+ }
+ }
+
virtual PrefService* GetPrefs() {
return profile_->GetPrefs();
}
@@ -391,6 +409,7 @@ ProfileImpl::ProfileImpl(const FilePath& path)
extensions_request_context_(NULL),
history_service_created_(false),
created_web_data_service_(false),
+ created_password_store_(false),
created_download_manager_(false),
created_theme_provider_(false),
start_time_(Time::Now()),
@@ -759,6 +778,41 @@ void ProfileImpl::CreateWebDataService() {
web_data_service_.swap(wds);
}
+PasswordStore* ProfileImpl::GetPasswordStore(ServiceAccessType sat) {
+ if (!created_password_store_)
+ CreatePasswordStore();
+ return password_store_.get();
+}
+
+void ProfileImpl::CreatePasswordStore() {
+ DCHECK(!created_password_store_ && password_store_.get() == NULL);
+ created_password_store_ = true;
+ scoped_refptr<PasswordStore> ps;
+#if defined(OS_LINUX)
+// Temporarily disabled while we figure some stuff out.
+// http://code.google.com/p/chromium/issues/detail?id=12351
+// if (getenv("KDE_FULL_SESSION")) {
+// ps = new PasswordStoreKWallet();
+// } else {
+// ps = new PasswordStoreGnome();
+// }
+ NOTIMPLEMENTED();
+#elif defined(OS_WIN)
+ ps = new PasswordStoreWin(GetWebDataService(Profile::IMPLICIT_ACCESS));
+#else
+ NOTIMPLEMENTED();
+#endif
+ if (!ps || !ps->Init()) {
+ // Try falling back to the default password manager
+ LOG(WARNING) << "Could not initialise native password manager - "
+ "falling back to default";
+ ps = new PasswordStoreDefault(GetWebDataService(Profile::IMPLICIT_ACCESS));
+ if (!ps->Init())
+ return;
+ }
+ password_store_.swap(ps);
+}
+
DownloadManager* ProfileImpl::GetDownloadManager() {
if (!created_download_manager_) {
scoped_refptr<DownloadManager> dlm(new DownloadManager);