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

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

Issue 1308823002: Move Singleton and related structs to namespace base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ToT Created 5 years, 3 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "ios/chrome/browser/autofill/personal_data_manager_factory.h" 5 #include "ios/chrome/browser/autofill/personal_data_manager_factory.h"
6 6
7 #include "base/memory/singleton.h" 7 #include "base/memory/singleton.h"
8 #include "components/autofill/core/browser/personal_data_manager.h" 8 #include "components/autofill/core/browser/personal_data_manager.h"
9 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" 9 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
10 #include "components/keyed_service/core/service_access_type.h" 10 #include "components/keyed_service/core/service_access_type.h"
11 #include "components/keyed_service/ios/browser_state_dependency_manager.h" 11 #include "components/keyed_service/ios/browser_state_dependency_manager.h"
12 #include "ios/chrome/browser/application_context.h" 12 #include "ios/chrome/browser/application_context.h"
13 #include "ios/chrome/browser/browser_state/browser_state_otr_helper.h" 13 #include "ios/chrome/browser/browser_state/browser_state_otr_helper.h"
14 #include "ios/chrome/browser/signin/account_tracker_service_factory.h" 14 #include "ios/chrome/browser/signin/account_tracker_service_factory.h"
15 #include "ios/chrome/browser/web_data_service_factory.h" 15 #include "ios/chrome/browser/web_data_service_factory.h"
16 #include "ios/public/provider/chrome/browser/browser_state/chrome_browser_state. h" 16 #include "ios/public/provider/chrome/browser/browser_state/chrome_browser_state. h"
17 17
18 // static 18 // static
19 autofill::PersonalDataManager* PersonalDataManagerFactory::GetForBrowserState( 19 autofill::PersonalDataManager* PersonalDataManagerFactory::GetForBrowserState(
20 ios::ChromeBrowserState* browser_state) { 20 ios::ChromeBrowserState* browser_state) {
21 return static_cast<autofill::PersonalDataManager*>( 21 return static_cast<autofill::PersonalDataManager*>(
22 GetInstance()->GetServiceForBrowserState(browser_state, true)); 22 GetInstance()->GetServiceForBrowserState(browser_state, true));
23 } 23 }
24 24
25 // static 25 // static
26 PersonalDataManagerFactory* PersonalDataManagerFactory::GetInstance() { 26 PersonalDataManagerFactory* PersonalDataManagerFactory::GetInstance() {
27 return Singleton<PersonalDataManagerFactory>::get(); 27 return base::Singleton<PersonalDataManagerFactory>::get();
28 } 28 }
29 29
30 PersonalDataManagerFactory::PersonalDataManagerFactory() 30 PersonalDataManagerFactory::PersonalDataManagerFactory()
31 : BrowserStateKeyedServiceFactory( 31 : BrowserStateKeyedServiceFactory(
32 "PersonalDataManager", 32 "PersonalDataManager",
33 BrowserStateDependencyManager::GetInstance()) { 33 BrowserStateDependencyManager::GetInstance()) {
34 DependsOn(ios::AccountTrackerServiceFactory::GetInstance()); 34 DependsOn(ios::AccountTrackerServiceFactory::GetInstance());
35 DependsOn(ios::WebDataServiceFactory::GetInstance()); 35 DependsOn(ios::WebDataServiceFactory::GetInstance());
36 } 36 }
37 37
38 PersonalDataManagerFactory::~PersonalDataManagerFactory() {} 38 PersonalDataManagerFactory::~PersonalDataManagerFactory() {}
39 39
40 scoped_ptr<KeyedService> PersonalDataManagerFactory::BuildServiceInstanceFor( 40 scoped_ptr<KeyedService> PersonalDataManagerFactory::BuildServiceInstanceFor(
41 web::BrowserState* context) const { 41 web::BrowserState* context) const {
42 ios::ChromeBrowserState* chrome_browser_state = 42 ios::ChromeBrowserState* chrome_browser_state =
43 ios::ChromeBrowserState::FromBrowserState(context); 43 ios::ChromeBrowserState::FromBrowserState(context);
44 scoped_ptr<autofill::PersonalDataManager> service( 44 scoped_ptr<autofill::PersonalDataManager> service(
45 new autofill::PersonalDataManager( 45 new autofill::PersonalDataManager(
46 GetApplicationContext()->GetApplicationLocale())); 46 GetApplicationContext()->GetApplicationLocale()));
47 service->Init(ios::WebDataServiceFactory::GetAutofillWebDataForBrowserState( 47 service->Init(ios::WebDataServiceFactory::GetAutofillWebDataForBrowserState(
48 chrome_browser_state, ServiceAccessType::EXPLICIT_ACCESS), 48 chrome_browser_state, ServiceAccessType::EXPLICIT_ACCESS),
49 chrome_browser_state->GetPrefs(), 49 chrome_browser_state->GetPrefs(),
50 ios::AccountTrackerServiceFactory::GetForBrowserState( 50 ios::AccountTrackerServiceFactory::GetForBrowserState(
51 chrome_browser_state), 51 chrome_browser_state),
52 chrome_browser_state->IsOffTheRecord()); 52 chrome_browser_state->IsOffTheRecord());
53 return service.Pass(); 53 return service.Pass();
54 } 54 }
OLDNEW
« no previous file with comments | « ios/chrome/browser/autofill/personal_data_manager_factory.h ('k') | ios/chrome/browser/bookmarks/bookmark_client_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698