| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "chrome/app/chrome_dll_resource.h" | 8 #include "chrome/app/chrome_dll_resource.h" |
| 9 #include "chrome/browser/automation/automation_provider_list.h" | 9 #include "chrome/browser/automation/automation_provider_list.h" |
| 10 #include "chrome/browser/automation/ui_controls.h" | 10 #include "chrome/browser/automation/ui_controls.h" |
| (...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1141 | 1141 |
| 1142 void* iter = NULL; | 1142 void* iter = NULL; |
| 1143 if (window_tracker_->ContainsHandle(handle)) { | 1143 if (window_tracker_->ContainsHandle(handle)) { |
| 1144 HWND hwnd = window_tracker_->GetResource(handle); | 1144 HWND hwnd = window_tracker_->GetResource(handle); |
| 1145 ChromeViews::RootView* root_view = | 1145 ChromeViews::RootView* root_view = |
| 1146 ChromeViews::HWNDViewContainer::FindRootView(hwnd); | 1146 ChromeViews::HWNDViewContainer::FindRootView(hwnd); |
| 1147 if (root_view) { | 1147 if (root_view) { |
| 1148 ChromeViews::View* view = root_view->GetViewByID(view_id); | 1148 ChromeViews::View* view = root_view->GetViewByID(view_id); |
| 1149 if (view) { | 1149 if (view) { |
| 1150 succeeded = true; | 1150 succeeded = true; |
| 1151 CPoint point(0, 0); | 1151 gfx::Point point; |
| 1152 if (screen_coordinates) | 1152 if (screen_coordinates) |
| 1153 ChromeViews::View::ConvertPointToScreen(view, &point); | 1153 ChromeViews::View::ConvertPointToScreen(view, &point); |
| 1154 else | 1154 else |
| 1155 ChromeViews::View::ConvertPointToView(view, root_view, &point); | 1155 ChromeViews::View::ConvertPointToView(view, root_view, &point); |
| 1156 view->GetLocalBounds(&bounds, false); | 1156 view->GetLocalBounds(&bounds, false); |
| 1157 bounds.MoveToXY(point.x, point.y); | 1157 bounds.MoveToXY(point.x(), point.y()); |
| 1158 } | 1158 } |
| 1159 } | 1159 } |
| 1160 } | 1160 } |
| 1161 | 1161 |
| 1162 Send(new AutomationMsg_WindowViewBoundsResponse( | 1162 Send(new AutomationMsg_WindowViewBoundsResponse( |
| 1163 message.routing_id(), succeeded, gfx::Rect(bounds))); | 1163 message.routing_id(), succeeded, gfx::Rect(bounds))); |
| 1164 } | 1164 } |
| 1165 | 1165 |
| 1166 // This task enqueues a mouse event on the event loop, so that the view | 1166 // This task enqueues a mouse event on the event loop, so that the view |
| 1167 // that it's being sent to can do the requisite post-processing. | 1167 // that it's being sent to can do the requisite post-processing. |
| 1168 class MouseEventTask : public Task { | 1168 class MouseEventTask : public Task { |
| 1169 public: | 1169 public: |
| 1170 MouseEventTask(ChromeViews::View* view, | 1170 MouseEventTask(ChromeViews::View* view, |
| 1171 ChromeViews::Event::EventType type, | 1171 ChromeViews::Event::EventType type, |
| 1172 POINT point, | 1172 POINT point, |
| 1173 int flags) | 1173 int flags) |
| 1174 : view_(view), type_(type), point_(point), flags_(flags) {} | 1174 : view_(view), type_(type), point_(point), flags_(flags) {} |
| 1175 virtual ~MouseEventTask() {} | 1175 virtual ~MouseEventTask() {} |
| 1176 | 1176 |
| 1177 virtual void Run() { | 1177 virtual void Run() { |
| 1178 ChromeViews::MouseEvent event(type_, point_.x, point_.y, flags_); | 1178 ChromeViews::MouseEvent event(type_, point_.x, point_.y, flags_); |
| 1179 // We need to set the cursor position before we process the event because | 1179 // We need to set the cursor position before we process the event because |
| 1180 // some code (tab dragging, for instance) queries the actual cursor location | 1180 // some code (tab dragging, for instance) queries the actual cursor location |
| 1181 // rather than the location of the mouse event. Note that the reason why | 1181 // rather than the location of the mouse event. Note that the reason why |
| 1182 // the drag code moved away from using mouse event locations was because | 1182 // the drag code moved away from using mouse event locations was because |
| 1183 // our conversion to screen location doesn't work well with multiple | 1183 // our conversion to screen location doesn't work well with multiple |
| 1184 // monitors, so this only works reliably in a single monitor setup. | 1184 // monitors, so this only works reliably in a single monitor setup. |
| 1185 CPoint screen_location = CPoint(point_.x, point_.y); | 1185 gfx::Point screen_location(point_.x, point_.y); |
| 1186 view_->ConvertPointToScreen(view_, &screen_location); | 1186 view_->ConvertPointToScreen(view_, &screen_location); |
| 1187 ::SetCursorPos(screen_location.x, screen_location.y); | 1187 ::SetCursorPos(screen_location.x(), screen_location.y()); |
| 1188 switch (type_) { | 1188 switch (type_) { |
| 1189 case ChromeViews::Event::ET_MOUSE_PRESSED: | 1189 case ChromeViews::Event::ET_MOUSE_PRESSED: |
| 1190 view_->OnMousePressed(event); | 1190 view_->OnMousePressed(event); |
| 1191 break; | 1191 break; |
| 1192 | 1192 |
| 1193 case ChromeViews::Event::ET_MOUSE_DRAGGED: | 1193 case ChromeViews::Event::ET_MOUSE_DRAGGED: |
| 1194 view_->OnMouseDragged(event); | 1194 view_->OnMouseDragged(event); |
| 1195 break; | 1195 break; |
| 1196 | 1196 |
| 1197 case ChromeViews::Event::ET_MOUSE_RELEASED: | 1197 case ChromeViews::Event::ET_MOUSE_RELEASED: |
| (...skipping 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2419 int value) { | 2419 int value) { |
| 2420 bool success = false; | 2420 bool success = false; |
| 2421 if (browser_tracker_->ContainsHandle(handle)) { | 2421 if (browser_tracker_->ContainsHandle(handle)) { |
| 2422 Browser* browser = browser_tracker_->GetResource(handle); | 2422 Browser* browser = browser_tracker_->GetResource(handle); |
| 2423 browser->profile()->GetPrefs()->SetInteger(name.c_str(), value); | 2423 browser->profile()->GetPrefs()->SetInteger(name.c_str(), value); |
| 2424 success = true; | 2424 success = true; |
| 2425 } | 2425 } |
| 2426 Send(new AutomationMsg_SetIntPreferenceResponse(message.routing_id(), | 2426 Send(new AutomationMsg_SetIntPreferenceResponse(message.routing_id(), |
| 2427 success)); | 2427 success)); |
| 2428 } | 2428 } |
| OLD | NEW |