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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 | 178 |
179 bool GetFocusedControlFunction::RunImpl() { | 179 bool GetFocusedControlFunction::RunImpl() { |
180 // Get the serialized dict from the last focused control and return it. | 180 // Get the serialized dict from the last focused control and return it. |
181 // However, if the dict is empty, that means we haven't seen any focus | 181 // However, if the dict is empty, that means we haven't seen any focus |
182 // events yet, so return null instead. | 182 // events yet, so return null instead. |
183 ExtensionAccessibilityEventRouter *accessibility_event_router = | 183 ExtensionAccessibilityEventRouter *accessibility_event_router = |
184 ExtensionAccessibilityEventRouter::GetInstance(); | 184 ExtensionAccessibilityEventRouter::GetInstance(); |
185 DictionaryValue *last_focused_control_dict = | 185 DictionaryValue *last_focused_control_dict = |
186 accessibility_event_router->last_focused_control_dict(); | 186 accessibility_event_router->last_focused_control_dict(); |
187 if (last_focused_control_dict->size()) { | 187 if (last_focused_control_dict->size()) { |
188 result_.reset(last_focused_control_dict->DeepCopyWithoutEmptyChildren()); | 188 SetResult(last_focused_control_dict->DeepCopyWithoutEmptyChildren()); |
189 } else { | 189 } else { |
190 result_.reset(Value::CreateNullValue()); | 190 SetResult(Value::CreateNullValue()); |
191 } | 191 } |
192 return true; | 192 return true; |
193 } | 193 } |
194 | 194 |
195 bool GetAlertsForTabFunction::RunImpl() { | 195 bool GetAlertsForTabFunction::RunImpl() { |
196 int tab_id; | 196 int tab_id; |
197 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &tab_id)); | 197 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &tab_id)); |
198 | 198 |
199 TabStripModel* tab_strip = NULL; | 199 TabStripModel* tab_strip = NULL; |
200 TabContents* contents = NULL; | 200 TabContents* contents = NULL; |
(...skipping 15 matching lines...) Expand all Loading... |
216 ConfirmInfoBarDelegate* confirm_infobar_delegate = | 216 ConfirmInfoBarDelegate* confirm_infobar_delegate = |
217 infobar_delegate->AsConfirmInfoBarDelegate(); | 217 infobar_delegate->AsConfirmInfoBarDelegate(); |
218 if (confirm_infobar_delegate) { | 218 if (confirm_infobar_delegate) { |
219 DictionaryValue* alert_value = new DictionaryValue; | 219 DictionaryValue* alert_value = new DictionaryValue; |
220 const string16 message_text = confirm_infobar_delegate->GetMessageText(); | 220 const string16 message_text = confirm_infobar_delegate->GetMessageText(); |
221 alert_value->SetString(keys::kMessageKey, message_text); | 221 alert_value->SetString(keys::kMessageKey, message_text); |
222 alerts_value->Append(alert_value); | 222 alerts_value->Append(alert_value); |
223 } | 223 } |
224 } | 224 } |
225 | 225 |
226 result_.reset(alerts_value); | 226 SetResult(alerts_value); |
227 return true; | 227 return true; |
228 } | 228 } |
OLD | NEW |