| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/browser_theme_provider.h" | 5 #include "chrome/browser/themes/browser_theme_provider.h" |
| 6 | 6 |
| 7 #include "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
| 8 #include "base/string_split.h" | 8 #include "base/string_split.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "chrome/browser/extensions/extension_service.h" | 11 #include "chrome/browser/extensions/extension_service.h" |
| 12 #include "chrome/browser/metrics/user_metrics.h" | 12 #include "chrome/browser/metrics/user_metrics.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/themes/browser_theme_pack.h" | 14 #include "chrome/browser/themes/browser_theme_pack.h" |
| 15 #include "chrome/common/chrome_constants.h" | 15 #include "chrome/common/chrome_constants.h" |
| 16 #include "chrome/common/notification_service.h" | 16 #include "chrome/common/notification_service.h" |
| 17 #include "chrome/common/notification_type.h" | 17 #include "chrome/common/notification_type.h" |
| 18 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
| 19 #include "grit/app_resources.h" | 19 #include "grit/app_resources.h" |
| 20 #include "grit/theme_resources.h" | 20 #include "grit/theme_resources.h" |
| 21 | 21 |
| 22 #if defined(OS_WIN) | 22 #if defined(OS_WIN) |
| 23 #include "app/win/hwnd_util.h" | 23 #include "ui/base/win/hwnd_util.h" |
| 24 #endif | 24 #endif |
| 25 | 25 |
| 26 // Strings used in alignment properties. | 26 // Strings used in alignment properties. |
| 27 const char* BrowserThemeProvider::kAlignmentTop = "top"; | 27 const char* BrowserThemeProvider::kAlignmentTop = "top"; |
| 28 const char* BrowserThemeProvider::kAlignmentBottom = "bottom"; | 28 const char* BrowserThemeProvider::kAlignmentBottom = "bottom"; |
| 29 const char* BrowserThemeProvider::kAlignmentLeft = "left"; | 29 const char* BrowserThemeProvider::kAlignmentLeft = "left"; |
| 30 const char* BrowserThemeProvider::kAlignmentRight = "right"; | 30 const char* BrowserThemeProvider::kAlignmentRight = "right"; |
| 31 | 31 |
| 32 // Strings used in background tiling repetition properties. | 32 // Strings used in background tiling repetition properties. |
| 33 const char* BrowserThemeProvider::kTilingNoRepeat = "no-repeat"; | 33 const char* BrowserThemeProvider::kTilingNoRepeat = "no-repeat"; |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 if (theme_pack_.get()) | 248 if (theme_pack_.get()) |
| 249 return theme_pack_->GetDisplayProperty(id, result); | 249 return theme_pack_->GetDisplayProperty(id, result); |
| 250 | 250 |
| 251 return GetDefaultDisplayProperty(id, result); | 251 return GetDefaultDisplayProperty(id, result); |
| 252 } | 252 } |
| 253 | 253 |
| 254 bool BrowserThemeProvider::ShouldUseNativeFrame() const { | 254 bool BrowserThemeProvider::ShouldUseNativeFrame() const { |
| 255 if (HasCustomImage(IDR_THEME_FRAME)) | 255 if (HasCustomImage(IDR_THEME_FRAME)) |
| 256 return false; | 256 return false; |
| 257 #if defined(OS_WIN) | 257 #if defined(OS_WIN) |
| 258 return app::win::ShouldUseVistaFrame(); | 258 return ui::ShouldUseVistaFrame(); |
| 259 #else | 259 #else |
| 260 return false; | 260 return false; |
| 261 #endif | 261 #endif |
| 262 } | 262 } |
| 263 | 263 |
| 264 bool BrowserThemeProvider::HasCustomImage(int id) const { | 264 bool BrowserThemeProvider::HasCustomImage(int id) const { |
| 265 if (!HasThemeableImage(id)) | 265 if (!HasThemeableImage(id)) |
| 266 return false; | 266 return false; |
| 267 | 267 |
| 268 if (theme_pack_) | 268 if (theme_pack_) |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 void BrowserThemeProvider::OnInfobarDisplayed() { | 626 void BrowserThemeProvider::OnInfobarDisplayed() { |
| 627 number_of_infobars_++; | 627 number_of_infobars_++; |
| 628 } | 628 } |
| 629 | 629 |
| 630 void BrowserThemeProvider::OnInfobarDestroyed() { | 630 void BrowserThemeProvider::OnInfobarDestroyed() { |
| 631 number_of_infobars_--; | 631 number_of_infobars_--; |
| 632 | 632 |
| 633 if (number_of_infobars_ == 0) | 633 if (number_of_infobars_ == 0) |
| 634 RemoveUnusedThemes(); | 634 RemoveUnusedThemes(); |
| 635 } | 635 } |
| OLD | NEW |