OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_service.h" | 5 #include "chrome/browser/extensions/extension_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
71 #include "chrome/browser/themes/theme_service_factory.h" | 71 #include "chrome/browser/themes/theme_service_factory.h" |
72 #include "chrome/browser/ui/webui/favicon_source.h" | 72 #include "chrome/browser/ui/webui/favicon_source.h" |
73 #include "chrome/browser/ui/webui/ntp/thumbnail_source.h" | 73 #include "chrome/browser/ui/webui/ntp/thumbnail_source.h" |
74 #include "chrome/browser/ui/webui/theme_source.h" | 74 #include "chrome/browser/ui/webui/theme_source.h" |
75 #include "chrome/common/child_process_logging.h" | 75 #include "chrome/common/child_process_logging.h" |
76 #include "chrome/common/chrome_notification_types.h" | 76 #include "chrome/common/chrome_notification_types.h" |
77 #include "chrome/common/chrome_paths.h" | 77 #include "chrome/common/chrome_paths.h" |
78 #include "chrome/common/chrome_switches.h" | 78 #include "chrome/common/chrome_switches.h" |
79 #include "chrome/common/chrome_version_info.h" | 79 #include "chrome/common/chrome_version_info.h" |
80 #include "chrome/common/extensions/api/plugins/plugins_handler.h" | 80 #include "chrome/common/extensions/api/plugins/plugins_handler.h" |
81 #include "chrome/common/extensions/api/url_handlers/url_handlers_parser.h" | |
81 #include "chrome/common/extensions/background_info.h" | 82 #include "chrome/common/extensions/background_info.h" |
82 #include "chrome/common/extensions/extension.h" | 83 #include "chrome/common/extensions/extension.h" |
83 #include "chrome/common/extensions/extension_file_util.h" | 84 #include "chrome/common/extensions/extension_file_util.h" |
84 #include "chrome/common/extensions/extension_manifest_constants.h" | 85 #include "chrome/common/extensions/extension_manifest_constants.h" |
85 #include "chrome/common/extensions/extension_messages.h" | 86 #include "chrome/common/extensions/extension_messages.h" |
86 #include "chrome/common/extensions/feature_switch.h" | 87 #include "chrome/common/extensions/feature_switch.h" |
87 #include "chrome/common/extensions/features/feature.h" | 88 #include "chrome/common/extensions/features/feature.h" |
88 #include "chrome/common/extensions/incognito_handler.h" | 89 #include "chrome/common/extensions/incognito_handler.h" |
89 #include "chrome/common/extensions/manifest.h" | 90 #include "chrome/common/extensions/manifest.h" |
90 #include "chrome/common/extensions/manifest_handlers/app_isolation_info.h" | 91 #include "chrome/common/extensions/manifest_handlers/app_isolation_info.h" |
91 #include "chrome/common/extensions/manifest_url_handler.h" | 92 #include "chrome/common/extensions/manifest_url_handler.h" |
92 #include "chrome/common/pref_names.h" | 93 #include "chrome/common/pref_names.h" |
93 #include "chrome/common/startup_metric_utils.h" | 94 #include "chrome/common/startup_metric_utils.h" |
94 #include "chrome/common/url_constants.h" | 95 #include "chrome/common/url_constants.h" |
95 #include "content/public/browser/browser_thread.h" | 96 #include "content/public/browser/browser_thread.h" |
96 #include "content/public/browser/devtools_agent_host.h" | 97 #include "content/public/browser/devtools_agent_host.h" |
98 #include "content/public/browser/extension_system_notifications.h" | |
97 #include "content/public/browser/notification_service.h" | 99 #include "content/public/browser/notification_service.h" |
98 #include "content/public/browser/notification_types.h" | 100 #include "content/public/browser/notification_types.h" |
99 #include "content/public/browser/plugin_service.h" | 101 #include "content/public/browser/plugin_service.h" |
100 #include "content/public/browser/render_process_host.h" | 102 #include "content/public/browser/render_process_host.h" |
101 #include "content/public/browser/site_instance.h" | 103 #include "content/public/browser/site_instance.h" |
102 #include "content/public/browser/storage_partition.h" | 104 #include "content/public/browser/storage_partition.h" |
103 #include "content/public/browser/url_data_source.h" | 105 #include "content/public/browser/url_data_source.h" |
104 #include "content/public/common/pepper_plugin_info.h" | 106 #include "content/public/common/pepper_plugin_info.h" |
105 #include "extensions/common/error_utils.h" | 107 #include "extensions/common/error_utils.h" |
106 #include "googleurl/src/gurl.h" | 108 #include "googleurl/src/gurl.h" |
(...skipping 17 matching lines...) Expand all Loading... | |
124 using extensions::CrxInstaller; | 126 using extensions::CrxInstaller; |
125 using extensions::Extension; | 127 using extensions::Extension; |
126 using extensions::ExtensionIdSet; | 128 using extensions::ExtensionIdSet; |
127 using extensions::ExtensionInfo; | 129 using extensions::ExtensionInfo; |
128 using extensions::FeatureSwitch; | 130 using extensions::FeatureSwitch; |
129 using extensions::Manifest; | 131 using extensions::Manifest; |
130 using extensions::PermissionMessage; | 132 using extensions::PermissionMessage; |
131 using extensions::PermissionMessages; | 133 using extensions::PermissionMessages; |
132 using extensions::PermissionSet; | 134 using extensions::PermissionSet; |
133 using extensions::UnloadedExtensionInfo; | 135 using extensions::UnloadedExtensionInfo; |
136 using extensions::AppEventRouter; | |
134 | 137 |
135 namespace errors = extension_manifest_errors; | 138 namespace errors = extension_manifest_errors; |
136 | 139 |
137 namespace { | 140 namespace { |
138 | 141 |
139 // Histogram values for logging events related to externally installed | 142 // Histogram values for logging events related to externally installed |
140 // extensions. | 143 // extensions. |
141 enum ExternalExtensionEvent { | 144 enum ExternalExtensionEvent { |
142 EXTERNAL_EXTENSION_INSTALLED = 0, | 145 EXTERNAL_EXTENSION_INSTALLED = 0, |
143 EXTERNAL_EXTENSION_IGNORED, | 146 EXTERNAL_EXTENSION_IGNORED, |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
371 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, | 374 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, |
372 content::NotificationService::AllBrowserContextsAndSources()); | 375 content::NotificationService::AllBrowserContextsAndSources()); |
373 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CREATED, | 376 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CREATED, |
374 content::NotificationService::AllBrowserContextsAndSources()); | 377 content::NotificationService::AllBrowserContextsAndSources()); |
375 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, | 378 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, |
376 content::NotificationService::AllBrowserContextsAndSources()); | 379 content::NotificationService::AllBrowserContextsAndSources()); |
377 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, | 380 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, |
378 content::NotificationService::AllBrowserContextsAndSources()); | 381 content::NotificationService::AllBrowserContextsAndSources()); |
379 registrar_.Add(this, chrome::NOTIFICATION_UPGRADE_RECOMMENDED, | 382 registrar_.Add(this, chrome::NOTIFICATION_UPGRADE_RECOMMENDED, |
380 content::NotificationService::AllBrowserContextsAndSources()); | 383 content::NotificationService::AllBrowserContextsAndSources()); |
384 registrar_.Add(this, content::NOTIFICATION_LAUNCH_APP_WITH_URL, | |
385 content::NotificationService::AllBrowserContextsAndSources()); | |
381 pref_change_registrar_.Init(profile->GetPrefs()); | 386 pref_change_registrar_.Init(profile->GetPrefs()); |
382 base::Closure callback = | 387 base::Closure callback = |
383 base::Bind(&ExtensionService::OnExtensionInstallPrefChanged, | 388 base::Bind(&ExtensionService::OnExtensionInstallPrefChanged, |
384 base::Unretained(this)); | 389 base::Unretained(this)); |
385 pref_change_registrar_.Add(prefs::kExtensionInstallAllowList, callback); | 390 pref_change_registrar_.Add(prefs::kExtensionInstallAllowList, callback); |
386 pref_change_registrar_.Add(prefs::kExtensionInstallDenyList, callback); | 391 pref_change_registrar_.Add(prefs::kExtensionInstallDenyList, callback); |
387 pref_change_registrar_.Add(prefs::kExtensionAllowedTypes, callback); | 392 pref_change_registrar_.Add(prefs::kExtensionAllowedTypes, callback); |
388 | 393 |
389 // Set up the ExtensionUpdater | 394 // Set up the ExtensionUpdater |
390 if (autoupdate_enabled) { | 395 if (autoupdate_enabled) { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
447 ExtensionService::GenerateInstalledExtensionsSet() const { | 452 ExtensionService::GenerateInstalledExtensionsSet() const { |
448 scoped_ptr<ExtensionSet> installed_extensions(new ExtensionSet()); | 453 scoped_ptr<ExtensionSet> installed_extensions(new ExtensionSet()); |
449 installed_extensions->InsertAll(extensions_); | 454 installed_extensions->InsertAll(extensions_); |
450 installed_extensions->InsertAll(disabled_extensions_); | 455 installed_extensions->InsertAll(disabled_extensions_); |
451 installed_extensions->InsertAll(terminated_extensions_); | 456 installed_extensions->InsertAll(terminated_extensions_); |
452 installed_extensions->InsertAll(blacklisted_extensions_); | 457 installed_extensions->InsertAll(blacklisted_extensions_); |
453 return installed_extensions.PassAs<const ExtensionSet>(); | 458 return installed_extensions.PassAs<const ExtensionSet>(); |
454 } | 459 } |
455 | 460 |
456 extensions::PendingExtensionManager* | 461 extensions::PendingExtensionManager* |
457 ExtensionService::pending_extension_manager() { | 462 ExtensionService::pending_extension_manager() { |
458 return &pending_extension_manager_; | 463 return &pending_extension_manager_; |
459 } | 464 } |
460 | 465 |
461 ExtensionService::~ExtensionService() { | 466 ExtensionService::~ExtensionService() { |
462 // No need to unload extensions here because they are profile-scoped, and the | 467 // No need to unload extensions here because they are profile-scoped, and the |
463 // profile is in the process of being deleted. | 468 // profile is in the process of being deleted. |
464 | 469 |
465 extensions::ProviderCollection::const_iterator i; | 470 extensions::ProviderCollection::const_iterator i; |
466 for (i = external_extension_providers_.begin(); | 471 for (i = external_extension_providers_.begin(); |
467 i != external_extension_providers_.end(); ++i) { | 472 i != external_extension_providers_.end(); ++i) { |
(...skipping 2018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2486 const Extension* extension = extensions_.GetExtensionOrAppByURL( | 2491 const Extension* extension = extensions_.GetExtensionOrAppByURL( |
2487 ExtensionURLInfo(*url)); | 2492 ExtensionURLInfo(*url)); |
2488 if (extension && extension->is_platform_app()) { | 2493 if (extension && extension->is_platform_app()) { |
2489 *url = GURL(chrome::kExtensionInvalidRequestURL); | 2494 *url = GURL(chrome::kExtensionInvalidRequestURL); |
2490 return true; | 2495 return true; |
2491 } | 2496 } |
2492 | 2497 |
2493 return false; | 2498 return false; |
2494 } | 2499 } |
2495 | 2500 |
2501 bool ExtensionService::MaybeRedirectUrlToApp(const GURL& url, | |
2502 const GURL& referrer_url) { | |
2503 // NOTE: The current API spec enforces at most a single app matching a URL. | |
2504 // TODO: Actually implement the above-mentioned enforcement. | |
2505 const extensions::UrlHandlerInfo* handler = | |
2506 extensions_.GetHandlingAppForURL(url); | |
2507 if (handler) { | |
2508 DCHECK(handler->app->is_platform_app()); | |
2509 extensions::AppEventRouter::DispatchOnLaunchedEventWithURL( | |
2510 profile_, handler->app, handler->id, url, referrer_url); | |
2511 return true; | |
2512 } | |
2513 | |
2514 return false; | |
2515 } | |
not at google - send to devlin
2013/08/19 23:32:24
This doesn't need to be in ExtensionService. Pull
sergeygs
2013/08/29 08:24:42
Done. The class is PlatformAppRedirector in chrome
| |
2516 | |
2517 bool ExtensionService::RedirectUrlToApp(const std::string& app_id, | |
2518 const std::string& handler_id, | |
2519 const GURL& url, | |
2520 const GURL& referrer_url) { | |
2521 // We're just saving some time here by explicitly passing both the url and | |
2522 // the handling app ID here. The original initiator of the app's invocation | |
2523 // (e.g. ChromeContentRendererClient) already has to know this info before | |
2524 // calling us. If the caller doesn't know that, it should use | |
2525 // MaybeRedirectUrlToApp() instead. | |
2526 const Extension* app = GetExtensionById(app_id, true); | |
2527 if (app) { | |
2528 DCHECK(app->is_platform_app() && | |
2529 app == extensions_.GetHandlingAppForURL(url)->app); | |
2530 extensions::AppEventRouter::DispatchOnLaunchedEventWithURL( | |
2531 profile_, app, handler_id, url, referrer_url); | |
2532 return true; | |
2533 } | |
2534 | |
2535 return false; | |
2536 } | |
2537 | |
2496 bool ExtensionService::OnExternalExtensionFileFound( | 2538 bool ExtensionService::OnExternalExtensionFileFound( |
2497 const std::string& id, | 2539 const std::string& id, |
2498 const Version* version, | 2540 const Version* version, |
2499 const base::FilePath& path, | 2541 const base::FilePath& path, |
2500 Manifest::Location location, | 2542 Manifest::Location location, |
2501 int creation_flags, | 2543 int creation_flags, |
2502 bool mark_acknowledged) { | 2544 bool mark_acknowledged) { |
2503 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 2545 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
2504 CHECK(Extension::IdIsValid(id)); | 2546 CHECK(Extension::IdIsValid(id)); |
2505 if (extension_prefs_->IsExternalExtensionUninstalled(id)) | 2547 if (extension_prefs_->IsExternalExtensionUninstalled(id)) |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2591 | 2633 |
2592 DevToolsAgentHost::ConnectRenderViewHost(iter->second, | 2634 DevToolsAgentHost::ConnectRenderViewHost(iter->second, |
2593 host->render_view_host()); | 2635 host->render_view_host()); |
2594 orphaned_dev_tools_.erase(iter); | 2636 orphaned_dev_tools_.erase(iter); |
2595 } | 2637 } |
2596 | 2638 |
2597 void ExtensionService::Observe(int type, | 2639 void ExtensionService::Observe(int type, |
2598 const content::NotificationSource& source, | 2640 const content::NotificationSource& source, |
2599 const content::NotificationDetails& details) { | 2641 const content::NotificationDetails& details) { |
2600 switch (type) { | 2642 switch (type) { |
2601 case chrome::NOTIFICATION_APP_TERMINATING: | 2643 case chrome::NOTIFICATION_APP_TERMINATING: { |
2602 // Shutdown has started. Don't start any more extension installs. | 2644 // Shutdown has started. Don't start any more extension installs. |
2603 // (We cannot use ExtensionService::Shutdown() for this because it | 2645 // (We cannot use ExtensionService::Shutdown() for this because it |
2604 // happens too late in browser teardown.) | 2646 // happens too late in browser teardown.) |
2605 browser_terminating_ = true; | 2647 browser_terminating_ = true; |
2606 break; | 2648 break; |
2649 } | |
2650 | |
2607 case chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED: { | 2651 case chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED: { |
2608 if (profile_ != | 2652 if (profile_ != |
2609 content::Source<Profile>(source).ptr()->GetOriginalProfile()) { | 2653 content::Source<Profile>(source).ptr()->GetOriginalProfile()) { |
2610 break; | 2654 break; |
2611 } | 2655 } |
2612 | 2656 |
2613 extensions::ExtensionHost* host = | 2657 extensions::ExtensionHost* host = |
2614 content::Details<extensions::ExtensionHost>(details).ptr(); | 2658 content::Details<extensions::ExtensionHost>(details).ptr(); |
2615 | 2659 |
2616 // Mark the extension as terminated and Unload it. We want it to | 2660 // Mark the extension as terminated and Unload it. We want it to |
2617 // be in a consistent state: either fully working or not loaded | 2661 // be in a consistent state: either fully working or not loaded |
2618 // at all, but never half-crashed. We do it in a PostTask so | 2662 // at all, but never half-crashed. We do it in a PostTask so |
2619 // that other handlers of this notification will still have | 2663 // that other handlers of this notification will still have |
2620 // access to the Extension and ExtensionHost. | 2664 // access to the Extension and ExtensionHost. |
2621 MessageLoop::current()->PostTask( | 2665 MessageLoop::current()->PostTask( |
2622 FROM_HERE, | 2666 FROM_HERE, |
2623 base::Bind( | 2667 base::Bind( |
2624 &ExtensionService::TrackTerminatedExtension, | 2668 &ExtensionService::TrackTerminatedExtension, |
2625 AsWeakPtr(), | 2669 AsWeakPtr(), |
2626 host->extension())); | 2670 host->extension())); |
2627 break; | 2671 break; |
2628 } | 2672 } |
2673 | |
2629 case content::NOTIFICATION_RENDERER_PROCESS_CREATED: { | 2674 case content::NOTIFICATION_RENDERER_PROCESS_CREATED: { |
2630 content::RenderProcessHost* process = | 2675 content::RenderProcessHost* process = |
2631 content::Source<content::RenderProcessHost>(source).ptr(); | 2676 content::Source<content::RenderProcessHost>(source).ptr(); |
2632 Profile* host_profile = | 2677 Profile* host_profile = |
2633 Profile::FromBrowserContext(process->GetBrowserContext()); | 2678 Profile::FromBrowserContext(process->GetBrowserContext()); |
2634 if (!profile_->IsSameProfile(host_profile->GetOriginalProfile())) | 2679 if (!profile_->IsSameProfile(host_profile->GetOriginalProfile())) |
2635 break; | 2680 break; |
2636 | 2681 |
2637 // Extensions need to know the channel for API restrictions. | 2682 // Extensions need to know the channel for API restrictions. |
2638 process->Send(new ExtensionMsg_SetChannel( | 2683 process->Send(new ExtensionMsg_SetChannel( |
(...skipping 13 matching lines...) Expand all Loading... | |
2652 std::vector<ExtensionMsg_Loaded_Params> loaded_extensions; | 2697 std::vector<ExtensionMsg_Loaded_Params> loaded_extensions; |
2653 for (ExtensionSet::const_iterator iter = extensions_.begin(); | 2698 for (ExtensionSet::const_iterator iter = extensions_.begin(); |
2654 iter != extensions_.end(); ++iter) { | 2699 iter != extensions_.end(); ++iter) { |
2655 // Renderers don't need to know about themes. | 2700 // Renderers don't need to know about themes. |
2656 if (!(*iter)->is_theme()) | 2701 if (!(*iter)->is_theme()) |
2657 loaded_extensions.push_back(ExtensionMsg_Loaded_Params(*iter)); | 2702 loaded_extensions.push_back(ExtensionMsg_Loaded_Params(*iter)); |
2658 } | 2703 } |
2659 process->Send(new ExtensionMsg_Loaded(loaded_extensions)); | 2704 process->Send(new ExtensionMsg_Loaded(loaded_extensions)); |
2660 break; | 2705 break; |
2661 } | 2706 } |
2707 | |
2662 case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED: { | 2708 case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED: { |
2663 content::RenderProcessHost* process = | 2709 content::RenderProcessHost* process = |
2664 content::Source<content::RenderProcessHost>(source).ptr(); | 2710 content::Source<content::RenderProcessHost>(source).ptr(); |
2665 Profile* host_profile = | 2711 Profile* host_profile = |
2666 Profile::FromBrowserContext(process->GetBrowserContext()); | 2712 Profile::FromBrowserContext(process->GetBrowserContext()); |
2667 if (!profile_->IsSameProfile(host_profile->GetOriginalProfile())) | 2713 if (!profile_->IsSameProfile(host_profile->GetOriginalProfile())) |
2668 break; | 2714 break; |
2669 | 2715 |
2670 process_map_.RemoveAllFromProcess(process->GetID()); | 2716 process_map_.RemoveAllFromProcess(process->GetID()); |
2671 BrowserThread::PostTask( | 2717 BrowserThread::PostTask( |
2672 BrowserThread::IO, FROM_HERE, | 2718 BrowserThread::IO, FROM_HERE, |
2673 base::Bind(&ExtensionInfoMap::UnregisterAllExtensionsInProcess, | 2719 base::Bind(&ExtensionInfoMap::UnregisterAllExtensionsInProcess, |
2674 system_->info_map(), | 2720 system_->info_map(), |
2675 process->GetID())); | 2721 process->GetID())); |
2676 break; | 2722 break; |
2677 } | 2723 } |
2724 | |
2678 case chrome::NOTIFICATION_IMPORT_FINISHED: { | 2725 case chrome::NOTIFICATION_IMPORT_FINISHED: { |
2679 InitAfterImport(); | 2726 InitAfterImport(); |
2680 break; | 2727 break; |
2681 } | 2728 } |
2729 | |
2682 case chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED: { | 2730 case chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED: { |
2683 extensions::ExtensionHost* host = | 2731 extensions::ExtensionHost* host = |
2684 content::Details<extensions::ExtensionHost>(details).ptr(); | 2732 content::Details<extensions::ExtensionHost>(details).ptr(); |
2685 std::string extension_id = host->extension_id(); | 2733 std::string extension_id = host->extension_id(); |
2686 if (delayed_updates_for_idle_.Contains(extension_id)) { | 2734 if (delayed_updates_for_idle_.Contains(extension_id)) { |
2687 // We were waiting for this extension to become idle, it now might have, | 2735 // We were waiting for this extension to become idle, it now might have, |
2688 // so maybe finish installation. | 2736 // so maybe finish installation. |
2689 MessageLoop::current()->PostDelayedTask( | 2737 MessageLoop::current()->PostDelayedTask( |
2690 FROM_HERE, | 2738 FROM_HERE, |
2691 base::Bind(&ExtensionService::MaybeFinishDelayedInstallation, | 2739 base::Bind(&ExtensionService::MaybeFinishDelayedInstallation, |
2692 AsWeakPtr(), extension_id), | 2740 AsWeakPtr(), extension_id), |
2693 base::TimeDelta::FromSeconds(kUpdateIdleDelay)); | 2741 base::TimeDelta::FromSeconds(kUpdateIdleDelay)); |
2694 } | 2742 } |
2695 break; | 2743 break; |
2696 } | 2744 } |
2745 | |
2697 case chrome::NOTIFICATION_UPGRADE_RECOMMENDED: { | 2746 case chrome::NOTIFICATION_UPGRADE_RECOMMENDED: { |
2698 // Notify extensions that chrome update is available. | 2747 // Notify extensions that chrome update is available. |
2699 extensions::RuntimeEventRouter::DispatchOnBrowserUpdateAvailableEvent( | 2748 extensions::RuntimeEventRouter::DispatchOnBrowserUpdateAvailableEvent( |
2700 profile_); | 2749 profile_); |
2701 | 2750 |
2702 // Notify observers that chrome update is available. | 2751 // Notify observers that chrome update is available. |
2703 FOR_EACH_OBSERVER(extensions::UpdateObserver, update_observers_, | 2752 FOR_EACH_OBSERVER(extensions::UpdateObserver, update_observers_, |
2704 OnChromeUpdateAvailable()); | 2753 OnChromeUpdateAvailable()); |
2705 break; | 2754 break; |
2706 } | 2755 } |
2707 | 2756 |
2757 case content::NOTIFICATION_LAUNCH_APP_WITH_URL: { | |
2758 // Notify the extension system that a navigation has happened whose | |
2759 // target URL was claimed by one of the platform apps, and instruct | |
2760 // it to launch that app. | |
2761 content::LaunchAppWithUrlDetails* launch = | |
2762 content::Details<content::LaunchAppWithUrlDetails>(details).ptr(); | |
2763 RedirectUrlToApp(launch->app_id, launch->handler_id, | |
2764 launch->url, launch->referrer_url); | |
2765 break; | |
2766 } | |
2767 | |
2708 default: | 2768 default: |
2709 NOTREACHED() << "Unexpected notification type."; | 2769 NOTREACHED() << "Unexpected notification type."; |
2710 } | 2770 } |
2711 } | 2771 } |
2712 | 2772 |
2713 void ExtensionService::OnExtensionInstallPrefChanged() { | 2773 void ExtensionService::OnExtensionInstallPrefChanged() { |
2714 IdentifyAlertableExtensions(); | 2774 IdentifyAlertableExtensions(); |
2715 CheckManagementPolicy(); | 2775 CheckManagementPolicy(); |
2716 } | 2776 } |
2717 | 2777 |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3084 } | 3144 } |
3085 | 3145 |
3086 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { | 3146 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { |
3087 update_observers_.AddObserver(observer); | 3147 update_observers_.AddObserver(observer); |
3088 } | 3148 } |
3089 | 3149 |
3090 void ExtensionService::RemoveUpdateObserver( | 3150 void ExtensionService::RemoveUpdateObserver( |
3091 extensions::UpdateObserver* observer) { | 3151 extensions::UpdateObserver* observer) { |
3092 update_observers_.RemoveObserver(observer); | 3152 update_observers_.RemoveObserver(observer); |
3093 } | 3153 } |
OLD | NEW |