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

Side by Side Diff: chrome/browser/gtk/browser_window_gtk.cc

Issue 140078: Move the titlebar background drawing from the titlebar to the (Closed)
Patch Set: rebase Created 11 years, 6 months 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 | « chrome/browser/gtk/browser_titlebar.cc ('k') | no next file » | 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) 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/gtk/browser_window_gtk.h" 5 #include "chrome/browser/gtk/browser_window_gtk.h"
6 6
7 #include <gdk/gdkkeysyms.h> 7 #include <gdk/gdkkeysyms.h>
8 8
9 #include "app/resource_bundle.h" 9 #include "app/resource_bundle.h"
10 #include "app/theme_provider.h" 10 #include "app/theme_provider.h"
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 gtk_accel_groups_activate(G_OBJECT(window_), keyval, modifier); 353 gtk_accel_groups_activate(G_OBJECT(window_), keyval, modifier);
354 } 354 }
355 } 355 }
356 356
357 gboolean BrowserWindowGtk::OnCustomFrameExpose(GtkWidget* widget, 357 gboolean BrowserWindowGtk::OnCustomFrameExpose(GtkWidget* widget,
358 GdkEventExpose* event, 358 GdkEventExpose* event,
359 BrowserWindowGtk* window) { 359 BrowserWindowGtk* window) {
360 // TODO(tc): This will have to be dynamic once themes are supported. Maybe 360 // TODO(tc): This will have to be dynamic once themes are supported. Maybe
361 // detect the theme install and delete the pointer? 361 // detect the theme install and delete the pointer?
362 static NineBox* custom_frame_border = NULL; 362 static NineBox* custom_frame_border = NULL;
363 static NineBox* default_background = NULL;
364 static NineBox* default_background_otr = NULL;
363 365
364 if (window->use_custom_frame_.GetValue()) { 366 if (window->use_custom_frame_.GetValue()) {
365 ThemeProvider* theme_provider = 367 ThemeProvider* theme_provider =
366 window->browser()->profile()->GetThemeProvider(); 368 window->browser()->profile()->GetThemeProvider();
367 if (!custom_frame_border) { 369 if (!custom_frame_border) {
368 custom_frame_border = new NineBox( 370 custom_frame_border = new NineBox(
369 theme_provider, 371 theme_provider,
370 IDR_WINDOW_TOP_LEFT_CORNER, 372 IDR_WINDOW_TOP_LEFT_CORNER,
371 IDR_WINDOW_TOP_CENTER, 373 IDR_WINDOW_TOP_CENTER,
372 IDR_WINDOW_TOP_RIGHT_CORNER, 374 IDR_WINDOW_TOP_RIGHT_CORNER,
373 IDR_WINDOW_LEFT_SIDE, 375 IDR_WINDOW_LEFT_SIDE,
374 NULL, 376 NULL,
375 IDR_WINDOW_RIGHT_SIDE, 377 IDR_WINDOW_RIGHT_SIDE,
376 IDR_WINDOW_BOTTOM_LEFT_CORNER, 378 IDR_WINDOW_BOTTOM_LEFT_CORNER,
377 IDR_WINDOW_BOTTOM_CENTER, 379 IDR_WINDOW_BOTTOM_CENTER,
378 IDR_WINDOW_BOTTOM_RIGHT_CORNER); 380 IDR_WINDOW_BOTTOM_RIGHT_CORNER);
381 default_background = new NineBox(theme_provider,
382 0, IDR_THEME_FRAME, 0, 0, 0, 0, 0, 0, 0);
383 default_background_otr = new NineBox(theme_provider,
384 0, IDR_THEME_FRAME_INCOGNITO, 0, 0, 0, 0, 0, 0, 0);
379 } 385 }
380 386
387 // Draw the default background.
381 // TODO(tc): Handle maximized windows. 388 // TODO(tc): Handle maximized windows.
389 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(widget->window));
390 cairo_rectangle(cr, event->area.x, event->area.y, event->area.width,
391 event->area.height);
392 cairo_clip(cr);
393 NineBox* image = window->browser()->profile()->IsOffTheRecord()
394 ? default_background_otr : default_background;
395 image->RenderTopCenterStrip(cr, event->area.x, 0, event->area.width);
396 cairo_destroy(cr);
382 397
383 // TODO(tc): Draw the theme overlay. The windows code is below. 398 // TODO(tc): Draw the theme overlay. The windows code is below.
384 // if (theme_provider->HasCustomImage(IDR_THEME_FRAME_OVERLAY)) { 399 // if (theme_provider->HasCustomImage(IDR_THEME_FRAME_OVERLAY)) {
385 // SkBitmap* theme_overlay = theme_provider->GetBitmapNamed( 400 // SkBitmap* theme_overlay = theme_provider->GetBitmapNamed(
386 // IDR_THEME_FRAME_OVERLAY); 401 // IDR_THEME_FRAME_OVERLAY);
387 // canvas->DrawBitmapInt(*theme_overlay, 0, 0); 402 // canvas->DrawBitmapInt(*theme_overlay, 0, 0);
388 // } 403 // }
389 404
390 custom_frame_border->RenderToWidget(widget); 405 custom_frame_border->RenderToWidget(widget);
391 } 406 }
(...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after
1251 *edge = GDK_WINDOW_EDGE_NORTH_EAST; 1266 *edge = GDK_WINDOW_EDGE_NORTH_EAST;
1252 } else if (y < bounds_.height() - kResizeAreaCornerSize) { 1267 } else if (y < bounds_.height() - kResizeAreaCornerSize) {
1253 *edge = GDK_WINDOW_EDGE_EAST; 1268 *edge = GDK_WINDOW_EDGE_EAST;
1254 } else { 1269 } else {
1255 *edge = GDK_WINDOW_EDGE_SOUTH_EAST; 1270 *edge = GDK_WINDOW_EDGE_SOUTH_EAST;
1256 } 1271 }
1257 return true; 1272 return true;
1258 } 1273 }
1259 NOTREACHED(); 1274 NOTREACHED();
1260 } 1275 }
OLDNEW
« no previous file with comments | « chrome/browser/gtk/browser_titlebar.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698