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

Side by Side Diff: chrome/browser/ui/gtk/custom_button.cc

Issue 12742013: Inconsistent use of [x] close panel icon. Code changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue_217094_3
Patch Set: Created 7 years, 9 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
OLDNEW
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/ui/gtk/custom_button.h" 5 #include "chrome/browser/ui/gtk/custom_button.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "chrome/browser/ui/gtk/gtk_chrome_button.h" 10 #include "chrome/browser/ui/gtk/gtk_chrome_button.h"
11 #include "chrome/browser/ui/gtk/gtk_theme_service.h" 11 #include "chrome/browser/ui/gtk/gtk_theme_service.h"
12 #include "chrome/browser/ui/gtk/gtk_util.h" 12 #include "chrome/browser/ui/gtk/gtk_util.h"
13 #include "chrome/common/chrome_notification_types.h" 13 #include "chrome/common/chrome_notification_types.h"
14 #include "content/public/browser/notification_source.h" 14 #include "content/public/browser/notification_source.h"
15 #include "grit/theme_resources.h"
15 #include "grit/ui_resources.h" 16 #include "grit/ui_resources.h"
16 #include "third_party/skia/include/core/SkBitmap.h" 17 #include "third_party/skia/include/core/SkBitmap.h"
17 #include "ui/base/resource/resource_bundle.h" 18 #include "ui/base/resource/resource_bundle.h"
18 #include "ui/gfx/gtk_util.h" 19 #include "ui/gfx/gtk_util.h"
19 #include "ui/gfx/image/cairo_cached_surface.h" 20 #include "ui/gfx/image/cairo_cached_surface.h"
20 #include "ui/gfx/image/image.h" 21 #include "ui/gfx/image/image.h"
21 #include "ui/gfx/skbitmap_operations.h" 22 #include "ui/gfx/skbitmap_operations.h"
22 23
23 namespace { 24 namespace {
24 25
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 if (UseGtkTheme()) { 349 if (UseGtkTheme()) {
349 // Continue processing this expose event. 350 // Continue processing this expose event.
350 return FALSE; 351 return FALSE;
351 } else { 352 } else {
352 double hover_state = hover_controller_.GetCurrentValue(); 353 double hover_state = hover_controller_.GetCurrentValue();
353 return button_base_.OnExpose(sender, e, hover_state); 354 return button_base_.OnExpose(sender, e, hover_state);
354 } 355 }
355 } 356 }
356 357
357 // static 358 // static
358 CustomDrawButton* CustomDrawButton::CloseButton( 359 CustomDrawButton* CustomDrawButton::CloseButtonBar(
359 GtkThemeService* theme_provider) { 360 GtkThemeService* theme_provider) {
360 CustomDrawButton* button = new CustomDrawButton(theme_provider, IDR_CLOSE_BAR, 361 CustomDrawButton* button = new CustomDrawButton(theme_provider,
361 IDR_CLOSE_BAR_P, IDR_CLOSE_BAR_H, 0, GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU); 362 IDR_CLOSE_1, IDR_CLOSE_1_P, IDR_CLOSE_1_H, 0,
363 GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU);
362 return button; 364 return button;
363 } 365 }
364 366
367 // static
368 CustomDrawButton* CustomDrawButton::CloseButtonBubble(
369 GtkThemeService* theme_provider) {
370 CustomDrawButton* button = new CustomDrawButton(theme_provider,
371 IDR_CLOSE_2, IDR_CLOSE_2_P, IDR_CLOSE_2_H, 0,
372 GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU);
373 return button;
374 }
375
365 void CustomDrawButton::SetBrowserTheme() { 376 void CustomDrawButton::SetBrowserTheme() {
366 if (UseGtkTheme()) { 377 if (UseGtkTheme()) {
367 if (native_widget_.get()) 378 if (native_widget_.get())
368 gtk_button_set_image(GTK_BUTTON(widget()), native_widget_.get()); 379 gtk_button_set_image(GTK_BUTTON(widget()), native_widget_.get());
369 gtk_widget_set_size_request(widget(), -1, -1); 380 gtk_widget_set_size_request(widget(), -1, -1);
370 gtk_widget_set_app_paintable(widget(), FALSE); 381 gtk_widget_set_app_paintable(widget(), FALSE);
371 } else { 382 } else {
372 if (native_widget_.get()) 383 if (native_widget_.get())
373 gtk_button_set_image(GTK_BUTTON(widget()), NULL); 384 gtk_button_set_image(GTK_BUTTON(widget()), NULL);
374 gtk_widget_set_size_request(widget(), button_base_.Width(), 385 gtk_widget_set_size_request(widget(), button_base_.Width(),
375 button_base_.Height()); 386 button_base_.Height());
376 387
377 gtk_widget_set_app_paintable(widget(), TRUE); 388 gtk_widget_set_app_paintable(widget(), TRUE);
378 } 389 }
379 390
380 gtk_chrome_button_set_use_gtk_rendering( 391 gtk_chrome_button_set_use_gtk_rendering(
381 GTK_CHROME_BUTTON(widget()), UseGtkTheme()); 392 GTK_CHROME_BUTTON(widget()), UseGtkTheme());
382 } 393 }
383 394
384 bool CustomDrawButton::UseGtkTheme() { 395 bool CustomDrawButton::UseGtkTheme() {
385 return !forcing_chrome_theme_ && theme_service_ && 396 return !forcing_chrome_theme_ && theme_service_ &&
386 theme_service_->UsingNativeTheme(); 397 theme_service_->UsingNativeTheme();
387 } 398 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/custom_button.h ('k') | chrome/browser/ui/gtk/download/download_shelf_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698