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

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

Issue 8800029: GTK: Add TRACE_EVENTs around gtk ui events. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fix nit 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
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/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/logging.h" 8 #include "base/logging.h"
9 #include "base/debug/trace_event.h"
9 #include "chrome/browser/ui/gtk/gtk_chrome_button.h" 10 #include "chrome/browser/ui/gtk/gtk_chrome_button.h"
10 #include "chrome/browser/ui/gtk/gtk_theme_service.h" 11 #include "chrome/browser/ui/gtk/gtk_theme_service.h"
11 #include "chrome/browser/ui/gtk/gtk_util.h" 12 #include "chrome/browser/ui/gtk/gtk_util.h"
12 #include "chrome/common/chrome_notification_types.h" 13 #include "chrome/common/chrome_notification_types.h"
13 #include "content/public/browser/notification_source.h" 14 #include "content/public/browser/notification_source.h"
14 #include "grit/theme_resources_standard.h" 15 #include "grit/theme_resources_standard.h"
15 #include "third_party/skia/include/core/SkBitmap.h" 16 #include "third_party/skia/include/core/SkBitmap.h"
16 #include "ui/base/resource/resource_bundle.h" 17 #include "ui/base/resource/resource_bundle.h"
17 #include "ui/gfx/gtk_util.h" 18 #include "ui/gfx/gtk_util.h"
18 #include "ui/gfx/image/cairo_cached_surface.h" 19 #include "ui/gfx/image/cairo_cached_surface.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 return surfaces_[0]->Width(); 66 return surfaces_[0]->Width();
66 } 67 }
67 68
68 int CustomDrawButtonBase::Height() const { 69 int CustomDrawButtonBase::Height() const {
69 return surfaces_[0]->Height(); 70 return surfaces_[0]->Height();
70 } 71 }
71 72
72 gboolean CustomDrawButtonBase::OnExpose(GtkWidget* widget, 73 gboolean CustomDrawButtonBase::OnExpose(GtkWidget* widget,
73 GdkEventExpose* e, 74 GdkEventExpose* e,
74 gdouble hover_state) { 75 gdouble hover_state) {
76 TRACE_EVENT0("ui::gtk", "CustomDrawButtonBase::OnExpose");
75 int paint_state = paint_override_ >= 0 ? 77 int paint_state = paint_override_ >= 0 ?
76 paint_override_ : gtk_widget_get_state(widget); 78 paint_override_ : gtk_widget_get_state(widget);
77 79
78 // If the paint state is PRELIGHT then set it to NORMAL (we will paint the 80 // If the paint state is PRELIGHT then set it to NORMAL (we will paint the
79 // hover state according to |hover_state_|). 81 // hover state according to |hover_state_|).
80 if (paint_state == GTK_STATE_PRELIGHT) 82 if (paint_state == GTK_STATE_PRELIGHT)
81 paint_state = GTK_STATE_NORMAL; 83 paint_state = GTK_STATE_NORMAL;
82 bool animating_hover = hover_state > 0.0 && 84 bool animating_hover = hover_state > 0.0 &&
83 paint_state == GTK_STATE_NORMAL; 85 paint_state == GTK_STATE_NORMAL;
84 gfx::CairoCachedSurface* pixbuf = PixbufForState(paint_state); 86 gfx::CairoCachedSurface* pixbuf = PixbufForState(paint_state);
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 gtk_widget_queue_draw(widget()); 327 gtk_widget_queue_draw(widget());
326 } 328 }
327 329
328 void CustomDrawButton::SetBackground(SkColor color, 330 void CustomDrawButton::SetBackground(SkColor color,
329 SkBitmap* image, SkBitmap* mask) { 331 SkBitmap* image, SkBitmap* mask) {
330 button_base_.SetBackground(color, image, mask); 332 button_base_.SetBackground(color, image, mask);
331 } 333 }
332 334
333 gboolean CustomDrawButton::OnCustomExpose(GtkWidget* sender, 335 gboolean CustomDrawButton::OnCustomExpose(GtkWidget* sender,
334 GdkEventExpose* e) { 336 GdkEventExpose* e) {
337 UNSHIPPED_TRACE_EVENT0("ui::gtk", "CustomDrawButtonBase::OnCustomExpose");
335 if (UseGtkTheme()) { 338 if (UseGtkTheme()) {
336 // Continue processing this expose event. 339 // Continue processing this expose event.
337 return FALSE; 340 return FALSE;
338 } else { 341 } else {
339 double hover_state = hover_controller_.GetCurrentValue(); 342 double hover_state = hover_controller_.GetCurrentValue();
340 return button_base_.OnExpose(sender, e, hover_state); 343 return button_base_.OnExpose(sender, e, hover_state);
341 } 344 }
342 } 345 }
343 346
344 // static 347 // static
(...skipping 20 matching lines...) Expand all
365 } 368 }
366 369
367 gtk_chrome_button_set_use_gtk_rendering( 370 gtk_chrome_button_set_use_gtk_rendering(
368 GTK_CHROME_BUTTON(widget()), UseGtkTheme()); 371 GTK_CHROME_BUTTON(widget()), UseGtkTheme());
369 } 372 }
370 373
371 bool CustomDrawButton::UseGtkTheme() { 374 bool CustomDrawButton::UseGtkTheme() {
372 return !forcing_chrome_theme_ && theme_service_ && 375 return !forcing_chrome_theme_ && theme_service_ &&
373 theme_service_->UsingNativeTheme(); 376 theme_service_->UsingNativeTheme();
374 } 377 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698