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 = 42; | 52 const int kThemePackVersion = 43; |
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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 { "frame_inactive", ThemeProperties::TINT_FRAME_INACTIVE }, | 259 { "frame_inactive", ThemeProperties::TINT_FRAME_INACTIVE }, |
260 { "frame_incognito", ThemeProperties::TINT_FRAME_INCOGNITO }, | 260 { "frame_incognito", ThemeProperties::TINT_FRAME_INCOGNITO }, |
261 { "frame_incognito_inactive", | 261 { "frame_incognito_inactive", |
262 ThemeProperties::TINT_FRAME_INCOGNITO_INACTIVE }, | 262 ThemeProperties::TINT_FRAME_INCOGNITO_INACTIVE }, |
263 { "background_tab", ThemeProperties::TINT_BACKGROUND_TAB }, | 263 { "background_tab", ThemeProperties::TINT_BACKGROUND_TAB }, |
264 }; | 264 }; |
265 const size_t kTintTableLength = arraysize(kTintTable); | 265 const size_t kTintTableLength = arraysize(kTintTable); |
266 | 266 |
267 // Strings used by themes to identify colors in the JSON. | 267 // Strings used by themes to identify colors in the JSON. |
268 StringToIntTable kColorTable[] = { | 268 StringToIntTable kColorTable[] = { |
| 269 { "control_background", ThemeProperties::COLOR_CONTROL_BACKGROUND }, |
269 { "frame", ThemeProperties::COLOR_FRAME }, | 270 { "frame", ThemeProperties::COLOR_FRAME }, |
270 { "frame_inactive", ThemeProperties::COLOR_FRAME_INACTIVE }, | 271 { "frame_inactive", ThemeProperties::COLOR_FRAME_INACTIVE }, |
271 { "frame_incognito", ThemeProperties::COLOR_FRAME_INCOGNITO }, | 272 { "frame_incognito", ThemeProperties::COLOR_FRAME_INCOGNITO }, |
272 { "frame_incognito_inactive", | 273 { "frame_incognito_inactive", |
273 ThemeProperties::COLOR_FRAME_INCOGNITO_INACTIVE }, | 274 ThemeProperties::COLOR_FRAME_INCOGNITO_INACTIVE }, |
274 { "toolbar", ThemeProperties::COLOR_TOOLBAR }, | 275 { "toolbar", ThemeProperties::COLOR_TOOLBAR }, |
275 { "tab_text", ThemeProperties::COLOR_TAB_TEXT }, | 276 { "tab_text", ThemeProperties::COLOR_TAB_TEXT }, |
276 { "tab_background_text", ThemeProperties::COLOR_BACKGROUND_TAB_TEXT }, | 277 { "tab_background_text", ThemeProperties::COLOR_BACKGROUND_TAB_TEXT }, |
277 { "bookmark_text", ThemeProperties::COLOR_BOOKMARK_TEXT }, | 278 { "bookmark_text", ThemeProperties::COLOR_BOOKMARK_TEXT }, |
278 { "ntp_background", ThemeProperties::COLOR_NTP_BACKGROUND }, | 279 { "ntp_background", ThemeProperties::COLOR_NTP_BACKGROUND }, |
(...skipping 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1537 false, | 1538 false, |
1538 &bitmap_data)) { | 1539 &bitmap_data)) { |
1539 NOTREACHED() << "Unable to encode theme image for prs_id=" | 1540 NOTREACHED() << "Unable to encode theme image for prs_id=" |
1540 << prs_id << " for scale_factor=" << scale_factors_[i]; | 1541 << prs_id << " for scale_factor=" << scale_factors_[i]; |
1541 break; | 1542 break; |
1542 } | 1543 } |
1543 image_memory_[scaled_raw_id] = | 1544 image_memory_[scaled_raw_id] = |
1544 base::RefCountedBytes::TakeVector(&bitmap_data); | 1545 base::RefCountedBytes::TakeVector(&bitmap_data); |
1545 } | 1546 } |
1546 } | 1547 } |
OLD | NEW |