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

Side by Side Diff: chrome/browser/tab_contents/tab_contents_view_gtk.cc

Issue 8625001: GTK: Part 1 of removing GtkWidget->window to close up GSEALs. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Ignore chromeos Created 9 years, 1 month 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
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/tab_contents/tab_contents_view_gtk.h" 5 #include "chrome/browser/tab_contents/tab_contents_view_gtk.h"
6 6
7 #include <gdk/gdk.h> 7 #include <gdk/gdk.h>
8 #include <gdk/gdkkeysyms.h> 8 #include <gdk/gdkkeysyms.h>
9 #include <gtk/gtk.h> 9 #include <gtk/gtk.h>
10 10
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 return window ? GTK_WINDOW(window) : NULL; 155 return window ? GTK_WINDOW(window) : NULL;
156 } 156 }
157 157
158 void TabContentsViewGtk::GetContainerBounds(gfx::Rect* out) const { 158 void TabContentsViewGtk::GetContainerBounds(gfx::Rect* out) const {
159 // This is used for positioning the download shelf arrow animation, 159 // This is used for positioning the download shelf arrow animation,
160 // as well as sizing some other widgets in Windows. In GTK the size is 160 // as well as sizing some other widgets in Windows. In GTK the size is
161 // managed for us, so it appears to be only used for the download shelf 161 // managed for us, so it appears to be only used for the download shelf
162 // animation. 162 // animation.
163 int x = 0; 163 int x = 0;
164 int y = 0; 164 int y = 0;
165 if (expanded_->window) 165 GdkWindow* expanded_window = gtk_widget_get_window(expanded_.get());
166 gdk_window_get_origin(expanded_->window, &x, &y); 166 if (expanded_window)
167 gdk_window_get_origin(expanded_window, &x, &y);
167 out->SetRect(x + expanded_->allocation.x, y + expanded_->allocation.y, 168 out->SetRect(x + expanded_->allocation.x, y + expanded_->allocation.y,
168 requested_size_.width(), requested_size_.height()); 169 requested_size_.width(), requested_size_.height());
169 } 170 }
170 171
171 void TabContentsViewGtk::SetPageTitle(const string16& title) { 172 void TabContentsViewGtk::SetPageTitle(const string16& title) {
172 // Set the window name to include the page title so it's easier to spot 173 // Set the window name to include the page title so it's easier to spot
173 // when debugging (e.g. via xwininfo -tree). 174 // when debugging (e.g. via xwininfo -tree).
174 gfx::NativeView content_view = GetContentNativeView(); 175 gfx::NativeView content_view = GetContentNativeView();
175 if (content_view && content_view->window) 176 if (content_view) {
176 gdk_window_set_title(content_view->window, UTF16ToUTF8(title).c_str()); 177 GdkWindow* content_window = gtk_widget_get_window(content_view);
178 if (content_window) {
179 gdk_window_set_title(content_window, UTF16ToUTF8(title).c_str());
180 }
181 }
177 } 182 }
178 183
179 void TabContentsViewGtk::OnTabCrashed(base::TerminationStatus status, 184 void TabContentsViewGtk::OnTabCrashed(base::TerminationStatus status,
180 int error_code) { 185 int error_code) {
181 } 186 }
182 187
183 void TabContentsViewGtk::SizeContents(const gfx::Size& size) { 188 void TabContentsViewGtk::SizeContents(const gfx::Size& size) {
184 // We don't need to manually set the size of of widgets in GTK+, but we do 189 // We don't need to manually set the size of of widgets in GTK+, but we do
185 // need to pass the sizing information on to the RWHV which will pass the 190 // need to pass the sizing information on to the RWHV which will pass the
186 // sizing information on to the renderer. 191 // sizing information on to the renderer.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 } 232 }
228 233
229 bool TabContentsViewGtk::IsEventTracking() const { 234 bool TabContentsViewGtk::IsEventTracking() const {
230 return false; 235 return false;
231 } 236 }
232 237
233 void TabContentsViewGtk::CloseTabAfterEventTracking() { 238 void TabContentsViewGtk::CloseTabAfterEventTracking() {
234 } 239 }
235 240
236 void TabContentsViewGtk::GetViewBounds(gfx::Rect* out) const { 241 void TabContentsViewGtk::GetViewBounds(gfx::Rect* out) const {
237 if (!GetNativeView()->window) { 242 GdkWindow* window = gtk_widget_get_window(GetNativeView());
243 if (!window) {
238 out->SetRect(0, 0, requested_size_.width(), requested_size_.height()); 244 out->SetRect(0, 0, requested_size_.width(), requested_size_.height());
239 return; 245 return;
240 } 246 }
241 int x = 0, y = 0, w, h; 247 int x = 0, y = 0, w, h;
242 gdk_window_get_geometry(GetNativeView()->window, &x, &y, &w, &h, NULL); 248 gdk_window_get_geometry(window, &x, &y, &w, &h, NULL);
243 out->SetRect(x, y, w, h); 249 out->SetRect(x, y, w, h);
244 } 250 }
245 251
246 void TabContentsViewGtk::InstallOverlayView(gfx::NativeView view) { 252 void TabContentsViewGtk::InstallOverlayView(gfx::NativeView view) {
247 DCHECK(!overlaid_view_); 253 DCHECK(!overlaid_view_);
248 overlaid_view_ = view; 254 overlaid_view_ = view;
249 InsertIntoContentArea(view); 255 InsertIntoContentArea(view);
250 gtk_widget_show(view); 256 gtk_widget_show(view);
251 } 257 }
252 258
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 requested_size_ = size; 414 requested_size_ = size;
409 415
410 // We manually tell our RWHV to resize the renderer content. This avoids 416 // We manually tell our RWHV to resize the renderer content. This avoids
411 // spurious resizes from GTK+. 417 // spurious resizes from GTK+.
412 RenderWidgetHostView* rwhv = tab_contents_->GetRenderWidgetHostView(); 418 RenderWidgetHostView* rwhv = tab_contents_->GetRenderWidgetHostView();
413 if (rwhv) 419 if (rwhv)
414 rwhv->SetSize(size); 420 rwhv->SetSize(size);
415 if (tab_contents_->interstitial_page()) 421 if (tab_contents_->interstitial_page())
416 tab_contents_->interstitial_page()->SetSize(size); 422 tab_contents_->interstitial_page()->SetSize(size);
417 } 423 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/ui_controls_gtk.cc ('k') | chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698