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

Side by Side Diff: chrome/browser/autofill/personal_data_manager_factory.cc

Issue 964563002: Replace SetAuthenticatedUsername with SetAuthenticatedAccountId. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@priv
Patch Set: rebased Created 5 years, 8 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
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/autofill/personal_data_manager_factory.h" 5 #include "chrome/browser/autofill/personal_data_manager_factory.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/profiles/incognito_helpers.h" 10 #include "chrome/browser/profiles/incognito_helpers.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/signin/account_tracker_service_factory.h"
12 #include "chrome/browser/webdata/web_data_service_factory.h" 13 #include "chrome/browser/webdata/web_data_service_factory.h"
13 #include "components/autofill/core/browser/personal_data_manager.h" 14 #include "components/autofill/core/browser/personal_data_manager.h"
14 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" 15 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
15 #include "components/keyed_service/content/browser_context_dependency_manager.h" 16 #include "components/keyed_service/content/browser_context_dependency_manager.h"
17 #include "components/signin/core/browser/account_tracker_service.h"
16 18
17 namespace autofill { 19 namespace autofill {
18 20
19 // static 21 // static
20 PersonalDataManager* PersonalDataManagerFactory::GetForProfile( 22 PersonalDataManager* PersonalDataManagerFactory::GetForProfile(
21 Profile* profile) { 23 Profile* profile) {
22 return static_cast<PersonalDataManager*>( 24 return static_cast<PersonalDataManager*>(
23 GetInstance()->GetServiceForBrowserContext(profile, true)); 25 GetInstance()->GetServiceForBrowserContext(profile, true));
24 } 26 }
25 27
26 // static 28 // static
27 PersonalDataManagerFactory* PersonalDataManagerFactory::GetInstance() { 29 PersonalDataManagerFactory* PersonalDataManagerFactory::GetInstance() {
28 return Singleton<PersonalDataManagerFactory>::get(); 30 return Singleton<PersonalDataManagerFactory>::get();
29 } 31 }
30 32
31 PersonalDataManagerFactory::PersonalDataManagerFactory() 33 PersonalDataManagerFactory::PersonalDataManagerFactory()
32 : BrowserContextKeyedServiceFactory( 34 : BrowserContextKeyedServiceFactory(
33 "PersonalDataManager", 35 "PersonalDataManager",
34 BrowserContextDependencyManager::GetInstance()) { 36 BrowserContextDependencyManager::GetInstance()) {
37 DependsOn(AccountTrackerServiceFactory::GetInstance());
35 DependsOn(WebDataServiceFactory::GetInstance()); 38 DependsOn(WebDataServiceFactory::GetInstance());
36 } 39 }
37 40
38 PersonalDataManagerFactory::~PersonalDataManagerFactory() { 41 PersonalDataManagerFactory::~PersonalDataManagerFactory() {
39 } 42 }
40 43
41 KeyedService* PersonalDataManagerFactory::BuildServiceInstanceFor( 44 KeyedService* PersonalDataManagerFactory::BuildServiceInstanceFor(
42 content::BrowserContext* context) const { 45 content::BrowserContext* context) const {
43 Profile* profile = Profile::FromBrowserContext(context); 46 Profile* profile = Profile::FromBrowserContext(context);
44 PersonalDataManager* service = 47 PersonalDataManager* service =
45 new PersonalDataManager(g_browser_process->GetApplicationLocale()); 48 new PersonalDataManager(g_browser_process->GetApplicationLocale());
46 service->Init(WebDataServiceFactory::GetAutofillWebDataForProfile( 49 service->Init(WebDataServiceFactory::GetAutofillWebDataForProfile(
47 profile, ServiceAccessType::EXPLICIT_ACCESS), 50 profile, ServiceAccessType::EXPLICIT_ACCESS),
48 profile->GetPrefs(), 51 profile->GetPrefs(),
52 AccountTrackerServiceFactory::GetForProfile(profile),
49 profile->IsOffTheRecord()); 53 profile->IsOffTheRecord());
50 return service; 54 return service;
51 } 55 }
52 56
53 content::BrowserContext* PersonalDataManagerFactory::GetBrowserContextToUse( 57 content::BrowserContext* PersonalDataManagerFactory::GetBrowserContextToUse(
54 content::BrowserContext* context) const { 58 content::BrowserContext* context) const {
55 return chrome::GetBrowserContextOwnInstanceInIncognito(context); 59 return chrome::GetBrowserContextOwnInstanceInIncognito(context);
56 } 60 }
57 61
58 } // namespace autofill 62 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698