| 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/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" |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 scoped_ptr<ListValue> args(ControlInfoToEventArguments(info)); | 157 scoped_ptr<ListValue> args(ControlInfoToEventArguments(info)); |
| 158 DispatchEvent(info->profile(), keys::kOnMenuClosed, args.Pass()); | 158 DispatchEvent(info->profile(), keys::kOnMenuClosed, args.Pass()); |
| 159 } | 159 } |
| 160 | 160 |
| 161 void ExtensionAccessibilityEventRouter::DispatchEvent( | 161 void ExtensionAccessibilityEventRouter::DispatchEvent( |
| 162 Profile* profile, | 162 Profile* profile, |
| 163 const char* event_name, | 163 const char* event_name, |
| 164 scoped_ptr<base::ListValue> event_args) { | 164 scoped_ptr<base::ListValue> event_args) { |
| 165 if (enabled_ && profile && | 165 if (enabled_ && profile && |
| 166 extensions::ExtensionSystem::Get(profile)->event_router()) { | 166 extensions::ExtensionSystem::Get(profile)->event_router()) { |
| 167 scoped_ptr<extensions::Event> event(new extensions::Event( |
| 168 event_name, event_args.Pass())); |
| 167 extensions::ExtensionSystem::Get(profile)->event_router()-> | 169 extensions::ExtensionSystem::Get(profile)->event_router()-> |
| 168 DispatchEventToRenderers(event_name, event_args.Pass(), NULL, GURL(), | 170 BroadcastEvent(event.Pass()); |
| 169 extensions::EventFilteringInfo()); | |
| 170 } | 171 } |
| 171 } | 172 } |
| 172 | 173 |
| 173 bool SetAccessibilityEnabledFunction::RunImpl() { | 174 bool SetAccessibilityEnabledFunction::RunImpl() { |
| 174 bool enabled; | 175 bool enabled; |
| 175 EXTENSION_FUNCTION_VALIDATE(args_->GetBoolean(0, &enabled)); | 176 EXTENSION_FUNCTION_VALIDATE(args_->GetBoolean(0, &enabled)); |
| 176 ExtensionAccessibilityEventRouter::GetInstance() | 177 ExtensionAccessibilityEventRouter::GetInstance() |
| 177 ->SetAccessibilityEnabled(enabled); | 178 ->SetAccessibilityEnabled(enabled); |
| 178 return true; | 179 return true; |
| 179 } | 180 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 DictionaryValue* alert_value = new DictionaryValue; | 223 DictionaryValue* alert_value = new DictionaryValue; |
| 223 const string16 message_text = confirm_infobar_delegate->GetMessageText(); | 224 const string16 message_text = confirm_infobar_delegate->GetMessageText(); |
| 224 alert_value->SetString(keys::kMessageKey, message_text); | 225 alert_value->SetString(keys::kMessageKey, message_text); |
| 225 alerts_value->Append(alert_value); | 226 alerts_value->Append(alert_value); |
| 226 } | 227 } |
| 227 } | 228 } |
| 228 | 229 |
| 229 SetResult(alerts_value); | 230 SetResult(alerts_value); |
| 230 return true; | 231 return true; |
| 231 } | 232 } |
| OLD | NEW |