| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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> | |
| 8 | |
| 9 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 10 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 11 #include "base/threading/thread_restrictions.h" | 9 #include "base/threading/thread_restrictions.h" |
| 12 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 13 #include "base/values.h" | 11 #include "base/values.h" |
| 14 #include "chrome/browser/themes/theme_service.h" | 12 #include "chrome/browser/themes/theme_service.h" |
| 15 #include "content/browser/browser_thread.h" | 13 #include "content/browser/browser_thread.h" |
| 16 #include "grit/theme_resources.h" | 14 #include "grit/theme_resources.h" |
| 17 #include "grit/theme_resources_standard.h" | 15 #include "grit/theme_resources_standard.h" |
| 18 #include "grit/ui_resources.h" | 16 #include "grit/ui_resources.h" |
| 19 #include "net/base/file_stream.h" | 17 #include "net/base/file_stream.h" |
| 20 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
| 21 #include "third_party/skia/include/core/SkCanvas.h" | 19 #include "third_party/skia/include/core/SkCanvas.h" |
| 22 #include "ui/base/resource/data_pack.h" | 20 #include "ui/base/resource/data_pack.h" |
| 23 #include "ui/base/resource/resource_bundle.h" | 21 #include "ui/base/resource/resource_bundle.h" |
| 24 #include "ui/gfx/codec/png_codec.h" | 22 #include "ui/gfx/codec/png_codec.h" |
| 25 #include "ui/gfx/image/image.h" | 23 #include "ui/gfx/image/image.h" |
| 26 #include "ui/gfx/skbitmap_operations.h" | 24 #include "ui/gfx/skbitmap_operations.h" |
| 27 | 25 |
| 28 namespace { | 26 namespace { |
| 29 | 27 |
| 30 // Version number of the current theme pack. We just throw out and rebuild | 28 // Version number of the current theme pack. We just throw out and rebuild |
| 31 // theme packs that aren't int-equal to this. | 29 // theme packs that aren't int-equal to this. |
| 32 const int kThemePackVersion = 16; | 30 const int kThemePackVersion = 15; |
| 33 | 31 |
| 34 // IDs that are in the DataPack won't clash with the positive integer | 32 // IDs that are in the DataPack won't clash with the positive integer |
| 35 // uint16. kHeaderID should always have the maximum value because we want the | 33 // int32_t. kHeaderID should always have the maximum value because we want the |
| 36 // "header" to be written last. That way we can detect whether the pack was | 34 // "header" to be written last. That way we can detect whether the pack was |
| 37 // successfully written and ignore and regenerate if it was only partially | 35 // successfully written and ignore and regenerate if it was only partially |
| 38 // written (i.e. chrome crashed on a different thread while writing the pack). | 36 // written (i.e. chrome crashed on a different thread while writing the pack). |
| 39 const int kHeaderID = std::numeric_limits<uint16>::max() - 1; | 37 const int kHeaderID = UINT_MAX - 1; |
| 40 const int kTintsID = std::numeric_limits<uint16>::max() - 2; | 38 const int kTintsID = UINT_MAX - 2; |
| 41 const int kColorsID = std::numeric_limits<uint16>::max() - 3; | 39 const int kColorsID = UINT_MAX - 3; |
| 42 const int kDisplayPropertiesID = std::numeric_limits<uint16>::max() - 4; | 40 const int kDisplayPropertiesID = UINT_MAX - 4; |
| 43 const int kSourceImagesID = std::numeric_limits<uint16>::max() - 5; | 41 const int kSourceImagesID = UINT_MAX - 5; |
| 44 | 42 |
| 45 // Static size of the tint/color/display property arrays that are mmapped. | 43 // Static size of the tint/color/display property arrays that are mmapped. |
| 46 const int kTintArraySize = 6; | 44 const int kTintArraySize = 6; |
| 47 const int kColorArraySize = 19; | 45 const int kColorArraySize = 19; |
| 48 const int kDisplayPropertySize = 3; | 46 const int kDisplayPropertySize = 3; |
| 49 | 47 |
| 50 // The sum of kFrameBorderThickness and kNonClientRestoredExtraThickness from | 48 // The sum of kFrameBorderThickness and kNonClientRestoredExtraThickness from |
| 51 // OpaqueBrowserFrameView. | 49 // OpaqueBrowserFrameView. |
| 52 const int kRestoredTabVerticalOffset = 15; | 50 const int kRestoredTabVerticalOffset = 15; |
| 53 | 51 |
| (...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1059 hsl.h = tints_[i].h; | 1057 hsl.h = tints_[i].h; |
| 1060 hsl.s = tints_[i].s; | 1058 hsl.s = tints_[i].s; |
| 1061 hsl.l = tints_[i].l; | 1059 hsl.l = tints_[i].l; |
| 1062 return hsl; | 1060 return hsl; |
| 1063 } | 1061 } |
| 1064 } | 1062 } |
| 1065 } | 1063 } |
| 1066 | 1064 |
| 1067 return ThemeService::GetDefaultTint(id); | 1065 return ThemeService::GetDefaultTint(id); |
| 1068 } | 1066 } |
| OLD | NEW |