OLD | NEW |
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/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 162 |
163 // AutomationActionAdapter implementation. | 163 // AutomationActionAdapter implementation. |
164 void DoDefault(int32 id) override { rfh_->AccessibilityDoDefaultAction(id); } | 164 void DoDefault(int32 id) override { rfh_->AccessibilityDoDefaultAction(id); } |
165 | 165 |
166 void Focus(int32 id) override { rfh_->AccessibilitySetFocus(id); } | 166 void Focus(int32 id) override { rfh_->AccessibilitySetFocus(id); } |
167 | 167 |
168 void MakeVisible(int32 id) override { | 168 void MakeVisible(int32 id) override { |
169 rfh_->AccessibilityScrollToMakeVisible(id, gfx::Rect()); | 169 rfh_->AccessibilityScrollToMakeVisible(id, gfx::Rect()); |
170 } | 170 } |
171 | 171 |
172 void SetSelection(int32 id, int32 start, int32 end) override { | 172 void SetSelection(int32 anchor_id, |
173 rfh_->AccessibilitySetTextSelection(id, start, end); | 173 int32 anchor_offset, |
| 174 int32 focus_id, |
| 175 int32 focus_offset) override { |
| 176 rfh_->AccessibilitySetSelection(anchor_id, anchor_offset, focus_id, |
| 177 focus_offset); |
174 } | 178 } |
175 | 179 |
176 void ShowContextMenu(int32 id) override { | 180 void ShowContextMenu(int32 id) override { |
177 rfh_->AccessibilityShowContextMenu(id); | 181 rfh_->AccessibilityShowContextMenu(id); |
178 } | 182 } |
179 | 183 |
180 private: | 184 private: |
181 content::RenderFrameHost* rfh_; | 185 content::RenderFrameHost* rfh_; |
182 | 186 |
183 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostActionAdapter); | 187 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostActionAdapter); |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 adapter->Focus(automation_id); | 357 adapter->Focus(automation_id); |
354 break; | 358 break; |
355 case api::automation_internal::ACTION_TYPE_MAKEVISIBLE: | 359 case api::automation_internal::ACTION_TYPE_MAKEVISIBLE: |
356 adapter->MakeVisible(automation_id); | 360 adapter->MakeVisible(automation_id); |
357 break; | 361 break; |
358 case api::automation_internal::ACTION_TYPE_SETSELECTION: { | 362 case api::automation_internal::ACTION_TYPE_SETSELECTION: { |
359 api::automation_internal::SetSelectionParams selection_params; | 363 api::automation_internal::SetSelectionParams selection_params; |
360 EXTENSION_FUNCTION_VALIDATE( | 364 EXTENSION_FUNCTION_VALIDATE( |
361 api::automation_internal::SetSelectionParams::Populate( | 365 api::automation_internal::SetSelectionParams::Populate( |
362 params->opt_args.additional_properties, &selection_params)); | 366 params->opt_args.additional_properties, &selection_params)); |
363 adapter->SetSelection(automation_id, | 367 adapter->SetSelection(automation_id, selection_params.anchor_offset, |
364 selection_params.start_index, | 368 selection_params.focus_node_id, |
365 selection_params.end_index); | 369 selection_params.focus_offset); |
366 break; | 370 break; |
367 } | 371 } |
368 case api::automation_internal::ACTION_TYPE_SHOWCONTEXTMENU: { | 372 case api::automation_internal::ACTION_TYPE_SHOWCONTEXTMENU: { |
369 adapter->ShowContextMenu(automation_id); | 373 adapter->ShowContextMenu(automation_id); |
370 break; | 374 break; |
371 } | 375 } |
372 default: | 376 default: |
373 NOTREACHED(); | 377 NOTREACHED(); |
374 } | 378 } |
375 return RespondNow(NoArguments()); | 379 return RespondNow(NoArguments()); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 int result_acc_obj_id) { | 443 int result_acc_obj_id) { |
440 if (!error.empty()) { | 444 if (!error.empty()) { |
441 Respond(Error(error)); | 445 Respond(Error(error)); |
442 return; | 446 return; |
443 } | 447 } |
444 | 448 |
445 Respond(OneArgument(new base::FundamentalValue(result_acc_obj_id))); | 449 Respond(OneArgument(new base::FundamentalValue(result_acc_obj_id))); |
446 } | 450 } |
447 | 451 |
448 } // namespace extensions | 452 } // namespace extensions |
OLD | NEW |