Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(212)

Side by Side Diff: chrome/browser/automation/testing_automation_provider_gtk.cc

Issue 8773025: GTK: More removal of raw GtkWidget->allocation access. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/tab_contents/tab_contents_view_gtk.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
(...skipping 25 matching lines...) Expand all
36 gfx::Rect* bounds) { 36 gfx::Rect* bounds) {
37 *success = false; 37 *success = false;
38 38
39 GtkWindow* window = window_tracker_->GetResource(handle); 39 GtkWindow* window = window_tracker_->GetResource(handle);
40 if (window) { 40 if (window) {
41 GtkWidget* widget = ViewIDUtil::GetWidget(GTK_WIDGET(window), 41 GtkWidget* widget = ViewIDUtil::GetWidget(GTK_WIDGET(window),
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 *bounds = gfx::Rect(widget->allocation.width, widget->allocation.height); 46
47 GtkAllocation allocation;
48 gtk_widget_get_allocation(widget, &allocation);
49 *bounds = gfx::Rect(allocation.width, allocation.height);
47 gint x, y; 50 gint x, y;
48 if (screen_coordinates) { 51 if (screen_coordinates) {
49 gfx::Point point = gtk_util::GetWidgetScreenPosition(widget); 52 gfx::Point point = gtk_util::GetWidgetScreenPosition(widget);
50 x = point.x(); 53 x = point.x();
51 y = point.y(); 54 y = point.y();
52 } else { 55 } else {
53 gtk_widget_translate_coordinates(widget, GTK_WIDGET(window), 56 gtk_widget_translate_coordinates(widget, GTK_WIDGET(window),
54 0, 0, &x, &y); 57 0, 0, &x, &y);
55 } 58 }
56 bounds->set_origin(gfx::Point(x, y)); 59 bounds->set_origin(gfx::Point(x, y));
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 } 93 }
91 *result = true; 94 *result = true;
92 } 95 }
93 } 96 }
94 97
95 void TestingAutomationProvider::GetWindowTitle(int handle, string16* text) { 98 void TestingAutomationProvider::GetWindowTitle(int handle, string16* text) {
96 gfx::NativeWindow window = window_tracker_->GetResource(handle); 99 gfx::NativeWindow window = window_tracker_->GetResource(handle);
97 const gchar* title = gtk_window_get_title(window); 100 const gchar* title = gtk_window_get_title(window);
98 text->assign(UTF8ToUTF16(title)); 101 text->assign(UTF8ToUTF16(title));
99 } 102 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/tab_contents/tab_contents_view_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698