| 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/themes/browser_theme_pack.h" | 5 #include "chrome/browser/themes/browser_theme_pack.h" |
| 6 | 6 |
| 7 #include <limits.h> | 7 #include <limits.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 using content::BrowserThread; | 43 using content::BrowserThread; |
| 44 using extensions::Extension; | 44 using extensions::Extension; |
| 45 | 45 |
| 46 namespace { | 46 namespace { |
| 47 | 47 |
| 48 // Version number of the current theme pack. We just throw out and rebuild | 48 // Version number of the current theme pack. We just throw out and rebuild |
| 49 // theme packs that aren't int-equal to this. Increment this number if you | 49 // theme packs that aren't int-equal to this. Increment this number if you |
| 50 // change default theme assets or if you need themes to recreate their generated | 50 // change default theme assets or if you need themes to recreate their generated |
| 51 // images (which are cached). | 51 // images (which are cached). |
| 52 const int kThemePackVersion = 41; | 52 const int kThemePackVersion = 42; |
| 53 | 53 |
| 54 // IDs that are in the DataPack won't clash with the positive integer | 54 // IDs that are in the DataPack won't clash with the positive integer |
| 55 // uint16_t. kHeaderID should always have the maximum value because we want the | 55 // uint16_t. kHeaderID should always have the maximum value because we want the |
| 56 // "header" to be written last. That way we can detect whether the pack was | 56 // "header" to be written last. That way we can detect whether the pack was |
| 57 // successfully written and ignore and regenerate if it was only partially | 57 // successfully written and ignore and regenerate if it was only partially |
| 58 // written (i.e. chrome crashed on a different thread while writing the pack). | 58 // written (i.e. chrome crashed on a different thread while writing the pack). |
| 59 const int kMaxID = 0x0000FFFF; // Max unsigned 16-bit int. | 59 const int kMaxID = 0x0000FFFF; // Max unsigned 16-bit int. |
| 60 const int kHeaderID = kMaxID - 1; | 60 const int kHeaderID = kMaxID - 1; |
| 61 const int kTintsID = kMaxID - 2; | 61 const int kTintsID = kMaxID - 2; |
| 62 const int kColorsID = kMaxID - 3; | 62 const int kColorsID = kMaxID - 3; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 {23, IDR_HOME, NULL}, | 158 {23, IDR_HOME, NULL}, |
| 159 {24, IDR_HOME_H, NULL}, | 159 {24, IDR_HOME_H, NULL}, |
| 160 {25, IDR_HOME_P, NULL}, | 160 {25, IDR_HOME_P, NULL}, |
| 161 {26, IDR_RELOAD, NULL}, | 161 {26, IDR_RELOAD, NULL}, |
| 162 {27, IDR_RELOAD_H, NULL}, | 162 {27, IDR_RELOAD_H, NULL}, |
| 163 {28, IDR_RELOAD_P, NULL}, | 163 {28, IDR_RELOAD_P, NULL}, |
| 164 {29, IDR_STOP, NULL}, | 164 {29, IDR_STOP, NULL}, |
| 165 {30, IDR_STOP_D, NULL}, | 165 {30, IDR_STOP_D, NULL}, |
| 166 {31, IDR_STOP_H, NULL}, | 166 {31, IDR_STOP_H, NULL}, |
| 167 {32, IDR_STOP_P, NULL}, | 167 {32, IDR_STOP_P, NULL}, |
| 168 {33, IDR_BROWSER_ACTIONS_OVERFLOW, NULL}, | 168 {33, IDR_TOOLS, NULL}, |
| 169 {34, IDR_BROWSER_ACTIONS_OVERFLOW_H, NULL}, | 169 {34, IDR_TOOLS_H, NULL}, |
| 170 {35, IDR_BROWSER_ACTIONS_OVERFLOW_P, NULL}, | 170 {35, IDR_TOOLS_P, NULL}, |
| 171 {36, IDR_TOOLS, NULL}, | 171 {36, IDR_MENU_DROPARROW, NULL}, |
| 172 {37, IDR_TOOLS_H, NULL}, | 172 {37, IDR_TOOLBAR_BEZEL_HOVER, NULL}, |
| 173 {38, IDR_TOOLS_P, NULL}, | 173 {38, IDR_TOOLBAR_BEZEL_PRESSED, NULL}, |
| 174 {39, IDR_MENU_DROPARROW, NULL}, | 174 {39, IDR_TOOLS_BAR, NULL}, |
| 175 {40, IDR_TOOLBAR_BEZEL_HOVER, NULL}, | |
| 176 {41, IDR_TOOLBAR_BEZEL_PRESSED, NULL}, | |
| 177 {42, IDR_TOOLS_BAR, NULL}, | |
| 178 }; | 175 }; |
| 179 const size_t kPersistingImagesLength = arraysize(kPersistingImages); | 176 const size_t kPersistingImagesLength = arraysize(kPersistingImages); |
| 180 | 177 |
| 181 int GetPersistentIDByNameHelper(const std::string& key, | 178 int GetPersistentIDByNameHelper(const std::string& key, |
| 182 const PersistingImagesTable* image_table, | 179 const PersistingImagesTable* image_table, |
| 183 size_t image_table_size) { | 180 size_t image_table_size) { |
| 184 for (size_t i = 0; i < image_table_size; ++i) { | 181 for (size_t i = 0; i < image_table_size; ++i) { |
| 185 if (image_table[i].key && | 182 if (image_table[i].key && |
| 186 base::LowerCaseEqualsASCII(key, image_table[i].key)) { | 183 base::LowerCaseEqualsASCII(key, image_table[i].key)) { |
| 187 return image_table[i].persistent_id; | 184 return image_table[i].persistent_id; |
| (...skipping 1352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1540 false, | 1537 false, |
| 1541 &bitmap_data)) { | 1538 &bitmap_data)) { |
| 1542 NOTREACHED() << "Unable to encode theme image for prs_id=" | 1539 NOTREACHED() << "Unable to encode theme image for prs_id=" |
| 1543 << prs_id << " for scale_factor=" << scale_factors_[i]; | 1540 << prs_id << " for scale_factor=" << scale_factors_[i]; |
| 1544 break; | 1541 break; |
| 1545 } | 1542 } |
| 1546 image_memory_[scaled_raw_id] = | 1543 image_memory_[scaled_raw_id] = |
| 1547 base::RefCountedBytes::TakeVector(&bitmap_data); | 1544 base::RefCountedBytes::TakeVector(&bitmap_data); |
| 1548 } | 1545 } |
| 1549 } | 1546 } |
| OLD | NEW |