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/webui/ntp/ntp_resource_cache.h" | 5 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 #include "grit/browser_resources.h" | 51 #include "grit/browser_resources.h" |
52 #include "grit/components_strings.h" | 52 #include "grit/components_strings.h" |
53 #include "grit/theme_resources.h" | 53 #include "grit/theme_resources.h" |
54 #include "ui/base/l10n/l10n_util.h" | 54 #include "ui/base/l10n/l10n_util.h" |
55 #include "ui/base/resource/resource_bundle.h" | 55 #include "ui/base/resource/resource_bundle.h" |
56 #include "ui/base/theme_provider.h" | 56 #include "ui/base/theme_provider.h" |
57 #include "ui/base/webui/jstemplate_builder.h" | 57 #include "ui/base/webui/jstemplate_builder.h" |
58 #include "ui/base/webui/web_ui_util.h" | 58 #include "ui/base/webui/web_ui_util.h" |
59 #include "ui/gfx/animation/animation.h" | 59 #include "ui/gfx/animation/animation.h" |
60 #include "ui/gfx/color_utils.h" | 60 #include "ui/gfx/color_utils.h" |
61 #include "ui/gfx/sys_color_change_listener.h" | |
62 | 61 |
63 #if defined(OS_CHROMEOS) | 62 #if defined(OS_CHROMEOS) |
64 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 63 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
65 #include "chromeos/chromeos_switches.h" | 64 #include "chromeos/chromeos_switches.h" |
66 #endif | 65 #endif |
67 | 66 |
68 #if defined(OS_MACOSX) | 67 #if defined(OS_MACOSX) |
69 #include "chrome/browser/platform_util.h" | 68 #include "chrome/browser/platform_util.h" |
70 #endif | 69 #endif |
71 | 70 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 "%d,%d,%d", | 106 "%d,%d,%d", |
108 SkColorGetR(color), | 107 SkColorGetR(color), |
109 SkColorGetG(color), | 108 SkColorGetG(color), |
110 SkColorGetB(color)); | 109 SkColorGetB(color)); |
111 } | 110 } |
112 | 111 |
113 SkColor GetThemeColor(ui::ThemeProvider* tp, int id) { | 112 SkColor GetThemeColor(ui::ThemeProvider* tp, int id) { |
114 SkColor color = tp->GetColor(id); | 113 SkColor color = tp->GetColor(id); |
115 // If web contents are being inverted because the system is in high-contrast | 114 // If web contents are being inverted because the system is in high-contrast |
116 // mode, any system theme colors we use must be inverted too to cancel out. | 115 // mode, any system theme colors we use must be inverted too to cancel out. |
117 return gfx::IsInvertedColorScheme() ? | 116 return color_utils::IsInvertedColorScheme() ? |
118 color_utils::InvertColor(color) : color; | 117 color_utils::InvertColor(color) : color; |
119 } | 118 } |
120 | 119 |
121 // Get the CSS string for the background position on the new tab page for the | 120 // Get the CSS string for the background position on the new tab page for the |
122 // states when the bar is attached or detached. | 121 // states when the bar is attached or detached. |
123 std::string GetNewTabBackgroundCSS(const ui::ThemeProvider* theme_provider, | 122 std::string GetNewTabBackgroundCSS(const ui::ThemeProvider* theme_provider, |
124 bool bar_attached) { | 123 bool bar_attached) { |
125 // TODO(glen): This is a quick workaround to hide the notused.png image when | 124 // TODO(glen): This is a quick workaround to hide the notused.png image when |
126 // no image is provided - we don't have time right now to figure out why | 125 // no image is provided - we don't have time right now to figure out why |
127 // this is painting as white. | 126 // this is painting as white. |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 // Get our template. | 688 // Get our template. |
690 static const base::StringPiece new_tab_theme_css( | 689 static const base::StringPiece new_tab_theme_css( |
691 ResourceBundle::GetSharedInstance().GetRawDataResource( | 690 ResourceBundle::GetSharedInstance().GetRawDataResource( |
692 IDR_NEW_TAB_4_THEME_CSS)); | 691 IDR_NEW_TAB_4_THEME_CSS)); |
693 | 692 |
694 // Create the string from our template and the replacements. | 693 // Create the string from our template and the replacements. |
695 std::string css_string; | 694 std::string css_string; |
696 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); | 695 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); |
697 new_tab_css_ = base::RefCountedString::TakeString(&css_string); | 696 new_tab_css_ = base::RefCountedString::TakeString(&css_string); |
698 } | 697 } |
OLD | NEW |