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

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

Issue 11312228: Move extension_error_utils.* and url_pattern_set.* into (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: hate 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/automation/testing_automation_provider.cc » ('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_system.h"
16 #include "chrome/browser/extensions/extension_tab_util.h" 16 #include "chrome/browser/extensions/extension_tab_util.h"
17 #include "chrome/browser/infobars/infobar_tab_helper.h" 17 #include "chrome/browser/infobars/infobar_tab_helper.h"
18 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/common/chrome_notification_types.h" 19 #include "chrome/common/chrome_notification_types.h"
20 #include "chrome/common/extensions/extension_error_utils.h"
21 #include "content/public/browser/notification_service.h" 20 #include "content/public/browser/notification_service.h"
21 #include "extensions/common/error_utils.h"
22 22
23 namespace keys = extension_accessibility_api_constants; 23 namespace keys = extension_accessibility_api_constants;
24 24
25 // Returns the AccessibilityControlInfo serialized into a JSON string, 25 // Returns the AccessibilityControlInfo serialized into a JSON string,
26 // consisting of an array of a single object of type AccessibilityObject, 26 // consisting of an array of a single object of type AccessibilityObject,
27 // as defined in the accessibility extension api's json schema. 27 // as defined in the accessibility extension api's json schema.
28 scoped_ptr<ListValue> ControlInfoToEventArguments( 28 scoped_ptr<ListValue> ControlInfoToEventArguments(
29 const AccessibilityEventInfo* info) { 29 const AccessibilityEventInfo* info) {
30 DictionaryValue* dict = new DictionaryValue(); 30 DictionaryValue* dict = new DictionaryValue();
31 info->SerializeToDict(dict); 31 info->SerializeToDict(dict);
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 196
197 bool GetAlertsForTabFunction::RunImpl() { 197 bool GetAlertsForTabFunction::RunImpl() {
198 int tab_id; 198 int tab_id;
199 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &tab_id)); 199 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &tab_id));
200 200
201 TabStripModel* tab_strip = NULL; 201 TabStripModel* tab_strip = NULL;
202 content::WebContents* contents = NULL; 202 content::WebContents* contents = NULL;
203 int tab_index = -1; 203 int tab_index = -1;
204 if (!ExtensionTabUtil::GetTabById(tab_id, profile(), include_incognito(), 204 if (!ExtensionTabUtil::GetTabById(tab_id, profile(), include_incognito(),
205 NULL, &tab_strip, &contents, &tab_index)) { 205 NULL, &tab_strip, &contents, &tab_index)) {
206 error_ = ExtensionErrorUtils::FormatErrorMessage( 206 error_ = extensions::ErrorUtils::FormatErrorMessage(
207 extensions::tabs_constants::kTabNotFoundError, 207 extensions::tabs_constants::kTabNotFoundError,
208 base::IntToString(tab_id)); 208 base::IntToString(tab_id));
209 return false; 209 return false;
210 } 210 }
211 211
212 ListValue* alerts_value = new ListValue; 212 ListValue* alerts_value = new ListValue;
213 213
214 InfoBarTabHelper* infobar_helper = 214 InfoBarTabHelper* infobar_helper =
215 InfoBarTabHelper::FromWebContents(contents); 215 InfoBarTabHelper::FromWebContents(contents);
216 for (size_t i = 0; i < infobar_helper->GetInfoBarCount(); ++i) { 216 for (size_t i = 0; i < infobar_helper->GetInfoBarCount(); ++i) {
217 // TODO(hashimoto): Make other kind of alerts available. crosbug.com/24281 217 // TODO(hashimoto): Make other kind of alerts available. crosbug.com/24281
218 InfoBarDelegate* infobar_delegate = infobar_helper->GetInfoBarDelegateAt(i); 218 InfoBarDelegate* infobar_delegate = infobar_helper->GetInfoBarDelegateAt(i);
219 ConfirmInfoBarDelegate* confirm_infobar_delegate = 219 ConfirmInfoBarDelegate* confirm_infobar_delegate =
220 infobar_delegate->AsConfirmInfoBarDelegate(); 220 infobar_delegate->AsConfirmInfoBarDelegate();
221 if (confirm_infobar_delegate) { 221 if (confirm_infobar_delegate) {
222 DictionaryValue* alert_value = new DictionaryValue; 222 DictionaryValue* alert_value = new DictionaryValue;
223 const string16 message_text = confirm_infobar_delegate->GetMessageText(); 223 const string16 message_text = confirm_infobar_delegate->GetMessageText();
224 alert_value->SetString(keys::kMessageKey, message_text); 224 alert_value->SetString(keys::kMessageKey, message_text);
225 alerts_value->Append(alert_value); 225 alerts_value->Append(alert_value);
226 } 226 }
227 } 227 }
228 228
229 SetResult(alerts_value); 229 SetResult(alerts_value);
230 return true; 230 return true;
231 } 231 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/automation/testing_automation_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698