Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2003)

Side by Side Diff: chrome/browser/password_manager/password_store_factory.cc

Issue 802923003: Revert of Report PasswordManager.OsPasswordStatus on a background thread with a delay. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/password_manager/chrome_password_manager_client.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/password_manager/password_store_factory.h" 5 #include "chrome/browser/password_manager/password_store_factory.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/environment.h" 8 #include "base/environment.h"
9 #include "base/metrics/histogram_macros.h"
10 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
11 #include "chrome/browser/password_manager/password_manager_util.h"
12 #include "chrome/browser/password_manager/sync_metrics.h" 10 #include "chrome/browser/password_manager/sync_metrics.h"
13 #include "chrome/browser/profiles/incognito_helpers.h" 11 #include "chrome/browser/profiles/incognito_helpers.h"
14 #include "chrome/browser/sync/glue/sync_start_util.h" 12 #include "chrome/browser/sync/glue/sync_start_util.h"
15 #include "chrome/browser/webdata/web_data_service_factory.h" 13 #include "chrome/browser/webdata/web_data_service_factory.h"
16 #include "chrome/common/chrome_constants.h" 14 #include "chrome/common/chrome_constants.h"
17 #include "chrome/common/chrome_switches.h" 15 #include "chrome/common/chrome_switches.h"
18 #include "components/keyed_service/content/browser_context_dependency_manager.h" 16 #include "components/keyed_service/content/browser_context_dependency_manager.h"
19 #include "components/os_crypt/os_crypt_switches.h" 17 #include "components/os_crypt/os_crypt_switches.h"
20 #include "components/password_manager/core/browser/login_database.h" 18 #include "components/password_manager/core/browser/login_database.h"
21 #include "components/password_manager/core/browser/password_store.h" 19 #include "components/password_manager/core/browser/password_store.h"
(...skipping 15 matching lines...) Expand all
37 #include "base/nix/xdg_util.h" 35 #include "base/nix/xdg_util.h"
38 #if defined(USE_GNOME_KEYRING) 36 #if defined(USE_GNOME_KEYRING)
39 #include "chrome/browser/password_manager/native_backend_gnome_x.h" 37 #include "chrome/browser/password_manager/native_backend_gnome_x.h"
40 #endif 38 #endif
41 #include "chrome/browser/password_manager/native_backend_kwallet_x.h" 39 #include "chrome/browser/password_manager/native_backend_kwallet_x.h"
42 #include "chrome/browser/password_manager/password_store_x.h" 40 #include "chrome/browser/password_manager/password_store_x.h"
43 #endif 41 #endif
44 42
45 using password_manager::PasswordStore; 43 using password_manager::PasswordStore;
46 44
45 #if !defined(OS_CHROMEOS) && defined(USE_X11)
47 namespace { 46 namespace {
48 47
49 #if !defined(OS_CHROMEOS) && defined(USE_X11)
50 const LocalProfileId kInvalidLocalProfileId = 48 const LocalProfileId kInvalidLocalProfileId =
51 static_cast<LocalProfileId>(0); 49 static_cast<LocalProfileId>(0);
52 #endif
53
54 void ReportOsPassword() {
55 password_manager_util::OsPasswordStatus status =
56 password_manager_util::GetOsPasswordStatus();
57
58 UMA_HISTOGRAM_ENUMERATION("PasswordManager.OsPasswordStatus",
59 status,
60 password_manager_util::MAX_PASSWORD_STATUS);
61 }
62
63 void DelayReportOsPassword() {
64 // Avoid checking OS password until later on in browser startup
65 // since it calls a few Windows APIs.
66 content::BrowserThread::PostDelayedTask(
67 content::BrowserThread::FILE,
68 FROM_HERE,
69 base::Bind(&ReportOsPassword),
70 base::TimeDelta::FromSeconds(40));
71 }
72 50
73 } // namespace 51 } // namespace
74 52 #endif
75 53
76 PasswordStoreService::PasswordStoreService( 54 PasswordStoreService::PasswordStoreService(
77 scoped_refptr<PasswordStore> password_store) 55 scoped_refptr<PasswordStore> password_store)
78 : password_store_(password_store) {} 56 : password_store_(password_store) {}
79 57
80 PasswordStoreService::~PasswordStoreService() {} 58 PasswordStoreService::~PasswordStoreService() {}
81 59
82 scoped_refptr<PasswordStore> PasswordStoreService::GetPasswordStore() { 60 scoped_refptr<PasswordStore> PasswordStoreService::GetPasswordStore() {
83 return password_store_; 61 return password_store_;
84 } 62 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 // TODO(mdm): scan other profiles to make sure they are not using this id? 115 // TODO(mdm): scan other profiles to make sure they are not using this id?
138 } while (id == kInvalidLocalProfileId); 116 } while (id == kInvalidLocalProfileId);
139 prefs->SetInteger(password_manager::prefs::kLocalProfileId, id); 117 prefs->SetInteger(password_manager::prefs::kLocalProfileId, id);
140 } 118 }
141 return id; 119 return id;
142 } 120 }
143 #endif 121 #endif
144 122
145 KeyedService* PasswordStoreFactory::BuildServiceInstanceFor( 123 KeyedService* PasswordStoreFactory::BuildServiceInstanceFor(
146 content::BrowserContext* context) const { 124 content::BrowserContext* context) const {
147 DelayReportOsPassword();
148 Profile* profile = static_cast<Profile*>(context); 125 Profile* profile = static_cast<Profile*>(context);
149 126
150 base::FilePath login_db_file_path = profile->GetPath(); 127 base::FilePath login_db_file_path = profile->GetPath();
151 login_db_file_path = login_db_file_path.Append(chrome::kLoginDataFileName); 128 login_db_file_path = login_db_file_path.Append(chrome::kLoginDataFileName);
152 scoped_ptr<password_manager::LoginDatabase> login_db( 129 scoped_ptr<password_manager::LoginDatabase> login_db(
153 new password_manager::LoginDatabase()); 130 new password_manager::LoginDatabase());
154 { 131 {
155 // TODO(paivanof@gmail.com): execution of login_db->Init() should go 132 // TODO(paivanof@gmail.com): execution of login_db->Init() should go
156 // to DB thread. http://crbug.com/138903 133 // to DB thread. http://crbug.com/138903
157 base::ThreadRestrictions::ScopedAllowIO allow_io; 134 base::ThreadRestrictions::ScopedAllowIO allow_io;
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 } 250 }
274 251
275 content::BrowserContext* PasswordStoreFactory::GetBrowserContextToUse( 252 content::BrowserContext* PasswordStoreFactory::GetBrowserContextToUse(
276 content::BrowserContext* context) const { 253 content::BrowserContext* context) const {
277 return chrome::GetBrowserContextRedirectedInIncognito(context); 254 return chrome::GetBrowserContextRedirectedInIncognito(context);
278 } 255 }
279 256
280 bool PasswordStoreFactory::ServiceIsNULLWhileTesting() const { 257 bool PasswordStoreFactory::ServiceIsNULLWhileTesting() const {
281 return true; 258 return true;
282 } 259 }
OLDNEW
« no previous file with comments | « chrome/browser/password_manager/chrome_password_manager_client.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698