| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/gfx/point.h" | 9 #include "base/gfx/point.h" |
| 10 #include "base/gfx/rect.h" | 10 #include "base/gfx/rect.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 if (window) { | 32 if (window) { |
| 33 if (visible) { | 33 if (visible) { |
| 34 gtk_window_present(window); | 34 gtk_window_present(window); |
| 35 } else { | 35 } else { |
| 36 gtk_widget_hide(GTK_WIDGET(window)); | 36 gtk_widget_hide(GTK_WIDGET(window)); |
| 37 } | 37 } |
| 38 *result = true; | 38 *result = true; |
| 39 } | 39 } |
| 40 } | 40 } |
| 41 | 41 |
| 42 #if !defined(TOOLKIT_VIEWS) |
| 42 void AutomationProvider::WindowGetViewBounds(int handle, int view_id, | 43 void AutomationProvider::WindowGetViewBounds(int handle, int view_id, |
| 43 bool screen_coordinates, | 44 bool screen_coordinates, |
| 44 bool* success, | 45 bool* success, |
| 45 gfx::Rect* bounds) { | 46 gfx::Rect* bounds) { |
| 46 *success = false; | 47 *success = false; |
| 47 | 48 |
| 48 GtkWindow* window = window_tracker_->GetResource(handle); | 49 GtkWindow* window = window_tracker_->GetResource(handle); |
| 49 if (window) { | 50 if (window) { |
| 50 GtkWidget* widget = ViewIDUtil::GetWidget(GTK_WIDGET(window), | 51 GtkWidget* widget = ViewIDUtil::GetWidget(GTK_WIDGET(window), |
| 51 static_cast<ViewID>(view_id)); | 52 static_cast<ViewID>(view_id)); |
| 52 if (!widget) | 53 if (!widget) |
| 53 return; | 54 return; |
| 54 *success = true; | 55 *success = true; |
| 55 *bounds = gfx::Rect(0, 0, | 56 *bounds = gfx::Rect(0, 0, |
| 56 widget->allocation.width, widget->allocation.height); | 57 widget->allocation.width, widget->allocation.height); |
| 57 gint x, y; | 58 gint x, y; |
| 58 if (screen_coordinates) { | 59 if (screen_coordinates) { |
| 59 gfx::Point point = gtk_util::GetWidgetScreenPosition(widget); | 60 gfx::Point point = gtk_util::GetWidgetScreenPosition(widget); |
| 60 x = point.x(); | 61 x = point.x(); |
| 61 y = point.y(); | 62 y = point.y(); |
| 62 } else { | 63 } else { |
| 63 gtk_widget_translate_coordinates(widget, GTK_WIDGET(window), | 64 gtk_widget_translate_coordinates(widget, GTK_WIDGET(window), |
| 64 0, 0, &x, &y); | 65 0, 0, &x, &y); |
| 65 } | 66 } |
| 66 bounds->set_origin(gfx::Point(x, y)); | 67 bounds->set_origin(gfx::Point(x, y)); |
| 67 } | 68 } |
| 68 } | 69 } |
| 70 #endif |
| 69 | 71 |
| 70 void AutomationProvider::ActivateWindow(int handle) { | 72 void AutomationProvider::ActivateWindow(int handle) { |
| 71 NOTIMPLEMENTED(); | 73 NOTIMPLEMENTED(); |
| 72 } | 74 } |
| 73 | 75 |
| 74 void AutomationProvider::IsWindowMaximized(int handle, bool* is_maximized, | 76 void AutomationProvider::IsWindowMaximized(int handle, bool* is_maximized, |
| 75 bool* success) { | 77 bool* success) { |
| 76 *success = false; | 78 *success = false; |
| 77 NOTIMPLEMENTED(); | 79 NOTIMPLEMENTED(); |
| 78 } | 80 } |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 void AutomationProvider::TerminateSession(int handle, bool* success) { | 221 void AutomationProvider::TerminateSession(int handle, bool* success) { |
| 220 *success = false; | 222 *success = false; |
| 221 NOTIMPLEMENTED(); | 223 NOTIMPLEMENTED(); |
| 222 } | 224 } |
| 223 | 225 |
| 224 void AutomationProvider::GetWindowBounds(int handle, gfx::Rect* bounds, | 226 void AutomationProvider::GetWindowBounds(int handle, gfx::Rect* bounds, |
| 225 bool* result) { | 227 bool* result) { |
| 226 *result = false; | 228 *result = false; |
| 227 NOTIMPLEMENTED(); | 229 NOTIMPLEMENTED(); |
| 228 } | 230 } |
| OLD | NEW |