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

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

Issue 22944002: Implementation of the "Redirect URLs to Packaged Apps" feature. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fully reverted extension_service.cc to original form 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
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/extension_system.h" 5 #include "chrome/browser/extensions/extension_system.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"
(...skipping 13 matching lines...) Expand all
24 #include "chrome/browser/extensions/extension_pref_value_map.h" 24 #include "chrome/browser/extensions/extension_pref_value_map.h"
25 #include "chrome/browser/extensions/extension_pref_value_map_factory.h" 25 #include "chrome/browser/extensions/extension_pref_value_map_factory.h"
26 #include "chrome/browser/extensions/extension_process_manager.h" 26 #include "chrome/browser/extensions/extension_process_manager.h"
27 #include "chrome/browser/extensions/extension_service.h" 27 #include "chrome/browser/extensions/extension_service.h"
28 #include "chrome/browser/extensions/extension_system_factory.h" 28 #include "chrome/browser/extensions/extension_system_factory.h"
29 #include "chrome/browser/extensions/extension_warning_badge_service.h" 29 #include "chrome/browser/extensions/extension_warning_badge_service.h"
30 #include "chrome/browser/extensions/extension_warning_set.h" 30 #include "chrome/browser/extensions/extension_warning_set.h"
31 #include "chrome/browser/extensions/lazy_background_task_queue.h" 31 #include "chrome/browser/extensions/lazy_background_task_queue.h"
32 #include "chrome/browser/extensions/management_policy.h" 32 #include "chrome/browser/extensions/management_policy.h"
33 #include "chrome/browser/extensions/navigation_observer.h" 33 #include "chrome/browser/extensions/navigation_observer.h"
34 #include "chrome/browser/extensions/platform_app_redirector.h"
34 #include "chrome/browser/extensions/shell_window_geometry_cache.h" 35 #include "chrome/browser/extensions/shell_window_geometry_cache.h"
35 #include "chrome/browser/extensions/standard_management_policy_provider.h" 36 #include "chrome/browser/extensions/standard_management_policy_provider.h"
36 #include "chrome/browser/extensions/state_store.h" 37 #include "chrome/browser/extensions/state_store.h"
37 #include "chrome/browser/extensions/unpacked_installer.h" 38 #include "chrome/browser/extensions/unpacked_installer.h"
38 #include "chrome/browser/extensions/user_script_master.h" 39 #include "chrome/browser/extensions/user_script_master.h"
39 #include "chrome/browser/profiles/profile.h" 40 #include "chrome/browser/profiles/profile.h"
40 #include "chrome/browser/profiles/profile_manager.h" 41 #include "chrome/browser/profiles/profile_manager.h"
41 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" 42 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h"
42 #include "chrome/common/chrome_switches.h" 43 #include "chrome/common/chrome_switches.h"
43 #include "chrome/common/chrome_version_info.h" 44 #include "chrome/common/chrome_version_info.h"
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 extension_service_->InitEventRoutersAfterImport(); 227 extension_service_->InitEventRoutersAfterImport();
227 } else { 228 } else {
228 extension_service_->InitEventRouters(); 229 extension_service_->InitEventRouters();
229 } 230 }
230 231
231 extension_warning_service_.reset(new ExtensionWarningService(profile_)); 232 extension_warning_service_.reset(new ExtensionWarningService(profile_));
232 extension_warning_badge_service_.reset( 233 extension_warning_badge_service_.reset(
233 new ExtensionWarningBadgeService(profile_)); 234 new ExtensionWarningBadgeService(profile_));
234 extension_warning_service_->AddObserver( 235 extension_warning_service_->AddObserver(
235 extension_warning_badge_service_.get()); 236 extension_warning_badge_service_.get());
237
238 platform_app_redirector_.reset(new PlatformAppRedirector(profile_));
236 } 239 }
237 240
238 void ExtensionSystemImpl::Shared::Shutdown() { 241 void ExtensionSystemImpl::Shared::Shutdown() {
239 if (extension_warning_service_) { 242 if (extension_warning_service_) {
240 extension_warning_service_->RemoveObserver( 243 extension_warning_service_->RemoveObserver(
241 extension_warning_badge_service_.get()); 244 extension_warning_badge_service_.get());
242 } 245 }
243 if (extension_service_) 246 if (extension_service_)
244 extension_service_->Shutdown(); 247 extension_service_->Shutdown();
245 } 248 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 } 300 }
298 301
299 ExtensionWarningService* ExtensionSystemImpl::Shared::warning_service() { 302 ExtensionWarningService* ExtensionSystemImpl::Shared::warning_service() {
300 return extension_warning_service_.get(); 303 return extension_warning_service_.get();
301 } 304 }
302 305
303 Blacklist* ExtensionSystemImpl::Shared::blacklist() { 306 Blacklist* ExtensionSystemImpl::Shared::blacklist() {
304 return blacklist_.get(); 307 return blacklist_.get();
305 } 308 }
306 309
310 PlatformAppRedirector* ExtensionSystemImpl::Shared::platform_app_redirector() {
311 return platform_app_redirector_.get();
312 }
313
307 // 314 //
308 // ExtensionSystemImpl 315 // ExtensionSystemImpl
309 // 316 //
310 317
311 ExtensionSystemImpl::ExtensionSystemImpl(Profile* profile) 318 ExtensionSystemImpl::ExtensionSystemImpl(Profile* profile)
312 : profile_(profile) { 319 : profile_(profile) {
313 shared_ = ExtensionSystemSharedFactory::GetForProfile(profile); 320 shared_ = ExtensionSystemSharedFactory::GetForProfile(profile);
314 321
315 if (profile->IsOffTheRecord()) { 322 if (profile->IsOffTheRecord()) {
316 extension_process_manager_.reset(ExtensionProcessManager::Create(profile)); 323 extension_process_manager_.reset(ExtensionProcessManager::Create(profile));
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 } 445 }
439 446
440 ExtensionWarningService* ExtensionSystemImpl::warning_service() { 447 ExtensionWarningService* ExtensionSystemImpl::warning_service() {
441 return shared_->warning_service(); 448 return shared_->warning_service();
442 } 449 }
443 450
444 Blacklist* ExtensionSystemImpl::blacklist() { 451 Blacklist* ExtensionSystemImpl::blacklist() {
445 return shared_->blacklist(); 452 return shared_->blacklist();
446 } 453 }
447 454
455 PlatformAppRedirector* ExtensionSystemImpl::platform_app_redirector() {
456 return shared_->platform_app_redirector();
457 }
458
448 void ExtensionSystemImpl::RegisterExtensionWithRequestContexts( 459 void ExtensionSystemImpl::RegisterExtensionWithRequestContexts(
449 const Extension* extension) { 460 const Extension* extension) {
450 base::Time install_time; 461 base::Time install_time;
451 if (extension->location() != Manifest::COMPONENT) { 462 if (extension->location() != Manifest::COMPONENT) {
452 install_time = extension_service()->extension_prefs()-> 463 install_time = extension_service()->extension_prefs()->
453 GetInstallTime(extension->id()); 464 GetInstallTime(extension->id());
454 } 465 }
455 bool incognito_enabled = 466 bool incognito_enabled =
456 extension_service()->IsIncognitoEnabled(extension->id()); 467 extension_service()->IsIncognitoEnabled(extension->id());
457 BrowserThread::PostTask( 468 BrowserThread::PostTask(
458 BrowserThread::IO, FROM_HERE, 469 BrowserThread::IO, FROM_HERE,
459 base::Bind(&ExtensionInfoMap::AddExtension, info_map(), 470 base::Bind(&ExtensionInfoMap::AddExtension, info_map(),
460 make_scoped_refptr(extension), install_time, 471 make_scoped_refptr(extension), install_time,
461 incognito_enabled)); 472 incognito_enabled));
462 } 473 }
463 474
464 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( 475 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts(
465 const std::string& extension_id, 476 const std::string& extension_id,
466 const extension_misc::UnloadedExtensionReason reason) { 477 const extension_misc::UnloadedExtensionReason reason) {
467 BrowserThread::PostTask( 478 BrowserThread::PostTask(
468 BrowserThread::IO, FROM_HERE, 479 BrowserThread::IO, FROM_HERE,
469 base::Bind(&ExtensionInfoMap::RemoveExtension, info_map(), 480 base::Bind(&ExtensionInfoMap::RemoveExtension, info_map(),
470 extension_id, reason)); 481 extension_id, reason));
471 } 482 }
472 483
473 } // namespace extensions 484 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698