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

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: add missing include 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 t(path_list, FILE_PATH_LITERAL(",")); 196 t(path_list, FILE_PATH_LITERAL(","));
196 while (t.GetNext()) { 197 while (t.GetNext()) {
197 // Load the component extension manifest synchronously. 198 // Load the component extension manifest synchronously.
198 // Blocking the UI thread is acceptable here since 199 // Blocking the UI thread is acceptable here since
199 // this flag designated for developers. 200 // this flag designated for developers.
200 base::ThreadRestrictions::ScopedAllowIO allow_io; 201 base::ThreadRestrictions::ScopedAllowIO allow_io;
201 extension_service_->component_loader()->AddOrReplace( 202 extension_service_->component_loader()->AddOrReplace(
202 base::FilePath(t.token())); 203 base::FilePath(t.token()));
203 } 204 }
204 } 205 }
206
207 app_sorting_.reset(new ChromeAppSorting(profile_));
208
205 extension_service_->Init(); 209 extension_service_->Init();
206 210
207 // Make the chrome://extension-icon/ resource available. 211 // Make the chrome://extension-icon/ resource available.
208 content::URLDataSource::Add(profile_, new ExtensionIconSource(profile_)); 212 content::URLDataSource::Add(profile_, new ExtensionIconSource(profile_));
209 213
210 quota_service_.reset(new QuotaService); 214 quota_service_.reset(new QuotaService);
211 215
212 if (extensions_enabled) { 216 if (extensions_enabled) {
213 // Load any extensions specified with --load-extension. 217 // Load any extensions specified with --load-extension.
214 // TODO(yoz): Seems like this should move into ExtensionService::Init. 218 // TODO(yoz): Seems like this should move into ExtensionService::Init.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 InfoMap* ExtensionSystemImpl::Shared::info_map() { 267 InfoMap* ExtensionSystemImpl::Shared::info_map() {
264 if (!extension_info_map_.get()) 268 if (!extension_info_map_.get())
265 extension_info_map_ = new InfoMap(); 269 extension_info_map_ = new InfoMap();
266 return extension_info_map_.get(); 270 return extension_info_map_.get();
267 } 271 }
268 272
269 QuotaService* ExtensionSystemImpl::Shared::quota_service() { 273 QuotaService* ExtensionSystemImpl::Shared::quota_service() {
270 return quota_service_.get(); 274 return quota_service_.get();
271 } 275 }
272 276
277 AppSorting* ExtensionSystemImpl::Shared::app_sorting() {
278 return app_sorting_.get();
279 }
280
273 ContentVerifier* ExtensionSystemImpl::Shared::content_verifier() { 281 ContentVerifier* ExtensionSystemImpl::Shared::content_verifier() {
274 return content_verifier_.get(); 282 return content_verifier_.get();
275 } 283 }
276 284
277 // 285 //
278 // ExtensionSystemImpl 286 // ExtensionSystemImpl
279 // 287 //
280 288
281 ExtensionSystemImpl::ExtensionSystemImpl(Profile* profile) 289 ExtensionSystemImpl::ExtensionSystemImpl(Profile* profile)
282 : profile_(profile) { 290 : profile_(profile) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 InfoMap* ExtensionSystemImpl::info_map() { return shared_->info_map(); } 339 InfoMap* ExtensionSystemImpl::info_map() { return shared_->info_map(); }
332 340
333 const OneShotEvent& ExtensionSystemImpl::ready() const { 341 const OneShotEvent& ExtensionSystemImpl::ready() const {
334 return shared_->ready(); 342 return shared_->ready();
335 } 343 }
336 344
337 QuotaService* ExtensionSystemImpl::quota_service() { 345 QuotaService* ExtensionSystemImpl::quota_service() {
338 return shared_->quota_service(); 346 return shared_->quota_service();
339 } 347 }
340 348
349 AppSorting* ExtensionSystemImpl::app_sorting() {
350 return shared_->app_sorting();
351 }
352
341 ContentVerifier* ExtensionSystemImpl::content_verifier() { 353 ContentVerifier* ExtensionSystemImpl::content_verifier() {
342 return shared_->content_verifier(); 354 return shared_->content_verifier();
343 } 355 }
344 356
345 scoped_ptr<ExtensionSet> ExtensionSystemImpl::GetDependentExtensions( 357 scoped_ptr<ExtensionSet> ExtensionSystemImpl::GetDependentExtensions(
346 const Extension* extension) { 358 const Extension* extension) {
347 return extension_service()->shared_module_service()->GetDependentExtensions( 359 return extension_service()->shared_module_service()->GetDependentExtensions(
348 extension); 360 extension);
349 } 361 }
350 362
(...skipping 30 matching lines...) Expand all
381 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( 393 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts(
382 const std::string& extension_id, 394 const std::string& extension_id,
383 const UnloadedExtensionInfo::Reason reason) { 395 const UnloadedExtensionInfo::Reason reason) {
384 BrowserThread::PostTask( 396 BrowserThread::PostTask(
385 BrowserThread::IO, 397 BrowserThread::IO,
386 FROM_HERE, 398 FROM_HERE,
387 base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason)); 399 base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason));
388 } 400 }
389 401
390 } // namespace extensions 402 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_system_impl.h ('k') | chrome/browser/extensions/test_extension_prefs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698