| OLD | NEW |
| 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_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 17 matching lines...) Expand all Loading... |
| 28 #include "base/version.h" | 28 #include "base/version.h" |
| 29 #include "chrome/browser/accessibility/accessibility_extension_api.h" | 29 #include "chrome/browser/accessibility/accessibility_extension_api.h" |
| 30 #include "chrome/browser/bookmarks/bookmark_extension_api.h" | 30 #include "chrome/browser/bookmarks/bookmark_extension_api.h" |
| 31 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 31 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 32 #include "chrome/browser/browser_process.h" | 32 #include "chrome/browser/browser_process.h" |
| 33 #include "chrome/browser/chrome_plugin_service_filter.h" | 33 #include "chrome/browser/chrome_plugin_service_filter.h" |
| 34 #include "chrome/browser/debugger/devtools_window.h" | 34 #include "chrome/browser/debugger/devtools_window.h" |
| 35 #include "chrome/browser/extensions/api/app_runtime/app_runtime_api.h" | 35 #include "chrome/browser/extensions/api/app_runtime/app_runtime_api.h" |
| 36 #include "chrome/browser/extensions/api/declarative/rules_registry_service.h" | 36 #include "chrome/browser/extensions/api/declarative/rules_registry_service.h" |
| 37 #include "chrome/browser/extensions/api/extension_action/extension_actions_api.h
" | 37 #include "chrome/browser/extensions/api/extension_action/extension_actions_api.h
" |
| 38 #include "chrome/browser/extensions/api/push_messaging/push_messaging_api.h" | |
| 39 #include "chrome/browser/extensions/api/runtime/runtime_api.h" | 38 #include "chrome/browser/extensions/api/runtime/runtime_api.h" |
| 40 #include "chrome/browser/extensions/app_notification_manager.h" | 39 #include "chrome/browser/extensions/app_notification_manager.h" |
| 41 #include "chrome/browser/extensions/app_sync_data.h" | 40 #include "chrome/browser/extensions/app_sync_data.h" |
| 42 #include "chrome/browser/extensions/browser_event_router.h" | 41 #include "chrome/browser/extensions/browser_event_router.h" |
| 43 #include "chrome/browser/extensions/component_loader.h" | 42 #include "chrome/browser/extensions/component_loader.h" |
| 44 #include "chrome/browser/extensions/crx_installer.h" | 43 #include "chrome/browser/extensions/crx_installer.h" |
| 45 #include "chrome/browser/extensions/data_deleter.h" | 44 #include "chrome/browser/extensions/data_deleter.h" |
| 46 #include "chrome/browser/extensions/extension_disabled_ui.h" | 45 #include "chrome/browser/extensions/extension_disabled_ui.h" |
| 47 #include "chrome/browser/extensions/extension_error_reporter.h" | 46 #include "chrome/browser/extensions/extension_error_reporter.h" |
| 48 #include "chrome/browser/extensions/extension_error_ui.h" | 47 #include "chrome/browser/extensions/extension_error_ui.h" |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 | 517 |
| 519 void ExtensionService::InitEventRouters() { | 518 void ExtensionService::InitEventRouters() { |
| 520 if (event_routers_initialized_) | 519 if (event_routers_initialized_) |
| 521 return; | 520 return; |
| 522 | 521 |
| 523 #if defined(ENABLE_EXTENSIONS) | 522 #if defined(ENABLE_EXTENSIONS) |
| 524 history_event_router_.reset(new HistoryExtensionEventRouter(profile_)); | 523 history_event_router_.reset(new HistoryExtensionEventRouter(profile_)); |
| 525 browser_event_router_.reset(new extensions::BrowserEventRouter(profile_)); | 524 browser_event_router_.reset(new extensions::BrowserEventRouter(profile_)); |
| 526 bookmark_event_router_.reset(new BookmarkExtensionEventRouter( | 525 bookmark_event_router_.reset(new BookmarkExtensionEventRouter( |
| 527 BookmarkModelFactory::GetForProfile(profile_))); | 526 BookmarkModelFactory::GetForProfile(profile_))); |
| 528 push_messaging_event_router_.reset( | |
| 529 new extensions::PushMessagingEventRouter(profile_)); | |
| 530 | 527 |
| 531 #if defined(OS_CHROMEOS) | 528 #if defined(OS_CHROMEOS) |
| 532 FileBrowserEventRouterFactory::GetForProfile( | 529 FileBrowserEventRouterFactory::GetForProfile( |
| 533 profile_)->ObserveFileSystemEvents(); | 530 profile_)->ObserveFileSystemEvents(); |
| 534 | 531 |
| 535 input_method_event_router_.reset( | 532 input_method_event_router_.reset( |
| 536 new chromeos::ExtensionInputMethodEventRouter); | 533 new chromeos::ExtensionInputMethodEventRouter); |
| 537 | 534 |
| 538 ExtensionMediaPlayerEventRouter::GetInstance()->Init(profile_); | 535 ExtensionMediaPlayerEventRouter::GetInstance()->Init(profile_); |
| 539 extensions::InputImeEventRouter::GetInstance()->Init(); | 536 extensions::InputImeEventRouter::GetInstance()->Init(); |
| 540 #endif // defined(OS_CHROMEOS) | 537 #endif // defined(OS_CHROMEOS) |
| 541 #endif // defined(ENABLE_EXTENSIONS) | 538 #endif // defined(ENABLE_EXTENSIONS) |
| 542 event_routers_initialized_ = true; | 539 event_routers_initialized_ = true; |
| 543 } | 540 } |
| 544 | 541 |
| 545 void ExtensionService::OnProfileSyncServiceShutdown() { | |
| 546 // TODO(akalin): Move this block to Shutdown() once | |
| 547 // http://crbug.com/153827 is fixed. | |
| 548 if (push_messaging_event_router_.get()) | |
| 549 push_messaging_event_router_->Shutdown(); | |
| 550 } | |
| 551 | |
| 552 void ExtensionService::Shutdown() { | 542 void ExtensionService::Shutdown() { |
| 553 // Do nothing for now. | 543 // Do nothing for now. |
| 554 } | 544 } |
| 555 | 545 |
| 556 const Extension* ExtensionService::GetExtensionById( | 546 const Extension* ExtensionService::GetExtensionById( |
| 557 const std::string& id, bool include_disabled) const { | 547 const std::string& id, bool include_disabled) const { |
| 558 int include_mask = INCLUDE_ENABLED; | 548 int include_mask = INCLUDE_ENABLED; |
| 559 if (include_disabled) { | 549 if (include_disabled) { |
| 560 // Include blacklisted extensions here because there are hundreds of | 550 // Include blacklisted extensions here because there are hundreds of |
| 561 // callers of this function, and many might assume that this includes those | 551 // callers of this function, and many might assume that this includes those |
| (...skipping 2591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3153 scoped_refptr<const Extension> extension = GetInstalledExtension(*it); | 3143 scoped_refptr<const Extension> extension = GetInstalledExtension(*it); |
| 3154 DCHECK(extension); | 3144 DCHECK(extension); |
| 3155 if (!extension) | 3145 if (!extension) |
| 3156 continue; | 3146 continue; |
| 3157 blacklisted_extensions_.Insert(extension); | 3147 blacklisted_extensions_.Insert(extension); |
| 3158 UnloadExtension(*it, extension_misc::UNLOAD_REASON_BLACKLIST); | 3148 UnloadExtension(*it, extension_misc::UNLOAD_REASON_BLACKLIST); |
| 3159 } | 3149 } |
| 3160 | 3150 |
| 3161 IdentifyAlertableExtensions(); | 3151 IdentifyAlertableExtensions(); |
| 3162 } | 3152 } |
| OLD | NEW |