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 30 matching lines...) Expand all Loading... | |
41 #include "ui/gfx/skia_util.h" | 41 #include "ui/gfx/skia_util.h" |
42 #include "ui/resources/grit/ui_resources.h" | 42 #include "ui/resources/grit/ui_resources.h" |
43 | 43 |
44 using content::BrowserThread; | 44 using content::BrowserThread; |
45 using extensions::Extension; | 45 using extensions::Extension; |
46 | 46 |
47 namespace { | 47 namespace { |
48 | 48 |
49 // Version number of the current theme pack. We just throw out and rebuild | 49 // Version number of the current theme pack. We just throw out and rebuild |
50 // theme packs that aren't int-equal to this. Increment this number if you | 50 // theme packs that aren't int-equal to this. Increment this number if you |
51 // change default theme assets. | 51 // change default theme assets or otherwise need to flush the theme image cache. |
Evan Stade
2016/03/17 01:06:51
actually the "cache" is a bit vague here. Can we s
shrike
2016/03/17 20:59:15
I'm OK with that, except I think it should explici
| |
52 const int kThemePackVersion = 40; | 52 const int kThemePackVersion = 40; |
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; |
(...skipping 1480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1542 false, | 1542 false, |
1543 &bitmap_data)) { | 1543 &bitmap_data)) { |
1544 NOTREACHED() << "Unable to encode theme image for prs_id=" | 1544 NOTREACHED() << "Unable to encode theme image for prs_id=" |
1545 << prs_id << " for scale_factor=" << scale_factors_[i]; | 1545 << prs_id << " for scale_factor=" << scale_factors_[i]; |
1546 break; | 1546 break; |
1547 } | 1547 } |
1548 image_memory_[scaled_raw_id] = | 1548 image_memory_[scaled_raw_id] = |
1549 base::RefCountedBytes::TakeVector(&bitmap_data); | 1549 base::RefCountedBytes::TakeVector(&bitmap_data); |
1550 } | 1550 } |
1551 } | 1551 } |
OLD | NEW |