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/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/view_id_util.h" | 12 #include "chrome/browser/ui/gtk/view_id_util.h" |
13 #include "ui/base/gtk/gtk_screen_util.h" | 13 #include "ui/base/gtk/gtk_screen_util.h" |
14 | 14 |
15 void TestingAutomationProvider::ActivateWindow(int handle) { | |
16 NOTIMPLEMENTED(); | |
17 } | |
18 | |
19 void TestingAutomationProvider::IsWindowMaximized(int handle, | |
20 bool* is_maximized, | |
21 bool* success) { | |
22 *success = false; | |
23 NOTIMPLEMENTED(); | |
24 } | |
25 | |
26 void TestingAutomationProvider::TerminateSession(int handle, bool* success) { | 15 void TestingAutomationProvider::TerminateSession(int handle, bool* success) { |
27 *success = false; | 16 *success = false; |
28 NOTIMPLEMENTED(); | 17 NOTIMPLEMENTED(); |
29 } | 18 } |
30 | 19 |
31 void TestingAutomationProvider::WindowGetViewBounds(int handle, | 20 void TestingAutomationProvider::WindowGetViewBounds(int handle, |
32 int view_id, | 21 int view_id, |
33 bool screen_coordinates, | 22 bool screen_coordinates, |
34 bool* success, | 23 bool* success, |
35 gfx::Rect* bounds) { | 24 gfx::Rect* bounds) { |
(...skipping 16 matching lines...) Expand all Loading... |
52 x = point.x(); | 41 x = point.x(); |
53 y = point.y(); | 42 y = point.y(); |
54 } else { | 43 } else { |
55 gtk_widget_translate_coordinates(widget, GTK_WIDGET(window), | 44 gtk_widget_translate_coordinates(widget, GTK_WIDGET(window), |
56 0, 0, &x, &y); | 45 0, 0, &x, &y); |
57 } | 46 } |
58 bounds->set_origin(gfx::Point(x, y)); | 47 bounds->set_origin(gfx::Point(x, y)); |
59 } | 48 } |
60 } | 49 } |
61 | 50 |
62 void TestingAutomationProvider::GetWindowBounds(int handle, | |
63 gfx::Rect* bounds, | |
64 bool* result) { | |
65 *result = false; | |
66 NOTIMPLEMENTED(); | |
67 } | |
68 | |
69 void TestingAutomationProvider::SetWindowBounds(int handle, | 51 void TestingAutomationProvider::SetWindowBounds(int handle, |
70 const gfx::Rect& bounds, | 52 const gfx::Rect& bounds, |
71 bool* success) { | 53 bool* success) { |
72 *success = false; | 54 *success = false; |
73 GtkWindow* window = window_tracker_->GetResource(handle); | 55 GtkWindow* window = window_tracker_->GetResource(handle); |
74 if (window) { | 56 if (window) { |
75 gtk_window_move(window, bounds.x(), bounds.height()); | 57 gtk_window_move(window, bounds.x(), bounds.height()); |
76 gtk_window_resize(window, bounds.width(), bounds.height()); | 58 gtk_window_resize(window, bounds.width(), bounds.height()); |
77 *success = true; | 59 *success = true; |
78 } | 60 } |
79 } | 61 } |
80 | |
81 void TestingAutomationProvider::SetWindowVisible(int handle, | |
82 bool visible, | |
83 bool* result) { | |
84 *result = false; | |
85 GtkWindow* window = window_tracker_->GetResource(handle); | |
86 if (window) { | |
87 if (visible) { | |
88 gtk_window_present(window); | |
89 } else { | |
90 gtk_widget_hide(GTK_WIDGET(window)); | |
91 } | |
92 *result = true; | |
93 } | |
94 } | |
95 | |
96 void TestingAutomationProvider::GetWindowTitle(int handle, string16* text) { | |
97 gfx::NativeWindow window = window_tracker_->GetResource(handle); | |
98 const gchar* title = gtk_window_get_title(window); | |
99 text->assign(UTF8ToUTF16(title)); | |
100 } | |
OLD | NEW |