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

Side by Side Diff: chrome/browser/accessibility/accessibility_extension_api.cc

Issue 11232066: Remove GetExtensionEventRouter from Profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rerebase Created 8 years, 1 month 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
« no previous file with comments | « no previous file | chrome/browser/bookmarks/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/accessibility/accessibility_extension_api.h" 5 #include "chrome/browser/accessibility/accessibility_extension_api.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/string_number_conversions.h" 8 #include "base/string_number_conversions.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/accessibility/accessibility_extension_api_constants.h" 10 #include "chrome/browser/accessibility/accessibility_extension_api_constants.h"
11 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" 11 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h"
12 #include "chrome/browser/api/infobars/infobar_delegate.h" 12 #include "chrome/browser/api/infobars/infobar_delegate.h"
13 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" 13 #include "chrome/browser/extensions/api/tabs/tabs_constants.h"
14 #include "chrome/browser/extensions/event_router.h" 14 #include "chrome/browser/extensions/event_router.h"
15 #include "chrome/browser/extensions/extension_system.h"
15 #include "chrome/browser/extensions/extension_tab_util.h" 16 #include "chrome/browser/extensions/extension_tab_util.h"
16 #include "chrome/browser/infobars/infobar_tab_helper.h" 17 #include "chrome/browser/infobars/infobar_tab_helper.h"
17 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/ui/tab_contents/tab_contents.h" 19 #include "chrome/browser/ui/tab_contents/tab_contents.h"
19 #include "chrome/common/chrome_notification_types.h" 20 #include "chrome/common/chrome_notification_types.h"
20 #include "chrome/common/extensions/extension_error_utils.h" 21 #include "chrome/common/extensions/extension_error_utils.h"
21 #include "content/public/browser/notification_service.h" 22 #include "content/public/browser/notification_service.h"
22 23
23 namespace keys = extension_accessibility_api_constants; 24 namespace keys = extension_accessibility_api_constants;
24 25
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 void ExtensionAccessibilityEventRouter::OnMenuClosed( 156 void ExtensionAccessibilityEventRouter::OnMenuClosed(
156 const AccessibilityMenuInfo* info) { 157 const AccessibilityMenuInfo* info) {
157 scoped_ptr<ListValue> args(ControlInfoToEventArguments(info)); 158 scoped_ptr<ListValue> args(ControlInfoToEventArguments(info));
158 DispatchEvent(info->profile(), keys::kOnMenuClosed, args.Pass()); 159 DispatchEvent(info->profile(), keys::kOnMenuClosed, args.Pass());
159 } 160 }
160 161
161 void ExtensionAccessibilityEventRouter::DispatchEvent( 162 void ExtensionAccessibilityEventRouter::DispatchEvent(
162 Profile* profile, 163 Profile* profile,
163 const char* event_name, 164 const char* event_name,
164 scoped_ptr<base::ListValue> event_args) { 165 scoped_ptr<base::ListValue> event_args) {
165 if (enabled_ && profile && profile->GetExtensionEventRouter()) { 166 if (enabled_ && profile &&
166 profile->GetExtensionEventRouter()->DispatchEventToRenderers(event_name, 167 extensions::ExtensionSystem::Get(profile)->event_router()) {
167 event_args.Pass(), NULL, GURL(), extensions::EventFilteringInfo()); 168 extensions::ExtensionSystem::Get(profile)->event_router()->
169 DispatchEventToRenderers(event_name, event_args.Pass(), NULL, GURL(),
170 extensions::EventFilteringInfo());
168 } 171 }
169 } 172 }
170 173
171 bool SetAccessibilityEnabledFunction::RunImpl() { 174 bool SetAccessibilityEnabledFunction::RunImpl() {
172 bool enabled; 175 bool enabled;
173 EXTENSION_FUNCTION_VALIDATE(args_->GetBoolean(0, &enabled)); 176 EXTENSION_FUNCTION_VALIDATE(args_->GetBoolean(0, &enabled));
174 ExtensionAccessibilityEventRouter::GetInstance() 177 ExtensionAccessibilityEventRouter::GetInstance()
175 ->SetAccessibilityEnabled(enabled); 178 ->SetAccessibilityEnabled(enabled);
176 return true; 179 return true;
177 } 180 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 DictionaryValue* alert_value = new DictionaryValue; 223 DictionaryValue* alert_value = new DictionaryValue;
221 const string16 message_text = confirm_infobar_delegate->GetMessageText(); 224 const string16 message_text = confirm_infobar_delegate->GetMessageText();
222 alert_value->SetString(keys::kMessageKey, message_text); 225 alert_value->SetString(keys::kMessageKey, message_text);
223 alerts_value->Append(alert_value); 226 alerts_value->Append(alert_value);
224 } 227 }
225 } 228 }
226 229
227 SetResult(alerts_value); 230 SetResult(alerts_value);
228 return true; 231 return true;
229 } 232 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/bookmarks/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698