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

Side by Side Diff: chrome/browser/extensions/settings/settings_test_util.cc

Issue 11365181: Remove GetExtensionService from Profile. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: response to sky Created 8 years, 1 month 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/extensions/settings/settings_test_util.h" 5 #include "chrome/browser/extensions/settings/settings_test_util.h"
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "chrome/common/extensions/extension.h" 8 #include "chrome/common/extensions/extension.h"
9 #include "chrome/browser/extensions/extension_system_factory.h" 9 #include "chrome/browser/extensions/extension_system_factory.h"
10 #include "chrome/browser/extensions/settings/settings_frontend.h" 10 #include "chrome/browser/extensions/settings/settings_frontend.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 MockExtensionSystem::MockExtensionSystem(Profile* profile) 111 MockExtensionSystem::MockExtensionSystem(Profile* profile)
112 : TestExtensionSystem(profile) {} 112 : TestExtensionSystem(profile) {}
113 MockExtensionSystem::~MockExtensionSystem() {} 113 MockExtensionSystem::~MockExtensionSystem() {}
114 114
115 EventRouter* MockExtensionSystem::event_router() { 115 EventRouter* MockExtensionSystem::event_router() {
116 if (!event_router_.get()) 116 if (!event_router_.get())
117 event_router_.reset(new EventRouter(profile_, NULL)); 117 event_router_.reset(new EventRouter(profile_, NULL));
118 return event_router_.get(); 118 return event_router_.get();
119 } 119 }
120 120
121 ExtensionService* MockExtensionSystem::extension_service() {
122 ExtensionServiceInterface* as_interface =
123 static_cast<ExtensionServiceInterface*>(&extension_service_);
Yoyo Zhou 2012/11/21 00:27:13 ditto
Miranda Callahan 2012/11/26 22:14:24 Unfortunately, all this casting is needed, as Mock
Yoyo Zhou 2012/11/26 22:58:04 You don't need it for the upcasting on this line,
Miranda Callahan 2012/11/29 17:36:35 This probably needs refactoring to get rid of the
124 return static_cast<ExtensionService*>(as_interface);
125 }
126
121 ProfileKeyedService* BuildMockExtensionSystem(Profile* profile) { 127 ProfileKeyedService* BuildMockExtensionSystem(Profile* profile) {
122 return new MockExtensionSystem(profile); 128 return new MockExtensionSystem(profile);
123 } 129 }
124 130
125 // MockProfile 131 // MockProfile
126 132
127 MockProfile::MockProfile(const FilePath& file_path) 133 MockProfile::MockProfile(const FilePath& file_path)
128 : TestingProfile(file_path) { 134 : TestingProfile(file_path) {
129 ExtensionSystemFactory::GetInstance()->SetTestingFactoryAndUse(this, 135 ExtensionSystemFactory::GetInstance()->SetTestingFactoryAndUse(this,
130 &BuildMockExtensionSystem); 136 &BuildMockExtensionSystem);
(...skipping 29 matching lines...) Expand all
160 ValueStore* ScopedSettingsStorageFactory::Create( 166 ValueStore* ScopedSettingsStorageFactory::Create(
161 const FilePath& base_path, 167 const FilePath& base_path,
162 const std::string& extension_id) { 168 const std::string& extension_id) {
163 DCHECK(delegate_.get()); 169 DCHECK(delegate_.get());
164 return delegate_->Create(base_path, extension_id); 170 return delegate_->Create(base_path, extension_id);
165 } 171 }
166 172
167 } // namespace settings_test_util 173 } // namespace settings_test_util
168 174
169 } // namespace extensions 175 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698