OLD | NEW |
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" |
(...skipping 19 matching lines...) Expand all Loading... |
30 resource_id, ui::ResourceBundle::RTL_ENABLED).ToGdkPixbuf(); | 30 resource_id, ui::ResourceBundle::RTL_ENABLED).ToGdkPixbuf(); |
31 } | 31 } |
32 | 32 |
33 } // namespace | 33 } // namespace |
34 | 34 |
35 CustomDrawButtonBase::CustomDrawButtonBase(GtkThemeService* theme_provider, | 35 CustomDrawButtonBase::CustomDrawButtonBase(GtkThemeService* theme_provider, |
36 int normal_id, | 36 int normal_id, |
37 int pressed_id, | 37 int pressed_id, |
38 int hover_id, | 38 int hover_id, |
39 int disabled_id) | 39 int disabled_id) |
40 : background_image_(NULL), | 40 : paint_override_(-1), |
41 paint_override_(-1), | |
42 normal_id_(normal_id), | 41 normal_id_(normal_id), |
43 pressed_id_(pressed_id), | 42 pressed_id_(pressed_id), |
44 hover_id_(hover_id), | 43 hover_id_(hover_id), |
45 disabled_id_(disabled_id), | 44 disabled_id_(disabled_id), |
46 theme_service_(theme_provider), | 45 theme_service_(theme_provider), |
47 flipped_(false) { | 46 flipped_(false) { |
48 for (int i = 0; i < (GTK_STATE_INSENSITIVE + 1); ++i) | 47 for (int i = 0; i < (GTK_STATE_INSENSITIVE + 1); ++i) |
49 surfaces_[i].reset(new gfx::CairoCachedSurface); | 48 surfaces_[i].reset(new gfx::CairoCachedSurface); |
50 background_image_.reset(new gfx::CairoCachedSurface); | 49 background_image_.reset(new gfx::CairoCachedSurface); |
51 | 50 |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 } | 388 } |
390 | 389 |
391 gtk_chrome_button_set_use_gtk_rendering( | 390 gtk_chrome_button_set_use_gtk_rendering( |
392 GTK_CHROME_BUTTON(widget()), UseGtkTheme()); | 391 GTK_CHROME_BUTTON(widget()), UseGtkTheme()); |
393 } | 392 } |
394 | 393 |
395 bool CustomDrawButton::UseGtkTheme() { | 394 bool CustomDrawButton::UseGtkTheme() { |
396 return !forcing_chrome_theme_ && theme_service_ && | 395 return !forcing_chrome_theme_ && theme_service_ && |
397 theme_service_->UsingNativeTheme(); | 396 theme_service_->UsingNativeTheme(); |
398 } | 397 } |
OLD | NEW |