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

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

Issue 23033016: Remove autocheckout code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Even more deletes, and Ilya review. Created 7 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/autofill/autocheckout_whitelist_manager_factory.h"
6
7 #include "base/memory/scoped_ptr.h"
8 #include "base/memory/singleton.h"
9 #include "chrome/browser/profiles/incognito_helpers.h"
10 #include "chrome/browser/profiles/profile.h"
11 #include "components/autofill/content/browser/autocheckout/whitelist_manager.h"
12 #include "components/browser_context_keyed_service/browser_context_dependency_ma nager.h"
13
14 namespace autofill {
15 namespace autocheckout {
16
17 class WhitelistManagerServiceImpl
18 : public WhitelistManagerService {
19 public:
20 explicit WhitelistManagerServiceImpl(Profile* profile);
21 virtual ~WhitelistManagerServiceImpl();
22
23 // WhitelistManagerService:
24 virtual void Shutdown() OVERRIDE;
25 virtual WhitelistManager* GetWhitelistManager() OVERRIDE;
26
27 private:
28 scoped_ptr<WhitelistManager> whitelist_manager_;
29 };
30
31 WhitelistManagerServiceImpl
32 ::WhitelistManagerServiceImpl(Profile* profile) {
33 whitelist_manager_.reset(new WhitelistManager());
34 whitelist_manager_->Init(profile->GetRequestContext());
35 }
36
37 WhitelistManagerServiceImpl
38 ::~WhitelistManagerServiceImpl() {}
39
40 void WhitelistManagerServiceImpl::Shutdown() {
41 whitelist_manager_.reset();
42 }
43
44 WhitelistManager*
45 WhitelistManagerServiceImpl::GetWhitelistManager() {
46 return whitelist_manager_.get();
47 }
48
49 // static
50 WhitelistManager*
51 WhitelistManagerFactory::GetForProfile(Profile* profile) {
52 WhitelistManagerService* service =
53 static_cast<WhitelistManagerService*>(
54 GetInstance()->GetServiceForBrowserContext(profile, true));
55 // service can be NULL for tests.
56 return service ? service->GetWhitelistManager() : NULL;
57 }
58
59 // static
60 WhitelistManagerFactory*
61 WhitelistManagerFactory::GetInstance() {
62 return Singleton<WhitelistManagerFactory>::get();
63 }
64
65 WhitelistManagerFactory::WhitelistManagerFactory()
66 : BrowserContextKeyedServiceFactory(
67 "AutocheckoutWhitelistManager",
68 BrowserContextDependencyManager::GetInstance()) {
69 }
70
71 WhitelistManagerFactory::~WhitelistManagerFactory() {
72 }
73
74 BrowserContextKeyedService*
75 WhitelistManagerFactory::BuildServiceInstanceFor(
76 content::BrowserContext* profile) const {
77 WhitelistManagerService* service =
78 new WhitelistManagerServiceImpl(static_cast<Profile*>(profile));
79 return service;
80 }
81
82 content::BrowserContext* WhitelistManagerFactory::GetBrowserContextToUse(
83 content::BrowserContext* context) const {
84 return chrome::GetBrowserContextRedirectedInIncognito(context);
85 }
86
87 bool WhitelistManagerFactory::ServiceIsNULLWhileTesting() const {
88 return true;
89 }
90
91 } // namespace autocheckout
92 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698