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

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 tests, cleanup 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 ExtensionPrefs::Get(profile_)->set_app_sorting(app_sorting_.get());
208
204 extension_service_->Init(); 209 extension_service_->Init();
205 210
206 // Make the chrome://extension-icon/ resource available. 211 // Make the chrome://extension-icon/ resource available.
207 content::URLDataSource::Add(profile_, new ExtensionIconSource(profile_)); 212 content::URLDataSource::Add(profile_, new ExtensionIconSource(profile_));
208 213
209 quota_service_.reset(new QuotaService); 214 quota_service_.reset(new QuotaService);
210 215
211 if (extensions_enabled) { 216 if (extensions_enabled) {
212 // Load any extensions specified with --load-extension. 217 // Load any extensions specified with --load-extension.
213 // 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
262 InfoMap* ExtensionSystemImpl::Shared::info_map() { 267 InfoMap* ExtensionSystemImpl::Shared::info_map() {
263 if (!extension_info_map_.get()) 268 if (!extension_info_map_.get())
264 extension_info_map_ = new InfoMap(); 269 extension_info_map_ = new InfoMap();
265 return extension_info_map_.get(); 270 return extension_info_map_.get();
266 } 271 }
267 272
268 QuotaService* ExtensionSystemImpl::Shared::quota_service() { 273 QuotaService* ExtensionSystemImpl::Shared::quota_service() {
269 return quota_service_.get(); 274 return quota_service_.get();
270 } 275 }
271 276
277 AppSorting* ExtensionSystemImpl::Shared::app_sorting() {
278 return app_sorting_.get();
279 }
280
272 ContentVerifier* ExtensionSystemImpl::Shared::content_verifier() { 281 ContentVerifier* ExtensionSystemImpl::Shared::content_verifier() {
273 return content_verifier_.get(); 282 return content_verifier_.get();
274 } 283 }
275 284
276 // 285 //
277 // ExtensionSystemImpl 286 // ExtensionSystemImpl
278 // 287 //
279 288
280 ExtensionSystemImpl::ExtensionSystemImpl(Profile* profile) 289 ExtensionSystemImpl::ExtensionSystemImpl(Profile* profile)
281 : profile_(profile) { 290 : profile_(profile) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 InfoMap* ExtensionSystemImpl::info_map() { return shared_->info_map(); } 339 InfoMap* ExtensionSystemImpl::info_map() { return shared_->info_map(); }
331 340
332 const OneShotEvent& ExtensionSystemImpl::ready() const { 341 const OneShotEvent& ExtensionSystemImpl::ready() const {
333 return shared_->ready(); 342 return shared_->ready();
334 } 343 }
335 344
336 QuotaService* ExtensionSystemImpl::quota_service() { 345 QuotaService* ExtensionSystemImpl::quota_service() {
337 return shared_->quota_service(); 346 return shared_->quota_service();
338 } 347 }
339 348
349 AppSorting* ExtensionSystemImpl::app_sorting() {
350 return shared_->app_sorting();
351 }
352
340 ContentVerifier* ExtensionSystemImpl::content_verifier() { 353 ContentVerifier* ExtensionSystemImpl::content_verifier() {
341 return shared_->content_verifier(); 354 return shared_->content_verifier();
342 } 355 }
343 356
344 scoped_ptr<ExtensionSet> ExtensionSystemImpl::GetDependentExtensions( 357 scoped_ptr<ExtensionSet> ExtensionSystemImpl::GetDependentExtensions(
345 const Extension* extension) { 358 const Extension* extension) {
346 return extension_service()->shared_module_service()->GetDependentExtensions( 359 return extension_service()->shared_module_service()->GetDependentExtensions(
347 extension); 360 extension);
348 } 361 }
349 362
(...skipping 30 matching lines...) Expand all
380 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( 393 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts(
381 const std::string& extension_id, 394 const std::string& extension_id,
382 const UnloadedExtensionInfo::Reason reason) { 395 const UnloadedExtensionInfo::Reason reason) {
383 BrowserThread::PostTask( 396 BrowserThread::PostTask(
384 BrowserThread::IO, 397 BrowserThread::IO,
385 FROM_HERE, 398 FROM_HERE,
386 base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason)); 399 base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason));
387 } 400 }
388 401
389 } // namespace extensions 402 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698