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

Side by Side Diff: chrome/browser/automation/automation_provider_win.cc

Issue 10538039: Renamed BrowserWindow::GetNativeHandle() to GetNativeWindow() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update copyrights Created 8 years, 6 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 (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/automation/automation_provider.h" 5 #include "chrome/browser/automation/automation_provider.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 } // namespace 84 } // namespace
85 85
86 void AutomationProvider::WindowSimulateDrag( 86 void AutomationProvider::WindowSimulateDrag(
87 int handle, 87 int handle,
88 const std::vector<gfx::Point>& drag_path, 88 const std::vector<gfx::Point>& drag_path,
89 int flags, 89 int flags,
90 bool press_escape_en_route, 90 bool press_escape_en_route,
91 IPC::Message* reply_message) { 91 IPC::Message* reply_message) {
92 if (browser_tracker_->ContainsHandle(handle) && (drag_path.size() > 1)) { 92 if (browser_tracker_->ContainsHandle(handle) && (drag_path.size() > 1)) {
93 gfx::NativeWindow window = 93 gfx::NativeWindow window =
94 browser_tracker_->GetResource(handle)->window()->GetNativeHandle(); 94 browser_tracker_->GetResource(handle)->window()->GetNativeWindow();
95 95
96 UINT down_message = 0; 96 UINT down_message = 0;
97 UINT up_message = 0; 97 UINT up_message = 0;
98 WPARAM wparam_flags = 0; 98 WPARAM wparam_flags = 0;
99 if (flags & ui::EF_SHIFT_DOWN) 99 if (flags & ui::EF_SHIFT_DOWN)
100 wparam_flags |= MK_SHIFT; 100 wparam_flags |= MK_SHIFT;
101 if (flags & ui::EF_CONTROL_DOWN) 101 if (flags & ui::EF_CONTROL_DOWN)
102 wparam_flags |= MK_CONTROL; 102 wparam_flags |= MK_CONTROL;
103 if (flags & ui::EF_LEFT_MOUSE_BUTTON) { 103 if (flags & ui::EF_LEFT_MOUSE_BUTTON) {
104 wparam_flags |= MK_LBUTTON; 104 wparam_flags |= MK_LBUTTON;
105 down_message = WM_LBUTTONDOWN; 105 down_message = WM_LBUTTONDOWN;
106 up_message = WM_LBUTTONUP; 106 up_message = WM_LBUTTONUP;
107 } 107 }
108 if (flags & ui::EF_MIDDLE_MOUSE_BUTTON) { 108 if (flags & ui::EF_MIDDLE_MOUSE_BUTTON) {
109 wparam_flags |= MK_MBUTTON; 109 wparam_flags |= MK_MBUTTON;
110 down_message = WM_MBUTTONDOWN; 110 down_message = WM_MBUTTONDOWN;
111 up_message = WM_MBUTTONUP; 111 up_message = WM_MBUTTONUP;
112 } 112 }
113 if (flags & ui::EF_RIGHT_MOUSE_BUTTON) { 113 if (flags & ui::EF_RIGHT_MOUSE_BUTTON) {
114 wparam_flags |= MK_RBUTTON; 114 wparam_flags |= MK_RBUTTON;
115 down_message = WM_LBUTTONDOWN; 115 down_message = WM_LBUTTONDOWN;
116 up_message = WM_LBUTTONUP; 116 up_message = WM_LBUTTONUP;
117 } 117 }
118 118
119 Browser* browser = browser_tracker_->GetResource(handle); 119 Browser* browser = browser_tracker_->GetResource(handle);
120 DCHECK(browser); 120 DCHECK(browser);
121 HWND top_level_hwnd = 121 HWND top_level_hwnd =
122 reinterpret_cast<HWND>(browser->window()->GetNativeHandle()); 122 reinterpret_cast<HWND>(browser->window()->GetNativeWindow());
123 POINT temp = drag_path[0].ToPOINT(); 123 POINT temp = drag_path[0].ToPOINT();
124 MapWindowPoints(top_level_hwnd, HWND_DESKTOP, &temp, 1); 124 MapWindowPoints(top_level_hwnd, HWND_DESKTOP, &temp, 1);
125 MoveMouse(temp); 125 MoveMouse(temp);
126 SendMessage(top_level_hwnd, down_message, wparam_flags, 126 SendMessage(top_level_hwnd, down_message, wparam_flags,
127 MAKELPARAM(drag_path[0].x(), drag_path[0].y())); 127 MAKELPARAM(drag_path[0].x(), drag_path[0].y()));
128 for (int i = 1; i < static_cast<int>(drag_path.size()); ++i) { 128 for (int i = 1; i < static_cast<int>(drag_path.size()); ++i) {
129 temp = drag_path[i].ToPOINT(); 129 temp = drag_path[i].ToPOINT();
130 MapWindowPoints(top_level_hwnd, HWND_DESKTOP, &temp, 1); 130 MapWindowPoints(top_level_hwnd, HWND_DESKTOP, &temp, 1);
131 MoveMouse(temp); 131 MoveMouse(temp);
132 SendMessage(top_level_hwnd, WM_MOUSEMOVE, wparam_flags, 132 SendMessage(top_level_hwnd, WM_MOUSEMOVE, wparam_flags,
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 void AutomationProvider::OnSetZoomLevel(int handle, int zoom_level) { 402 void AutomationProvider::OnSetZoomLevel(int handle, int zoom_level) {
403 if (tab_tracker_->ContainsHandle(handle)) { 403 if (tab_tracker_->ContainsHandle(handle)) {
404 NavigationController* tab = tab_tracker_->GetResource(handle); 404 NavigationController* tab = tab_tracker_->GetResource(handle);
405 if (tab->GetWebContents() && tab->GetWebContents()->GetRenderViewHost()) { 405 if (tab->GetWebContents() && tab->GetWebContents()->GetRenderViewHost()) {
406 RenderViewHost* host = tab->GetWebContents()->GetRenderViewHost(); 406 RenderViewHost* host = tab->GetWebContents()->GetRenderViewHost();
407 content::PageZoom zoom = static_cast<content::PageZoom>(zoom_level); 407 content::PageZoom zoom = static_cast<content::PageZoom>(zoom_level);
408 host->Zoom(zoom); 408 host->Zoom(zoom);
409 } 409 }
410 } 410 }
411 } 411 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/automation_provider_gtk.cc ('k') | chrome/browser/automation/testing_automation_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698