| 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> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
| 10 #include "base/memory/ref_counted_memory.h" | 10 #include "base/memory/ref_counted_memory.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 #include "ui/gfx/skia_util.h" | 36 #include "ui/gfx/skia_util.h" |
| 37 | 37 |
| 38 using content::BrowserThread; | 38 using content::BrowserThread; |
| 39 using extensions::Extension; | 39 using extensions::Extension; |
| 40 | 40 |
| 41 namespace { | 41 namespace { |
| 42 | 42 |
| 43 // Version number of the current theme pack. We just throw out and rebuild | 43 // Version number of the current theme pack. We just throw out and rebuild |
| 44 // theme packs that aren't int-equal to this. Increment this number if you | 44 // theme packs that aren't int-equal to this. Increment this number if you |
| 45 // change default theme assets. | 45 // change default theme assets. |
| 46 const int kThemePackVersion = 32; | 46 const int kThemePackVersion = 33; |
| 47 | 47 |
| 48 // IDs that are in the DataPack won't clash with the positive integer | 48 // IDs that are in the DataPack won't clash with the positive integer |
| 49 // uint16. kHeaderID should always have the maximum value because we want the | 49 // uint16. kHeaderID should always have the maximum value because we want the |
| 50 // "header" to be written last. That way we can detect whether the pack was | 50 // "header" to be written last. That way we can detect whether the pack was |
| 51 // successfully written and ignore and regenerate if it was only partially | 51 // successfully written and ignore and regenerate if it was only partially |
| 52 // written (i.e. chrome crashed on a different thread while writing the pack). | 52 // written (i.e. chrome crashed on a different thread while writing the pack). |
| 53 const int kMaxID = 0x0000FFFF; // Max unsigned 16-bit int. | 53 const int kMaxID = 0x0000FFFF; // Max unsigned 16-bit int. |
| 54 const int kHeaderID = kMaxID - 1; | 54 const int kHeaderID = kMaxID - 1; |
| 55 const int kTintsID = kMaxID - 2; | 55 const int kTintsID = kMaxID - 2; |
| 56 const int kColorsID = kMaxID - 3; | 56 const int kColorsID = kMaxID - 3; |
| (...skipping 1547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1604 false, | 1604 false, |
| 1605 &bitmap_data)) { | 1605 &bitmap_data)) { |
| 1606 NOTREACHED() << "Unable to encode theme image for prs_id=" | 1606 NOTREACHED() << "Unable to encode theme image for prs_id=" |
| 1607 << prs_id << " for scale_factor=" << scale_factors_[i]; | 1607 << prs_id << " for scale_factor=" << scale_factors_[i]; |
| 1608 break; | 1608 break; |
| 1609 } | 1609 } |
| 1610 image_memory_[scaled_raw_id] = | 1610 image_memory_[scaled_raw_id] = |
| 1611 base::RefCountedBytes::TakeVector(&bitmap_data); | 1611 base::RefCountedBytes::TakeVector(&bitmap_data); |
| 1612 } | 1612 } |
| 1613 } | 1613 } |
| OLD | NEW |