OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/libgtkui/native_theme_gtk3.h" | 5 #include "chrome/browser/ui/libgtkui/native_theme_gtk3.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include "chrome/browser/ui/libgtkui/chrome_gtk_frame.h" | 9 #include "chrome/browser/ui/libgtkui/chrome_gtk_frame.h" |
10 #include "chrome/browser/ui/libgtkui/chrome_gtk_menu_subclasses.h" | 10 #include "chrome/browser/ui/libgtkui/chrome_gtk_menu_subclasses.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 void PaintWidget(cc::PaintCanvas* canvas, | 56 void PaintWidget(cc::PaintCanvas* canvas, |
57 const gfx::Rect& rect, | 57 const gfx::Rect& rect, |
58 GtkStyleContext* context, | 58 GtkStyleContext* context, |
59 BackgroundRenderMode bg_mode, | 59 BackgroundRenderMode bg_mode, |
60 bool render_frame) { | 60 bool render_frame) { |
61 canvas->drawBitmap( | 61 canvas->drawBitmap( |
62 GetWidgetBitmap(rect.size(), context, bg_mode, render_frame), rect.x(), | 62 GetWidgetBitmap(rect.size(), context, bg_mode, render_frame), rect.x(), |
63 rect.y()); | 63 rect.y()); |
64 } | 64 } |
65 | 65 |
66 GtkStateFlags StateToStateFlags(NativeThemeGtk3::State state) { | |
67 switch (state) { | |
68 case NativeThemeGtk3::kDisabled: | |
69 return GTK_STATE_FLAG_INSENSITIVE; | |
70 case NativeThemeGtk3::kHovered: | |
71 return GTK_STATE_FLAG_PRELIGHT; | |
72 case NativeThemeGtk3::kNormal: | |
73 return GTK_STATE_FLAG_NORMAL; | |
74 case NativeThemeGtk3::kPressed: | |
75 return static_cast<GtkStateFlags>(GTK_STATE_FLAG_PRELIGHT | | |
76 GTK_STATE_FLAG_ACTIVE); | |
77 default: | |
78 NOTREACHED(); | |
79 return GTK_STATE_FLAG_NORMAL; | |
80 } | |
81 } | |
82 | |
83 SkColor SkColorFromColorId(ui::NativeTheme::ColorId color_id) { | 66 SkColor SkColorFromColorId(ui::NativeTheme::ColorId color_id) { |
84 const SkColor kPositiveTextColor = SkColorSetRGB(0x0b, 0x80, 0x43); | 67 const SkColor kPositiveTextColor = SkColorSetRGB(0x0b, 0x80, 0x43); |
85 const SkColor kNegativeTextColor = SkColorSetRGB(0xc5, 0x39, 0x29); | 68 const SkColor kNegativeTextColor = SkColorSetRGB(0xc5, 0x39, 0x29); |
86 | 69 |
87 switch (color_id) { | 70 switch (color_id) { |
88 // Windows | 71 // Windows |
89 case ui::NativeTheme::kColorId_WindowBackground: | 72 case ui::NativeTheme::kColorId_WindowBackground: |
90 // Dialogs | 73 // Dialogs |
91 case ui::NativeTheme::kColorId_DialogBackground: | 74 case ui::NativeTheme::kColorId_DialogBackground: |
92 case ui::NativeTheme::kColorId_BubbleBackground: | 75 case ui::NativeTheme::kColorId_BubbleBackground: |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 | 587 |
605 if (frame_top_area.incognito) { | 588 if (frame_top_area.incognito) { |
606 bitmap = SkBitmapOperations::CreateHSLShiftedBitmap( | 589 bitmap = SkBitmapOperations::CreateHSLShiftedBitmap( |
607 bitmap, kDefaultTintFrameIncognito); | 590 bitmap, kDefaultTintFrameIncognito); |
608 } | 591 } |
609 | 592 |
610 canvas->drawBitmap(bitmap, rect.x(), rect.y()); | 593 canvas->drawBitmap(bitmap, rect.x(), rect.y()); |
611 } | 594 } |
612 | 595 |
613 } // namespace libgtkui | 596 } // namespace libgtkui |
OLD | NEW |