| 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/testing_automation_provider.h" | 5 #include "chrome/browser/automation/testing_automation_provider.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "chrome/browser/automation/automation_window_tracker.h" | 11 #include "chrome/browser/automation/automation_window_tracker.h" |
| 12 #include "chrome/browser/ui/gtk/gtk_util.h" | |
| 13 #include "chrome/browser/ui/gtk/view_id_util.h" | 12 #include "chrome/browser/ui/gtk/view_id_util.h" |
| 13 #include "ui/base/gtk/gtk_screen_util.h" |
| 14 | 14 |
| 15 void TestingAutomationProvider::ActivateWindow(int handle) { | 15 void TestingAutomationProvider::ActivateWindow(int handle) { |
| 16 NOTIMPLEMENTED(); | 16 NOTIMPLEMENTED(); |
| 17 } | 17 } |
| 18 | 18 |
| 19 void TestingAutomationProvider::IsWindowMaximized(int handle, | 19 void TestingAutomationProvider::IsWindowMaximized(int handle, |
| 20 bool* is_maximized, | 20 bool* is_maximized, |
| 21 bool* success) { | 21 bool* success) { |
| 22 *success = false; | 22 *success = false; |
| 23 NOTIMPLEMENTED(); | 23 NOTIMPLEMENTED(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 42 static_cast<ViewID>(view_id)); | 42 static_cast<ViewID>(view_id)); |
| 43 if (!widget) | 43 if (!widget) |
| 44 return; | 44 return; |
| 45 *success = true; | 45 *success = true; |
| 46 | 46 |
| 47 GtkAllocation allocation; | 47 GtkAllocation allocation; |
| 48 gtk_widget_get_allocation(widget, &allocation); | 48 gtk_widget_get_allocation(widget, &allocation); |
| 49 *bounds = gfx::Rect(allocation.width, allocation.height); | 49 *bounds = gfx::Rect(allocation.width, allocation.height); |
| 50 gint x, y; | 50 gint x, y; |
| 51 if (screen_coordinates) { | 51 if (screen_coordinates) { |
| 52 gfx::Point point = gtk_util::GetWidgetScreenPosition(widget); | 52 gfx::Point point = ui::GetWidgetScreenPosition(widget); |
| 53 x = point.x(); | 53 x = point.x(); |
| 54 y = point.y(); | 54 y = point.y(); |
| 55 } else { | 55 } else { |
| 56 gtk_widget_translate_coordinates(widget, GTK_WIDGET(window), | 56 gtk_widget_translate_coordinates(widget, GTK_WIDGET(window), |
| 57 0, 0, &x, &y); | 57 0, 0, &x, &y); |
| 58 } | 58 } |
| 59 bounds->set_origin(gfx::Point(x, y)); | 59 bounds->set_origin(gfx::Point(x, y)); |
| 60 } | 60 } |
| 61 } | 61 } |
| 62 #endif | 62 #endif |
| (...skipping 30 matching lines...) Expand all Loading... |
| 93 } | 93 } |
| 94 *result = true; | 94 *result = true; |
| 95 } | 95 } |
| 96 } | 96 } |
| 97 | 97 |
| 98 void TestingAutomationProvider::GetWindowTitle(int handle, string16* text) { | 98 void TestingAutomationProvider::GetWindowTitle(int handle, string16* text) { |
| 99 gfx::NativeWindow window = window_tracker_->GetResource(handle); | 99 gfx::NativeWindow window = window_tracker_->GetResource(handle); |
| 100 const gchar* title = gtk_window_get_title(window); | 100 const gchar* title = gtk_window_get_title(window); |
| 101 text->assign(UTF8ToUTF16(title)); | 101 text->assign(UTF8ToUTF16(title)); |
| 102 } | 102 } |
| OLD | NEW |