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

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

Issue 999073002: Integrate serving affiliation-based matches into the PasswordStore. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@aff_integration
Patch Set: Reduce scope of CL, test utils are fixed in a separate CL. Created 5 years, 9 months 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 | « no previous file | chrome/common/chrome_constants.h » ('j') | 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" 9 #include "base/metrics/histogram_macros.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
11 #include "chrome/browser/password_manager/password_manager_util.h" 11 #include "chrome/browser/password_manager/password_manager_util.h"
12 #include "chrome/browser/password_manager/sync_metrics.h" 12 #include "chrome/browser/password_manager/sync_metrics.h"
13 #include "chrome/browser/profiles/incognito_helpers.h" 13 #include "chrome/browser/profiles/incognito_helpers.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/sync/glue/sync_start_util.h" 15 #include "chrome/browser/sync/glue/sync_start_util.h"
16 #include "chrome/browser/webdata/web_data_service_factory.h" 16 #include "chrome/browser/webdata/web_data_service_factory.h"
17 #include "chrome/common/chrome_constants.h" 17 #include "chrome/common/chrome_constants.h"
18 #include "chrome/common/chrome_switches.h" 18 #include "chrome/common/chrome_switches.h"
19 #include "components/keyed_service/content/browser_context_dependency_manager.h" 19 #include "components/keyed_service/content/browser_context_dependency_manager.h"
20 #include "components/os_crypt/os_crypt_switches.h" 20 #include "components/os_crypt/os_crypt_switches.h"
21 #include "components/password_manager/core/browser/affiliated_match_helper.h"
22 #include "components/password_manager/core/browser/affiliation_service.h"
23 #include "components/password_manager/core/browser/affiliation_utils.h"
21 #include "components/password_manager/core/browser/login_database.h" 24 #include "components/password_manager/core/browser/login_database.h"
22 #include "components/password_manager/core/browser/password_store.h" 25 #include "components/password_manager/core/browser/password_store.h"
23 #include "components/password_manager/core/browser/password_store_default.h" 26 #include "components/password_manager/core/browser/password_store_default.h"
24 #include "components/password_manager/core/common/password_manager_pref_names.h" 27 #include "components/password_manager/core/common/password_manager_pref_names.h"
25 #include "components/pref_registry/pref_registry_syncable.h" 28 #include "components/pref_registry/pref_registry_syncable.h"
26 #include "content/public/browser/browser_thread.h" 29 #include "content/public/browser/browser_thread.h"
27 30
28 #if defined(OS_WIN) 31 #if defined(OS_WIN)
29 #include "chrome/browser/password_manager/password_store_win.h" 32 #include "chrome/browser/password_manager/password_store_win.h"
30 #include "components/password_manager/core/browser/webdata/password_web_data_ser vice_win.h" 33 #include "components/password_manager/core/browser/webdata/password_web_data_ser vice_win.h"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 #else 270 #else
268 NOTIMPLEMENTED(); 271 NOTIMPLEMENTED();
269 #endif 272 #endif
270 if (!ps.get() || 273 if (!ps.get() ||
271 !ps->Init( 274 !ps->Init(
272 sync_start_util::GetFlareForSyncableService(profile->GetPath()))) { 275 sync_start_util::GetFlareForSyncableService(profile->GetPath()))) {
273 NOTREACHED() << "Could not initialize password manager."; 276 NOTREACHED() << "Could not initialize password manager.";
274 return nullptr; 277 return nullptr;
275 } 278 }
276 279
280 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
281 if (password_manager::IsAffiliationBasedMatchingEnabled(*command_line)) {
282 // The PasswordStore is so far the only consumer of the AffiliationService,
283 // therefore the service is owned by the AffiliatedMatchHelper, which in
284 // turn is owned by the PasswordStore.
285 // TODO(engedy): Double-check which request context we want.
286 scoped_ptr<password_manager::AffiliationService> affiliation_service(
287 new password_manager::AffiliationService(db_thread_runner));
288 affiliation_service->Initialize(
289 profile->GetRequestContext(),
290 profile->GetPath().Append(chrome::kAffiliationDatabaseFileName));
291 scoped_ptr<password_manager::AffiliatedMatchHelper> affiliated_match_helper(
292 new password_manager::AffiliatedMatchHelper(
293 ps.get(), affiliation_service.Pass()));
294 affiliated_match_helper->Initialize();
295 ps->SetAffiliatedMatchHelper(affiliated_match_helper.Pass());
296 }
297
277 return new PasswordStoreService(ps); 298 return new PasswordStoreService(ps);
278 } 299 }
279 300
280 void PasswordStoreFactory::RegisterProfilePrefs( 301 void PasswordStoreFactory::RegisterProfilePrefs(
281 user_prefs::PrefRegistrySyncable* registry) { 302 user_prefs::PrefRegistrySyncable* registry) {
282 #if !defined(OS_CHROMEOS) && defined(USE_X11) 303 #if !defined(OS_CHROMEOS) && defined(USE_X11)
283 // Notice that the preprocessor conditions above are exactly those that will 304 // Notice that the preprocessor conditions above are exactly those that will
284 // result in using PasswordStoreX in BuildServiceInstanceFor(). 305 // result in using PasswordStoreX in BuildServiceInstanceFor().
285 registry->RegisterIntegerPref( 306 registry->RegisterIntegerPref(
286 password_manager::prefs::kLocalProfileId, 307 password_manager::prefs::kLocalProfileId,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 break; 378 break;
358 case LIBSECRET: 379 case LIBSECRET:
359 usage = OTHER_LIBSECRET; 380 usage = OTHER_LIBSECRET;
360 break; 381 break;
361 } 382 }
362 } 383 }
363 UMA_HISTOGRAM_ENUMERATION("PasswordManager.LinuxBackendStatistics", usage, 384 UMA_HISTOGRAM_ENUMERATION("PasswordManager.LinuxBackendStatistics", usage,
364 MAX_BACKEND_USAGE_VALUE); 385 MAX_BACKEND_USAGE_VALUE);
365 } 386 }
366 #endif 387 #endif
OLDNEW
« no previous file with comments | « no previous file | chrome/common/chrome_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698