| 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 NULL, &tab_strip, &contents, &tab_index)) { | 203 NULL, &tab_strip, &contents, &tab_index)) { |
| 204 error_ = ExtensionErrorUtils::FormatErrorMessage( | 204 error_ = ExtensionErrorUtils::FormatErrorMessage( |
| 205 extensions::tabs_constants::kTabNotFoundError, | 205 extensions::tabs_constants::kTabNotFoundError, |
| 206 base::IntToString(tab_id)); | 206 base::IntToString(tab_id)); |
| 207 return false; | 207 return false; |
| 208 } | 208 } |
| 209 | 209 |
| 210 ListValue* alerts_value = new ListValue; | 210 ListValue* alerts_value = new ListValue; |
| 211 | 211 |
| 212 InfoBarTabHelper* infobar_helper = contents->infobar_tab_helper(); | 212 InfoBarTabHelper* infobar_helper = contents->infobar_tab_helper(); |
| 213 for (size_t i = 0; i < infobar_helper->infobar_count(); ++i) { | 213 for (size_t i = 0; i < infobar_helper->GetInfoBarCount(); ++i) { |
| 214 // TODO(hashimoto): Make other kind of alerts available. crosbug.com/24281 | 214 // TODO(hashimoto): Make other kind of alerts available. crosbug.com/24281 |
| 215 InfoBarDelegate* infobar_delegate = infobar_helper->GetInfoBarDelegateAt(i); | 215 InfoBarDelegate* infobar_delegate = infobar_helper->GetInfoBarDelegateAt(i); |
| 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 SetResult(alerts_value); | 226 SetResult(alerts_value); |
| 227 return true; | 227 return true; |
| 228 } | 228 } |
| OLD | NEW |