OLD | NEW |
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/themes/theme_service.h" | 5 #include "chrome/browser/themes/theme_service.h" |
6 | 6 |
7 #include "base/string_split.h" | 7 #include "base/string_split.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 IDR_THEME_TAB_BACKGROUND_V, | 146 IDR_THEME_TAB_BACKGROUND_V, |
147 IDR_THEME_NTP_BACKGROUND, | 147 IDR_THEME_NTP_BACKGROUND, |
148 IDR_THEME_FRAME_OVERLAY, | 148 IDR_THEME_FRAME_OVERLAY, |
149 IDR_THEME_FRAME_OVERLAY_INACTIVE, | 149 IDR_THEME_FRAME_OVERLAY_INACTIVE, |
150 IDR_THEME_BUTTON_BACKGROUND, | 150 IDR_THEME_BUTTON_BACKGROUND, |
151 IDR_THEME_NTP_ATTRIBUTION, | 151 IDR_THEME_NTP_ATTRIBUTION, |
152 IDR_THEME_WINDOW_CONTROL_BACKGROUND | 152 IDR_THEME_WINDOW_CONTROL_BACKGROUND |
153 }; | 153 }; |
154 | 154 |
155 bool HasThemeableImage(int themeable_image_id) { | 155 bool HasThemeableImage(int themeable_image_id) { |
156 static std::set<int> themeable_images; | 156 CR_DEFINE_STATIC_LOCAL(std::set<int>, themeable_images, ()); |
157 if (themeable_images.empty()) { | 157 if (themeable_images.empty()) { |
158 themeable_images.insert( | 158 themeable_images.insert( |
159 kThemeableImages, kThemeableImages + arraysize(kThemeableImages)); | 159 kThemeableImages, kThemeableImages + arraysize(kThemeableImages)); |
160 } | 160 } |
161 return themeable_images.count(themeable_image_id) > 0; | 161 return themeable_images.count(themeable_image_id) > 0; |
162 } | 162 } |
163 | 163 |
164 // The image resources that will be tinted by the 'button' tint value. | 164 // The image resources that will be tinted by the 'button' tint value. |
165 // If you change this list, you must increment the version number in | 165 // If you change this list, you must increment the version number in |
166 // browser_theme_pack.cc, and you should assign persistent IDs to the | 166 // browser_theme_pack.cc, and you should assign persistent IDs to the |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 case NTP_LOGO_ALTERNATE: | 530 case NTP_LOGO_ALTERNATE: |
531 *result = kDefaultDisplayPropertyNTPInverseLogo; | 531 *result = kDefaultDisplayPropertyNTPInverseLogo; |
532 return true; | 532 return true; |
533 } | 533 } |
534 | 534 |
535 return false; | 535 return false; |
536 } | 536 } |
537 | 537 |
538 // static | 538 // static |
539 const std::set<int>& ThemeService::GetTintableToolbarButtons() { | 539 const std::set<int>& ThemeService::GetTintableToolbarButtons() { |
540 static std::set<int> button_set; | 540 CR_DEFINE_STATIC_LOCAL(std::set<int>, button_set, ()); |
541 if (button_set.empty()) { | 541 if (button_set.empty()) { |
542 button_set = std::set<int>( | 542 button_set = std::set<int>( |
543 kToolbarButtonIDs, | 543 kToolbarButtonIDs, |
544 kToolbarButtonIDs + arraysize(kToolbarButtonIDs)); | 544 kToolbarButtonIDs + arraysize(kToolbarButtonIDs)); |
545 } | 545 } |
546 | 546 |
547 return button_set; | 547 return button_set; |
548 } | 548 } |
549 | 549 |
550 color_utils::HSL ThemeService::GetTint(int id) const { | 550 color_utils::HSL ThemeService::GetTint(int id) const { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 void ThemeService::OnInfobarDisplayed() { | 664 void ThemeService::OnInfobarDisplayed() { |
665 number_of_infobars_++; | 665 number_of_infobars_++; |
666 } | 666 } |
667 | 667 |
668 void ThemeService::OnInfobarDestroyed() { | 668 void ThemeService::OnInfobarDestroyed() { |
669 number_of_infobars_--; | 669 number_of_infobars_--; |
670 | 670 |
671 if (number_of_infobars_ == 0) | 671 if (number_of_infobars_ == 0) |
672 RemoveUnusedThemes(); | 672 RemoveUnusedThemes(); |
673 } | 673 } |
OLD | NEW |