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

Side by Side Diff: chrome/browser/extensions/extension_system_impl.cc

Issue 1254363004: Move ownership of AppSorting from ExtensionPrefs to ExtensionSystem (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix extensions_unittests Created 5 years, 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/extension_system_impl.h" 5 #include "chrome/browser/extensions/extension_system_impl.h"
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "base/strings/string_tokenizer.h" 12 #include "base/strings/string_tokenizer.h"
13 #include "base/trace_event/trace_event.h" 13 #include "base/trace_event/trace_event.h"
14 #include "chrome/browser/browser_process.h" 14 #include "chrome/browser/browser_process.h"
15 #include "chrome/browser/extensions/chrome_app_sorting.h"
15 #include "chrome/browser/extensions/chrome_content_verifier_delegate.h" 16 #include "chrome/browser/extensions/chrome_content_verifier_delegate.h"
16 #include "chrome/browser/extensions/component_loader.h" 17 #include "chrome/browser/extensions/component_loader.h"
17 #include "chrome/browser/extensions/extension_error_reporter.h" 18 #include "chrome/browser/extensions/extension_error_reporter.h"
18 #include "chrome/browser/extensions/extension_management.h" 19 #include "chrome/browser/extensions/extension_management.h"
19 #include "chrome/browser/extensions/extension_service.h" 20 #include "chrome/browser/extensions/extension_service.h"
20 #include "chrome/browser/extensions/extension_system_factory.h" 21 #include "chrome/browser/extensions/extension_system_factory.h"
21 #include "chrome/browser/extensions/extension_util.h" 22 #include "chrome/browser/extensions/extension_util.h"
22 #include "chrome/browser/extensions/install_verifier.h" 23 #include "chrome/browser/extensions/install_verifier.h"
23 #include "chrome/browser/extensions/navigation_observer.h" 24 #include "chrome/browser/extensions/navigation_observer.h"
24 #include "chrome/browser/extensions/shared_module_service.h" 25 #include "chrome/browser/extensions/shared_module_service.h"
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 t(path_list, FILE_PATH_LITERAL(",")); 195 t(path_list, FILE_PATH_LITERAL(","));
195 while (t.GetNext()) { 196 while (t.GetNext()) {
196 // Load the component extension manifest synchronously. 197 // Load the component extension manifest synchronously.
197 // Blocking the UI thread is acceptable here since 198 // Blocking the UI thread is acceptable here since
198 // this flag designated for developers. 199 // this flag designated for developers.
199 base::ThreadRestrictions::ScopedAllowIO allow_io; 200 base::ThreadRestrictions::ScopedAllowIO allow_io;
200 extension_service_->component_loader()->AddOrReplace( 201 extension_service_->component_loader()->AddOrReplace(
201 base::FilePath(t.token())); 202 base::FilePath(t.token()));
202 } 203 }
203 } 204 }
205
206 app_sorting_.reset(new ChromeAppSorting(profile_));
207
204 extension_service_->Init(); 208 extension_service_->Init();
205 209
206 // Make the chrome://extension-icon/ resource available. 210 // Make the chrome://extension-icon/ resource available.
207 content::URLDataSource::Add(profile_, new ExtensionIconSource(profile_)); 211 content::URLDataSource::Add(profile_, new ExtensionIconSource(profile_));
208 212
209 quota_service_.reset(new QuotaService); 213 quota_service_.reset(new QuotaService);
210 214
211 if (extensions_enabled) { 215 if (extensions_enabled) {
212 // Load any extensions specified with --load-extension. 216 // Load any extensions specified with --load-extension.
213 // TODO(yoz): Seems like this should move into ExtensionService::Init. 217 // TODO(yoz): Seems like this should move into ExtensionService::Init.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 InfoMap* ExtensionSystemImpl::Shared::info_map() { 266 InfoMap* ExtensionSystemImpl::Shared::info_map() {
263 if (!extension_info_map_.get()) 267 if (!extension_info_map_.get())
264 extension_info_map_ = new InfoMap(); 268 extension_info_map_ = new InfoMap();
265 return extension_info_map_.get(); 269 return extension_info_map_.get();
266 } 270 }
267 271
268 QuotaService* ExtensionSystemImpl::Shared::quota_service() { 272 QuotaService* ExtensionSystemImpl::Shared::quota_service() {
269 return quota_service_.get(); 273 return quota_service_.get();
270 } 274 }
271 275
276 AppSorting* ExtensionSystemImpl::Shared::app_sorting() {
277 return app_sorting_.get();
278 }
279
272 ContentVerifier* ExtensionSystemImpl::Shared::content_verifier() { 280 ContentVerifier* ExtensionSystemImpl::Shared::content_verifier() {
273 return content_verifier_.get(); 281 return content_verifier_.get();
274 } 282 }
275 283
276 // 284 //
277 // ExtensionSystemImpl 285 // ExtensionSystemImpl
278 // 286 //
279 287
280 ExtensionSystemImpl::ExtensionSystemImpl(Profile* profile) 288 ExtensionSystemImpl::ExtensionSystemImpl(Profile* profile)
281 : profile_(profile) { 289 : profile_(profile) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 InfoMap* ExtensionSystemImpl::info_map() { return shared_->info_map(); } 338 InfoMap* ExtensionSystemImpl::info_map() { return shared_->info_map(); }
331 339
332 const OneShotEvent& ExtensionSystemImpl::ready() const { 340 const OneShotEvent& ExtensionSystemImpl::ready() const {
333 return shared_->ready(); 341 return shared_->ready();
334 } 342 }
335 343
336 QuotaService* ExtensionSystemImpl::quota_service() { 344 QuotaService* ExtensionSystemImpl::quota_service() {
337 return shared_->quota_service(); 345 return shared_->quota_service();
338 } 346 }
339 347
348 AppSorting* ExtensionSystemImpl::app_sorting() {
349 return shared_->app_sorting();
350 }
351
340 ContentVerifier* ExtensionSystemImpl::content_verifier() { 352 ContentVerifier* ExtensionSystemImpl::content_verifier() {
341 return shared_->content_verifier(); 353 return shared_->content_verifier();
342 } 354 }
343 355
344 scoped_ptr<ExtensionSet> ExtensionSystemImpl::GetDependentExtensions( 356 scoped_ptr<ExtensionSet> ExtensionSystemImpl::GetDependentExtensions(
345 const Extension* extension) { 357 const Extension* extension) {
346 return extension_service()->shared_module_service()->GetDependentExtensions( 358 return extension_service()->shared_module_service()->GetDependentExtensions(
347 extension); 359 extension);
348 } 360 }
349 361
(...skipping 30 matching lines...) Expand all
380 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( 392 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts(
381 const std::string& extension_id, 393 const std::string& extension_id,
382 const UnloadedExtensionInfo::Reason reason) { 394 const UnloadedExtensionInfo::Reason reason) {
383 BrowserThread::PostTask( 395 BrowserThread::PostTask(
384 BrowserThread::IO, 396 BrowserThread::IO,
385 FROM_HERE, 397 FROM_HERE,
386 base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason)); 398 base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason));
387 } 399 }
388 400
389 } // namespace extensions 401 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698