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

Side by Side Diff: chrome/browser/extensions/api/automation_internal/automation_internal_api.cc

Issue 273423004: Migrate accessibility from RenderView to RenderFrame. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix more compile errors Created 6 years, 7 months 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/extensions/api/automation_internal/automation_internal_ api.h" 5 #include "chrome/browser/extensions/api/automation_internal/automation_internal_ api.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "chrome/browser/extensions/api/automation_internal/automation_util.h" 10 #include "chrome/browser/extensions/api/automation_internal/automation_util.h"
11 #include "chrome/browser/ui/browser.h" 11 #include "chrome/browser/ui/browser.h"
12 #include "chrome/browser/ui/tabs/tab_strip_model.h" 12 #include "chrome/browser/ui/tabs/tab_strip_model.h"
13 #include "chrome/common/chrome_switches.h" 13 #include "chrome/common/chrome_switches.h"
14 #include "chrome/common/extensions/api/automation_internal.h" 14 #include "chrome/common/extensions/api/automation_internal.h"
15 #include "content/public/browser/ax_event_notification_details.h" 15 #include "content/public/browser/ax_event_notification_details.h"
16 #include "content/public/browser/render_frame_host.h"
16 #include "content/public/browser/render_process_host.h" 17 #include "content/public/browser/render_process_host.h"
17 #include "content/public/browser/render_view_host.h"
18 #include "content/public/browser/render_widget_host.h" 18 #include "content/public/browser/render_widget_host.h"
19 #include "content/public/browser/render_widget_host_view.h" 19 #include "content/public/browser/render_widget_host_view.h"
20 #include "content/public/browser/web_contents.h" 20 #include "content/public/browser/web_contents.h"
21 21
22 #if defined(OS_CHROMEOS) 22 #if defined(OS_CHROMEOS)
23 #include "chrome/browser/ui/ash/accessibility/automation_manager_views.h" 23 #include "chrome/browser/ui/ash/accessibility/automation_manager_views.h"
24 #endif 24 #endif
25 25
26 namespace extensions { 26 namespace extensions {
27 class AutomationWebContentsObserver; 27 class AutomationWebContentsObserver;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 if (!rwh) 80 if (!rwh)
81 return false; 81 return false;
82 82
83 results_ = api::automation_internal::EnableCurrentTab::Results::Create( 83 results_ = api::automation_internal::EnableCurrentTab::Results::Create(
84 rwh->GetProcess()->GetID(), rwh->GetRoutingID()); 84 rwh->GetProcess()->GetID(), rwh->GetRoutingID());
85 85
86 SendResponse(true); 86 SendResponse(true);
87 87
88 AutomationWebContentsObserver::CreateForWebContents(contents); 88 AutomationWebContentsObserver::CreateForWebContents(contents);
89 89
90 rwh->EnableTreeOnlyAccessibilityMode(); 90 contents->EnableTreeOnlyAccessibilityMode();
91 91
92 return true; 92 return true;
93 } 93 }
94 94
95 bool AutomationInternalPerformActionFunction::RunAsync() { 95 bool AutomationInternalPerformActionFunction::RunAsync() {
96 using api::automation_internal::PerformAction::Params; 96 using api::automation_internal::PerformAction::Params;
97 scoped_ptr<Params> params(Params::Create(*args_)); 97 scoped_ptr<Params> params(Params::Create(*args_));
98 EXTENSION_FUNCTION_VALIDATE(params.get()); 98 EXTENSION_FUNCTION_VALIDATE(params.get());
99 99
100 content::RenderWidgetHost* rwh = 100 content::RenderFrameHost* rfh =
101 content::RenderWidgetHost::FromID(params->args.process_id, 101 content::RenderFrameHost::FromID(params->args.process_id,
102 params->args.routing_id); 102 params->args.routing_id);
103 if (!rfh)
104 return false;
103 105
104 switch (params->args.action_type) { 106 switch (params->args.action_type) {
105 case api::automation_internal::ACTION_TYPE_DO_DEFAULT: 107 case api::automation_internal::ACTION_TYPE_DO_DEFAULT:
106 rwh->AccessibilityDoDefaultAction(params->args.automation_node_id); 108 rfh->AccessibilityDoDefaultAction(params->args.automation_node_id);
107 break; 109 break;
108 case api::automation_internal::ACTION_TYPE_FOCUS: 110 case api::automation_internal::ACTION_TYPE_FOCUS:
109 rwh->AccessibilitySetFocus(params->args.automation_node_id); 111 rfh->AccessibilitySetFocus(params->args.automation_node_id);
110 break; 112 break;
111 case api::automation_internal::ACTION_TYPE_MAKE_VISIBLE: 113 case api::automation_internal::ACTION_TYPE_MAKE_VISIBLE:
112 rwh->AccessibilityScrollToMakeVisible(params->args.automation_node_id, 114 rfh->AccessibilityScrollToMakeVisible(params->args.automation_node_id,
113 gfx::Rect()); 115 gfx::Rect());
114 break; 116 break;
115 case api::automation_internal::ACTION_TYPE_SET_SELECTION: { 117 case api::automation_internal::ACTION_TYPE_SET_SELECTION: {
116 extensions::api::automation_internal::SetSelectionParams selection_params; 118 extensions::api::automation_internal::SetSelectionParams selection_params;
117 EXTENSION_FUNCTION_VALIDATE( 119 EXTENSION_FUNCTION_VALIDATE(
118 extensions::api::automation_internal::SetSelectionParams::Populate( 120 extensions::api::automation_internal::SetSelectionParams::Populate(
119 params->opt_args.additional_properties, &selection_params)); 121 params->opt_args.additional_properties, &selection_params));
120 rwh->AccessibilitySetTextSelection(params->args.automation_node_id, 122 rfh->AccessibilitySetTextSelection(params->args.automation_node_id,
121 selection_params.start_index, 123 selection_params.start_index,
122 selection_params.end_index); 124 selection_params.end_index);
123 break; 125 break;
124 } 126 }
125 default: 127 default:
126 NOTREACHED(); 128 NOTREACHED();
127 } 129 }
128 return true; 130 return true;
129 } 131 }
130 132
131 bool AutomationInternalEnableDesktopFunction::RunAsync() { 133 bool AutomationInternalEnableDesktopFunction::RunAsync() {
132 if (!CommandLine::ForCurrentProcess()->HasSwitch( 134 if (!CommandLine::ForCurrentProcess()->HasSwitch(
133 switches::kEnableAutomationAPI)) { 135 switches::kEnableAutomationAPI)) {
134 return false; 136 return false;
135 } 137 }
136 138
137 #if defined(OS_CHROMEOS) 139 #if defined(OS_CHROMEOS)
138 AutomationManagerViews::GetInstance()->Enable(browser_context()); 140 AutomationManagerViews::GetInstance()->Enable(browser_context());
139 #else 141 #else
140 error_ = "getDesktop is unsupported by this platform"; 142 error_ = "getDesktop is unsupported by this platform";
141 #endif 143 #endif
142 144
143 return true; 145 return true;
144 } 146 }
145 147
146 } // namespace extensions 148 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698