| 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/browser_theme_pack.h" | 5 #include "chrome/browser/browser_theme_pack.h" |
| 6 | 6 |
| 7 #include "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
| 8 #include "base/data_pack.h" | 8 #include "base/data_pack.h" |
| 9 #include "base/stl_util-inl.h" | 9 #include "base/stl_util-inl.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "chrome/browser/browser_theme_provider.h" | 12 #include "chrome/browser/browser_theme_provider.h" |
| 13 #include "chrome/browser/chrome_thread.h" | 13 #include "chrome/browser/chrome_thread.h" |
| 14 #include "gfx/codec/png_codec.h" | 14 #include "gfx/codec/png_codec.h" |
| 15 #include "gfx/skbitmap_operations.h" | 15 #include "gfx/skbitmap_operations.h" |
| 16 #include "grit/app_resources.h" | 16 #include "grit/app_resources.h" |
| 17 #include "grit/theme_resources.h" | 17 #include "grit/theme_resources.h" |
| 18 #include "net/base/file_stream.h" | 18 #include "net/base/file_stream.h" |
| 19 #include "net/base/net_errors.h" | 19 #include "net/base/net_errors.h" |
| 20 #include "third_party/skia/include/core/SkCanvas.h" | 20 #include "third_party/skia/include/core/SkCanvas.h" |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 // Version number of the current theme pack. We just throw out and rebuild | 24 // Version number of the current theme pack. We just throw out and rebuild |
| 25 // theme packs that aren't int-equal to this. | 25 // theme packs that aren't int-equal to this. |
| 26 const int kThemePackVersion = 11; | 26 const int kThemePackVersion = 12; |
| 27 | 27 |
| 28 // IDs that are in the DataPack won't clash with the positive integer | 28 // IDs that are in the DataPack won't clash with the positive integer |
| 29 // int32_t. kHeaderID should always have the maximum value because we want the | 29 // int32_t. kHeaderID should always have the maximum value because we want the |
| 30 // "header" to be written last. That way we can detect whether the pack was | 30 // "header" to be written last. That way we can detect whether the pack was |
| 31 // successfully written and ignore and regenerate if it was only partially | 31 // successfully written and ignore and regenerate if it was only partially |
| 32 // written (i.e. chrome crashed on a different thread while writing the pack). | 32 // written (i.e. chrome crashed on a different thread while writing the pack). |
| 33 const int kHeaderID = UINT_MAX - 1; | 33 const int kHeaderID = UINT_MAX - 1; |
| 34 const int kTintsID = UINT_MAX - 2; | 34 const int kTintsID = UINT_MAX - 2; |
| 35 const int kColorsID = UINT_MAX - 3; | 35 const int kColorsID = UINT_MAX - 3; |
| 36 const int kDisplayPropertiesID = UINT_MAX - 4; | 36 const int kDisplayPropertiesID = UINT_MAX - 4; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 { 25, IDR_HOME_P, NULL }, | 124 { 25, IDR_HOME_P, NULL }, |
| 125 { 26, IDR_RELOAD, NULL }, | 125 { 26, IDR_RELOAD, NULL }, |
| 126 { 27, IDR_RELOAD_H, NULL }, | 126 { 27, IDR_RELOAD_H, NULL }, |
| 127 { 28, IDR_RELOAD_P, NULL }, | 127 { 28, IDR_RELOAD_P, NULL }, |
| 128 { 29, IDR_STOP, NULL }, | 128 { 29, IDR_STOP, NULL }, |
| 129 { 30, IDR_STOP_H, NULL }, | 129 { 30, IDR_STOP_H, NULL }, |
| 130 { 31, IDR_STOP_P, NULL }, | 130 { 31, IDR_STOP_P, NULL }, |
| 131 { 32, IDR_LOCATIONBG_C, NULL }, | 131 { 32, IDR_LOCATIONBG_C, NULL }, |
| 132 { 33, IDR_LOCATIONBG_L, NULL }, | 132 { 33, IDR_LOCATIONBG_L, NULL }, |
| 133 { 34, IDR_LOCATIONBG_R, NULL }, | 133 { 34, IDR_LOCATIONBG_R, NULL }, |
| 134 { 35, IDR_MENU_BOOKMARK, NULL }, | 134 { 35, IDR_MENU_PAGE, NULL }, |
| 135 { 36, IDR_MENU_PAGE, NULL }, | 135 { 36, IDR_MENU_PAGE_RTL, NULL }, |
| 136 { 37, IDR_MENU_PAGE_RTL, NULL }, | 136 { 37, IDR_MENU_CHROME, NULL }, |
| 137 { 38, IDR_MENU_CHROME, NULL }, | 137 { 38, IDR_MENU_CHROME_RTL, NULL }, |
| 138 { 39, IDR_MENU_CHROME_RTL, NULL }, | 138 { 39, IDR_MENU_DROPARROW, NULL }, |
| 139 { 40, IDR_MENU_DROPARROW, NULL }, | 139 { 40, IDR_THROBBER, NULL }, |
| 140 { 41, IDR_THROBBER, NULL }, | 140 { 41, IDR_THROBBER_WAITING, NULL }, |
| 141 { 42, IDR_THROBBER_WAITING, NULL }, | 141 { 42, IDR_THROBBER_LIGHT, NULL }, |
| 142 { 43, IDR_THROBBER_LIGHT, NULL }, | |
| 143 }; | 142 }; |
| 144 | 143 |
| 145 int GetPersistentIDByName(const std::string& key) { | 144 int GetPersistentIDByName(const std::string& key) { |
| 146 for (size_t i = 0; i < arraysize(kPersistingImages); ++i) { | 145 for (size_t i = 0; i < arraysize(kPersistingImages); ++i) { |
| 147 if (kPersistingImages[i].key != NULL && | 146 if (kPersistingImages[i].key != NULL && |
| 148 base::strcasecmp(key.c_str(), kPersistingImages[i].key) == 0) { | 147 base::strcasecmp(key.c_str(), kPersistingImages[i].key) == 0) { |
| 149 return kPersistingImages[i].persistent_id; | 148 return kPersistingImages[i].persistent_id; |
| 150 } | 149 } |
| 151 } | 150 } |
| 152 | 151 |
| (...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1032 hsl.h = tints_[i].h; | 1031 hsl.h = tints_[i].h; |
| 1033 hsl.s = tints_[i].s; | 1032 hsl.s = tints_[i].s; |
| 1034 hsl.l = tints_[i].l; | 1033 hsl.l = tints_[i].l; |
| 1035 return hsl; | 1034 return hsl; |
| 1036 } | 1035 } |
| 1037 } | 1036 } |
| 1038 } | 1037 } |
| 1039 | 1038 |
| 1040 return BrowserThemeProvider::GetDefaultTint(id); | 1039 return BrowserThemeProvider::GetDefaultTint(id); |
| 1041 } | 1040 } |
| OLD | NEW |