summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlimasdf@gmail.com <limasdf@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-17 12:17:56 +0000
committerlimasdf@gmail.com <limasdf@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-17 12:17:56 +0000
commit67e2e83078573cc0ecda539ea5e9333d79525e4a (patch)
tree2de2957f05802ab85726cbae708e8621b17dd8f0
parentbb86d4c372593987c16ab62d21456c4831946f1e (diff)
downloadchromium_src-67e2e83078573cc0ecda539ea5e9333d79525e4a.zip
chromium_src-67e2e83078573cc0ecda539ea5e9333d79525e4a.tar.gz
chromium_src-67e2e83078573cc0ecda539ea5e9333d79525e4a.tar.bz2
Use EventRouter instead of ExtensionSystem::Get->event_router()
BUG=362672 Review URL: https://codereview.chromium.org/239453011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@264478 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/accessibility/accessibility_extension_api.cc16
-rw-r--r--chrome/browser/extensions/extension_keybinding_registry.cc4
-rw-r--r--chrome/browser/notifications/desktop_notification_service.cc4
-rw-r--r--chrome/browser/notifications/message_center_settings_controller.cc6
-rw-r--r--chrome/browser/speech/extension_api/tts_engine_extension_api.cc15
-rw-r--r--chrome/browser/speech/extension_api/tts_extension_api.cc6
-rw-r--r--chrome/browser/ui/ash/ash_keyboard_controller_proxy.cc3
7 files changed, 25 insertions, 29 deletions
diff --git a/chrome/browser/accessibility/accessibility_extension_api.cc b/chrome/browser/accessibility/accessibility_extension_api.cc
index e7fd6c0..178fbfa 100644
--- a/chrome/browser/accessibility/accessibility_extension_api.cc
+++ b/chrome/browser/accessibility/accessibility_extension_api.cc
@@ -206,13 +206,15 @@ void ExtensionAccessibilityEventRouter::DispatchEvent(
Profile* profile,
const char* event_name,
scoped_ptr<base::ListValue> event_args) {
- if (enabled_ && profile &&
- extensions::ExtensionSystem::Get(profile)->event_router()) {
- scoped_ptr<extensions::Event> event(new extensions::Event(
- event_name, event_args.Pass()));
- extensions::ExtensionSystem::Get(profile)->event_router()->
- BroadcastEvent(event.Pass());
- }
+ if (!enabled_ || !profile)
+ return;
+ extensions::EventRouter* event_router = extensions::EventRouter::Get(profile);
+ if (!event_router)
+ return;
+
+ scoped_ptr<extensions::Event> event(new extensions::Event(
+ event_name, event_args.Pass()));
+ event_router->BroadcastEvent(event.Pass());
}
bool AccessibilityPrivateSetAccessibilityEnabledFunction::RunImpl() {
diff --git a/chrome/browser/extensions/extension_keybinding_registry.cc b/chrome/browser/extensions/extension_keybinding_registry.cc
index e4f08c3..958097a 100644
--- a/chrome/browser/extensions/extension_keybinding_registry.cc
+++ b/chrome/browser/extensions/extension_keybinding_registry.cc
@@ -119,8 +119,8 @@ void ExtensionKeybindingRegistry::CommandExecuted(
scoped_ptr<Event> event(new Event("commands.onCommand", args.Pass()));
event->restrict_to_browser_context = profile_;
event->user_gesture = EventRouter::USER_GESTURE_ENABLED;
- ExtensionSystem::Get(profile_)->event_router()->
- DispatchEventToExtension(extension_id, event.Pass());
+ EventRouter::Get(profile_)
+ ->DispatchEventToExtension(extension_id, event.Pass());
}
bool ExtensionKeybindingRegistry::IsAcceleratorRegistered(
diff --git a/chrome/browser/notifications/desktop_notification_service.cc b/chrome/browser/notifications/desktop_notification_service.cc
index a52747d..13e8d12 100644
--- a/chrome/browser/notifications/desktop_notification_service.cc
+++ b/chrome/browser/notifications/desktop_notification_service.cc
@@ -759,8 +759,8 @@ void DesktopNotificationService::FirePermissionLevelChangedEvent(
scoped_ptr<extensions::Event> event(new extensions::Event(
extensions::api::notifications::OnPermissionLevelChanged::kEventName,
args.Pass()));
- extensions::ExtensionSystem::Get(profile_)->event_router()->
- DispatchEventToExtension(notifier_id.id, event.Pass());
+ extensions::EventRouter::Get(profile_)
+ ->DispatchEventToExtension(notifier_id.id, event.Pass());
// Tell the IO thread that this extension's permission for notifications
// has changed.
diff --git a/chrome/browser/notifications/message_center_settings_controller.cc b/chrome/browser/notifications/message_center_settings_controller.cc
index de82030..c0a6022 100644
--- a/chrome/browser/notifications/message_center_settings_controller.cc
+++ b/chrome/browser/notifications/message_center_settings_controller.cc
@@ -392,8 +392,7 @@ bool MessageCenterSettingsController::NotifierHasAdvancedSettings(
return false;
Profile* profile = notifier_groups_[current_notifier_group_]->profile();
- extensions::EventRouter* event_router =
- extensions::ExtensionSystem::Get(profile)->event_router();
+ extensions::EventRouter* event_router = extensions::EventRouter::Get(profile);
return event_router->ExtensionHasEventListener(
extension_id, extensions::api::notifications::OnShowSettings::kEventName);
@@ -413,8 +412,7 @@ void MessageCenterSettingsController::OnNotifierAdvancedSettingsRequested(
return;
Profile* profile = notifier_groups_[current_notifier_group_]->profile();
- extensions::EventRouter* event_router =
- extensions::ExtensionSystem::Get(profile)->event_router();
+ extensions::EventRouter* event_router = extensions::EventRouter::Get(profile);
scoped_ptr<base::ListValue> args(new base::ListValue());
scoped_ptr<extensions::Event> event(new extensions::Event(
diff --git a/chrome/browser/speech/extension_api/tts_engine_extension_api.cc b/chrome/browser/speech/extension_api/tts_engine_extension_api.cc
index ac0f2c8..940bd87 100644
--- a/chrome/browser/speech/extension_api/tts_engine_extension_api.cc
+++ b/chrome/browser/speech/extension_api/tts_engine_extension_api.cc
@@ -63,8 +63,7 @@ void WarnIfMissingPauseOrResumeListener(
void GetExtensionVoices(Profile* profile, std::vector<VoiceData>* out_voices) {
ExtensionService* service = profile->GetExtensionService();
DCHECK(service);
- EventRouter* event_router =
- ExtensionSystem::Get(profile)->event_router();
+ EventRouter* event_router = EventRouter::Get(profile);
DCHECK(event_router);
bool is_offline = (net::NetworkChangeNotifier::GetConnectionType() ==
@@ -167,8 +166,8 @@ void ExtensionTtsEngineSpeak(Utterance* utterance, const VoiceData& voice) {
scoped_ptr<extensions::Event> event(new extensions::Event(
tts_engine_events::kOnSpeak, args.Pass()));
event->restrict_to_browser_context = utterance->profile();
- ExtensionSystem::Get(utterance->profile())->event_router()->
- DispatchEventToExtension(utterance->extension_id(), event.Pass());
+ EventRouter::Get(utterance->profile())
+ ->DispatchEventToExtension(utterance->extension_id(), event.Pass());
}
void ExtensionTtsEngineStop(Utterance* utterance) {
@@ -176,8 +175,8 @@ void ExtensionTtsEngineStop(Utterance* utterance) {
scoped_ptr<extensions::Event> event(new extensions::Event(
tts_engine_events::kOnStop, args.Pass()));
event->restrict_to_browser_context = utterance->profile();
- ExtensionSystem::Get(utterance->profile())->event_router()->
- DispatchEventToExtension(utterance->extension_id(), event.Pass());
+ EventRouter::Get(utterance->profile())
+ ->DispatchEventToExtension(utterance->extension_id(), event.Pass());
}
void ExtensionTtsEnginePause(Utterance* utterance) {
@@ -186,7 +185,7 @@ void ExtensionTtsEnginePause(Utterance* utterance) {
tts_engine_events::kOnPause, args.Pass()));
Profile* profile = utterance->profile();
event->restrict_to_browser_context = profile;
- EventRouter* event_router = ExtensionSystem::Get(profile)->event_router();
+ EventRouter* event_router = EventRouter::Get(profile);
std::string id = utterance->extension_id();
event_router->DispatchEventToExtension(id, event.Pass());
WarnIfMissingPauseOrResumeListener(profile, event_router, id);
@@ -198,7 +197,7 @@ void ExtensionTtsEngineResume(Utterance* utterance) {
tts_engine_events::kOnResume, args.Pass()));
Profile* profile = utterance->profile();
event->restrict_to_browser_context = profile;
- EventRouter* event_router = ExtensionSystem::Get(profile)->event_router();
+ EventRouter* event_router = EventRouter::Get(profile);
std::string id = utterance->extension_id();
event_router->DispatchEventToExtension(id, event.Pass());
WarnIfMissingPauseOrResumeListener(profile, event_router, id);
diff --git a/chrome/browser/speech/extension_api/tts_extension_api.cc b/chrome/browser/speech/extension_api/tts_extension_api.cc
index bc8baf5..c60d7be 100644
--- a/chrome/browser/speech/extension_api/tts_extension_api.cc
+++ b/chrome/browser/speech/extension_api/tts_extension_api.cc
@@ -15,7 +15,6 @@
#include "chrome/browser/speech/tts_controller.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_function_registry.h"
-#include "extensions/browser/extension_system.h"
#include "ui/base/l10n/l10n_util.h"
namespace constants = tts_extension_api_constants;
@@ -129,14 +128,13 @@ void TtsExtensionEventHandler::OnTtsEvent(Utterance* utterance,
new extensions::Event(events::kOnEvent, arguments.Pass()));
event->restrict_to_browser_context = utterance->profile();
event->event_url = utterance->src_url();
- extensions::ExtensionSystem::Get(utterance->profile())->event_router()->
- DispatchEventToExtension(utterance->src_extension_id(), event.Pass());
+ extensions::EventRouter::Get(utterance->profile())
+ ->DispatchEventToExtension(utterance->src_extension_id(), event.Pass());
if (utterance->finished())
delete this;
}
-
bool TtsSpeakFunction::RunImpl() {
std::string text;
EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &text));
diff --git a/chrome/browser/ui/ash/ash_keyboard_controller_proxy.cc b/chrome/browser/ui/ash/ash_keyboard_controller_proxy.cc
index 618cfe8..8c5dfb4 100644
--- a/chrome/browser/ui/ash/ash_keyboard_controller_proxy.cc
+++ b/chrome/browser/ui/ash/ash_keyboard_controller_proxy.cc
@@ -164,8 +164,7 @@ void AshKeyboardControllerProxy::SetUpdateInputType(ui::TextInputType type) {
// TODO(bshe): Need to check the affected window's profile once multi-profile
// is supported.
content::BrowserContext* context = GetBrowserContext();
- extensions::EventRouter* router =
- extensions::ExtensionSystem::Get(context)->event_router();
+ extensions::EventRouter* router = extensions::EventRouter::Get(context);
if (!router->HasEventListener(
virtual_keyboard_private::OnTextInputBoxFocused::kEventName)) {