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

Side by Side Diff: chrome/browser/ui/libgtk2ui/native_theme_gtk2.cc

Issue 2297453003: Handle alert severity colors in NativeThemeGtk2. (Closed)
Patch Set: Created 4 years, 3 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 | « no previous file | 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/libgtk2ui/native_theme_gtk2.h" 5 #include "chrome/browser/ui/libgtk2ui/native_theme_gtk2.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include "chrome/browser/ui/libgtk2ui/chrome_gtk_frame.h" 9 #include "chrome/browser/ui/libgtk2ui/chrome_gtk_frame.h"
10 #include "chrome/browser/ui/libgtk2ui/chrome_gtk_menu_subclasses.h" 10 #include "chrome/browser/ui/libgtk2ui/chrome_gtk_menu_subclasses.h"
11 #include "chrome/browser/ui/libgtk2ui/gtk2_ui.h" 11 #include "chrome/browser/ui/libgtk2ui/gtk2_ui.h"
12 #include "chrome/browser/ui/libgtk2ui/gtk2_util.h" 12 #include "chrome/browser/ui/libgtk2ui/gtk2_util.h"
13 #include "chrome/browser/ui/libgtk2ui/skia_utils_gtk2.h" 13 #include "chrome/browser/ui/libgtk2ui/skia_utils_gtk2.h"
14 #include "third_party/skia/include/core/SkColor.h" 14 #include "third_party/skia/include/core/SkColor.h"
15 #include "ui/gfx/color_palette.h" 15 #include "ui/gfx/color_palette.h"
16 #include "ui/gfx/color_utils.h" 16 #include "ui/gfx/color_utils.h"
17 #include "ui/gfx/geometry/rect.h" 17 #include "ui/gfx/geometry/rect.h"
18 #include "ui/gfx/geometry/size.h" 18 #include "ui/gfx/geometry/size.h"
19 #include "ui/gfx/path.h" 19 #include "ui/gfx/path.h"
20 #include "ui/gfx/skia_util.h" 20 #include "ui/gfx/skia_util.h"
21 #include "ui/native_theme/common_theme.h" 21 #include "ui/native_theme/common_theme.h"
22 #include "ui/native_theme/native_theme_aura.h"
23 #include "ui/native_theme/native_theme_dark_aura.h"
22 24
23 namespace libgtk2ui { 25 namespace libgtk2ui {
24 26
25 namespace { 27 namespace {
26 28
27 // Theme colors returned by GetSystemColor(). 29 // Theme colors returned by GetSystemColor().
28 const SkColor kInvalidColorIdColor = SkColorSetRGB(255, 0, 128); 30 const SkColor kInvalidColorIdColor = SkColorSetRGB(255, 0, 128);
29 const SkColor kURLTextColor = SkColorSetRGB(0x0b, 0x80, 0x43); 31 const SkColor kURLTextColor = SkColorSetRGB(0x0b, 0x80, 0x43);
30 32
31 // Generates the normal URL color, a green color used in unhighlighted URL 33 // Generates the normal URL color, a green color used in unhighlighted URL
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 case kColorId_ThrobberLightColor: 450 case kColorId_ThrobberLightColor:
449 return GetSystemColor(kColorId_TextfieldSelectionBackgroundFocused); 451 return GetSystemColor(kColorId_TextfieldSelectionBackgroundFocused);
450 452
451 case kColorId_ThrobberWaitingColor: 453 case kColorId_ThrobberWaitingColor:
452 return color_utils::AlphaBlend( 454 return color_utils::AlphaBlend(
453 GetSystemColor(kColorId_TextfieldSelectionBackgroundFocused), 455 GetSystemColor(kColorId_TextfieldSelectionBackgroundFocused),
454 GetBGColor(GetWindow(), NORMAL), 456 GetBGColor(GetWindow(), NORMAL),
455 0x80); 457 0x80);
456 458
457 // Alert icons 459 // Alert icons
458 // These aren't yet used in any GTK NativeTheme context, so they don't have 460 // Just fall back to the same colors as Aura.
459 // definitions.
460 case kColorId_AlertSeverityLow: 461 case kColorId_AlertSeverityLow:
461 case kColorId_AlertSeverityMedium: 462 case kColorId_AlertSeverityMedium:
462 case kColorId_AlertSeverityHigh: 463 case kColorId_AlertSeverityHigh: {
464 ui::NativeTheme* fallback_theme =
465 color_utils::IsDark(GetTextColor(GetEntry(), NORMAL))
466 ? ui::NativeThemeAura::instance()
467 : ui::NativeThemeDarkAura::instance();
468 return fallback_theme->GetSystemColor(color_id);
469 }
470
463 case kColorId_NumColors: 471 case kColorId_NumColors:
464 NOTREACHED(); 472 NOTREACHED();
465 break; 473 break;
466 } 474 }
467 475
468 return kInvalidColorIdColor; 476 return kInvalidColorIdColor;
469 } 477 }
470 478
471 // Get ChromeGtkFrame theme colors. No-op in GTK3. 479 // Get ChromeGtkFrame theme colors. No-op in GTK3.
472 bool NativeThemeGtk2::GetChromeStyleColor(const char* style_property, 480 bool NativeThemeGtk2::GetChromeStyleColor(const char* style_property,
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 582
575 if (!fake_menu_item) { 583 if (!fake_menu_item) {
576 fake_menu_item = gtk_custom_menu_item_new(); 584 fake_menu_item = gtk_custom_menu_item_new();
577 gtk_menu_shell_append(GTK_MENU_SHELL(GetMenu()), fake_menu_item); 585 gtk_menu_shell_append(GTK_MENU_SHELL(GetMenu()), fake_menu_item);
578 } 586 }
579 587
580 return fake_menu_item; 588 return fake_menu_item;
581 } 589 }
582 590
583 } // namespace libgtk2ui 591 } // namespace libgtk2ui
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698