OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/automation/automation_provider.h" | 5 #include "chrome/browser/automation/automation_provider.h" |
6 | 6 |
7 #include "app/keyboard_codes.h" | |
8 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
9 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
10 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
11 #include "chrome/browser/automation/automation_browser_tracker.h" | 10 #include "chrome/browser/automation/automation_browser_tracker.h" |
12 #include "chrome/browser/automation/automation_extension_function.h" | 11 #include "chrome/browser/automation/automation_extension_function.h" |
13 #include "chrome/browser/automation/automation_tab_tracker.h" | 12 #include "chrome/browser/automation/automation_tab_tracker.h" |
14 #include "chrome/browser/automation/automation_window_tracker.h" | 13 #include "chrome/browser/automation/automation_window_tracker.h" |
15 #include "chrome/browser/automation/extension_automation_constants.h" | 14 #include "chrome/browser/automation/extension_automation_constants.h" |
16 #include "chrome/browser/automation/extension_port_container.h" | 15 #include "chrome/browser/automation/extension_port_container.h" |
17 #include "chrome/browser/automation/ui_controls.h" | 16 #include "chrome/browser/automation/ui_controls.h" |
18 #include "chrome/browser/browser_window.h" | 17 #include "chrome/browser/browser_window.h" |
19 #include "chrome/browser/extensions/extension_event_router.h" | 18 #include "chrome/browser/extensions/extension_event_router.h" |
20 #include "chrome/browser/external_tab_container_win.h" | 19 #include "chrome/browser/external_tab_container_win.h" |
21 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
22 #include "chrome/browser/renderer_host/render_view_host.h" | 21 #include "chrome/browser/renderer_host/render_view_host.h" |
23 #include "chrome/browser/tab_contents/tab_contents.h" | 22 #include "chrome/browser/tab_contents/tab_contents.h" |
24 #include "chrome/browser/ui/views/bookmark_bar_view.h" | 23 #include "chrome/browser/ui/views/bookmark_bar_view.h" |
25 #include "chrome/common/automation_messages.h" | 24 #include "chrome/common/automation_messages.h" |
26 #include "chrome/common/page_zoom.h" | 25 #include "chrome/common/page_zoom.h" |
| 26 #include "ui/base/keycodes/keyboard_codes.h" |
27 #include "views/focus/accelerator_handler.h" | 27 #include "views/focus/accelerator_handler.h" |
28 #include "views/widget/root_view.h" | 28 #include "views/widget/root_view.h" |
29 #include "views/widget/widget_win.h" | 29 #include "views/widget/widget_win.h" |
30 #include "views/window/window.h" | 30 #include "views/window/window.h" |
31 | 31 |
32 // This task just adds another task to the event queue. This is useful if | 32 // This task just adds another task to the event queue. This is useful if |
33 // you want to ensure that any tasks added to the event queue after this one | 33 // you want to ensure that any tasks added to the event queue after this one |
34 // have already been processed by the time |task| is run. | 34 // have already been processed by the time |task| is run. |
35 class InvokeTaskLaterTask : public Task { | 35 class InvokeTaskLaterTask : public Task { |
36 public: | 36 public: |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 MAKELPARAM(drag_path[i].x(), drag_path[i].y())); | 196 MAKELPARAM(drag_path[i].x(), drag_path[i].y())); |
197 } | 197 } |
198 POINT end = drag_path[drag_path.size() - 1].ToPOINT(); | 198 POINT end = drag_path[drag_path.size() - 1].ToPOINT(); |
199 MapWindowPoints(top_level_hwnd, HWND_DESKTOP, &end, 1); | 199 MapWindowPoints(top_level_hwnd, HWND_DESKTOP, &end, 1); |
200 MoveMouse(end); | 200 MoveMouse(end); |
201 | 201 |
202 if (press_escape_en_route) { | 202 if (press_escape_en_route) { |
203 // Press Escape, making sure we wait until chrome processes the escape. | 203 // Press Escape, making sure we wait until chrome processes the escape. |
204 // TODO(phajdan.jr): make this use ui_test_utils::SendKeyPressSync. | 204 // TODO(phajdan.jr): make this use ui_test_utils::SendKeyPressSync. |
205 ui_controls::SendKeyPressNotifyWhenDone( | 205 ui_controls::SendKeyPressNotifyWhenDone( |
206 window, app::VKEY_ESCAPE, | 206 window, ui::VKEY_ESCAPE, |
207 ((flags & views::Event::EF_CONTROL_DOWN) == | 207 ((flags & views::Event::EF_CONTROL_DOWN) == |
208 views::Event::EF_CONTROL_DOWN), | 208 views::Event::EF_CONTROL_DOWN), |
209 ((flags & views::Event::EF_SHIFT_DOWN) == | 209 ((flags & views::Event::EF_SHIFT_DOWN) == |
210 views::Event::EF_SHIFT_DOWN), | 210 views::Event::EF_SHIFT_DOWN), |
211 ((flags & views::Event::EF_ALT_DOWN) == views::Event::EF_ALT_DOWN), | 211 ((flags & views::Event::EF_ALT_DOWN) == views::Event::EF_ALT_DOWN), |
212 false, | 212 false, |
213 new MessageLoop::QuitTask()); | 213 new MessageLoop::QuitTask()); |
214 MessageLoopForUI* loop = MessageLoopForUI::current(); | 214 MessageLoopForUI* loop = MessageLoopForUI::current(); |
215 bool did_allow_task_nesting = loop->NestableTasksAllowed(); | 215 bool did_allow_task_nesting = loop->NestableTasksAllowed(); |
216 loop->SetNestableTasksAllowed(true); | 216 loop->SetNestableTasksAllowed(true); |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 | 533 |
534 void AutomationProvider::OnSetZoomLevel(int handle, int zoom_level) { | 534 void AutomationProvider::OnSetZoomLevel(int handle, int zoom_level) { |
535 if (tab_tracker_->ContainsHandle(handle)) { | 535 if (tab_tracker_->ContainsHandle(handle)) { |
536 NavigationController* tab = tab_tracker_->GetResource(handle); | 536 NavigationController* tab = tab_tracker_->GetResource(handle); |
537 if (tab->tab_contents() && tab->tab_contents()->render_view_host()) { | 537 if (tab->tab_contents() && tab->tab_contents()->render_view_host()) { |
538 tab->tab_contents()->render_view_host()->Zoom( | 538 tab->tab_contents()->render_view_host()->Zoom( |
539 static_cast<PageZoom::Function>(zoom_level)); | 539 static_cast<PageZoom::Function>(zoom_level)); |
540 } | 540 } |
541 } | 541 } |
542 } | 542 } |
OLD | NEW |