| OLD | NEW |
| 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 <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 } | 38 } |
| 39 | 39 |
| 40 void AutomationProvider::WindowSimulateDrag( | 40 void AutomationProvider::WindowSimulateDrag( |
| 41 int handle, | 41 int handle, |
| 42 const std::vector<gfx::Point>& drag_path, | 42 const std::vector<gfx::Point>& drag_path, |
| 43 int flags, | 43 int flags, |
| 44 bool press_escape_en_route, | 44 bool press_escape_en_route, |
| 45 IPC::Message* reply_message) { | 45 IPC::Message* reply_message) { |
| 46 // TODO(estade): don't ignore |flags| or |escape_en_route|. | 46 // TODO(estade): don't ignore |flags| or |escape_en_route|. |
| 47 gfx::NativeWindow window = | 47 gfx::NativeWindow window = |
| 48 browser_tracker_->GetResource(handle)->window()->GetNativeHandle(); | 48 browser_tracker_->GetResource(handle)->window()->GetNativeWindow(); |
| 49 if (window && (drag_path.size() > 1)) { | 49 if (window && (drag_path.size() > 1)) { |
| 50 int x, y; | 50 int x, y; |
| 51 gdk_window_get_position(gtk_widget_get_window(GTK_WIDGET(window)), &x, &y); | 51 gdk_window_get_position(gtk_widget_get_window(GTK_WIDGET(window)), &x, &y); |
| 52 | 52 |
| 53 // Create a nested stack of tasks to run. | 53 // Create a nested stack of tasks to run. |
| 54 base::Closure drag_response_cb = base::Bind( | 54 base::Closure drag_response_cb = base::Bind( |
| 55 &SendWindowDragResponse, make_scoped_refptr(this), reply_message); | 55 &SendWindowDragResponse, make_scoped_refptr(this), reply_message); |
| 56 base::Closure move_chain_cb = base::Bind( | 56 base::Closure move_chain_cb = base::Bind( |
| 57 base::IgnoreResult(&ui_controls::SendMouseEventsNotifyWhenDone), | 57 base::IgnoreResult(&ui_controls::SendMouseEventsNotifyWhenDone), |
| 58 ui_controls::LEFT, ui_controls::UP, drag_response_cb); | 58 ui_controls::LEFT, ui_controls::UP, drag_response_cb); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 79 ui_controls::LEFT, ui_controls::DOWN, move_chain_cb); | 79 ui_controls::LEFT, ui_controls::DOWN, move_chain_cb); |
| 80 | 80 |
| 81 ui_controls::SendMouseMoveNotifyWhenDone(x + drag_path[0].x(), | 81 ui_controls::SendMouseMoveNotifyWhenDone(x + drag_path[0].x(), |
| 82 y + drag_path[0].y(), | 82 y + drag_path[0].y(), |
| 83 move_chain_cb); | 83 move_chain_cb); |
| 84 } else { | 84 } else { |
| 85 AutomationMsg_WindowDrag::WriteReplyParams(reply_message, false); | 85 AutomationMsg_WindowDrag::WriteReplyParams(reply_message, false); |
| 86 Send(reply_message); | 86 Send(reply_message); |
| 87 } | 87 } |
| 88 } | 88 } |
| OLD | NEW |