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 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1089 | 1089 |
1090 void BrowserThemePack::ParseImageNamesFromJSON( | 1090 void BrowserThemePack::ParseImageNamesFromJSON( |
1091 const base::DictionaryValue* images_value, | 1091 const base::DictionaryValue* images_value, |
1092 const base::FilePath& images_path, | 1092 const base::FilePath& images_path, |
1093 FilePathMap* file_paths) const { | 1093 FilePathMap* file_paths) const { |
1094 if (!images_value) | 1094 if (!images_value) |
1095 return; | 1095 return; |
1096 | 1096 |
1097 for (base::DictionaryValue::Iterator iter(*images_value); !iter.IsAtEnd(); | 1097 for (base::DictionaryValue::Iterator iter(*images_value); !iter.IsAtEnd(); |
1098 iter.Advance()) { | 1098 iter.Advance()) { |
1099 if (iter.value().IsType(base::Value::TYPE_DICTIONARY)) { | 1099 if (iter.value().IsType(base::Value::Type::DICTIONARY)) { |
1100 const base::DictionaryValue* inner_value = NULL; | 1100 const base::DictionaryValue* inner_value = NULL; |
1101 if (iter.value().GetAsDictionary(&inner_value)) { | 1101 if (iter.value().GetAsDictionary(&inner_value)) { |
1102 for (base::DictionaryValue::Iterator inner_iter(*inner_value); | 1102 for (base::DictionaryValue::Iterator inner_iter(*inner_value); |
1103 !inner_iter.IsAtEnd(); | 1103 !inner_iter.IsAtEnd(); |
1104 inner_iter.Advance()) { | 1104 inner_iter.Advance()) { |
1105 std::string name; | 1105 std::string name; |
1106 ui::ScaleFactor scale_factor = ui::SCALE_FACTOR_NONE; | 1106 ui::ScaleFactor scale_factor = ui::SCALE_FACTOR_NONE; |
1107 if (GetScaleFactorFromManifestKey(inner_iter.key(), &scale_factor) && | 1107 if (GetScaleFactorFromManifestKey(inner_iter.key(), &scale_factor) && |
1108 inner_iter.value().IsType(base::Value::TYPE_STRING) && | 1108 inner_iter.value().IsType(base::Value::Type::STRING) && |
1109 inner_iter.value().GetAsString(&name)) { | 1109 inner_iter.value().GetAsString(&name)) { |
1110 AddFileAtScaleToMap(iter.key(), | 1110 AddFileAtScaleToMap(iter.key(), |
1111 scale_factor, | 1111 scale_factor, |
1112 images_path.AppendASCII(name), | 1112 images_path.AppendASCII(name), |
1113 file_paths); | 1113 file_paths); |
1114 } | 1114 } |
1115 } | 1115 } |
1116 } | 1116 } |
1117 } else if (iter.value().IsType(base::Value::TYPE_STRING)) { | 1117 } else if (iter.value().IsType(base::Value::Type::STRING)) { |
1118 std::string name; | 1118 std::string name; |
1119 if (iter.value().GetAsString(&name)) { | 1119 if (iter.value().GetAsString(&name)) { |
1120 AddFileAtScaleToMap(iter.key(), | 1120 AddFileAtScaleToMap(iter.key(), |
1121 ui::SCALE_FACTOR_100P, | 1121 ui::SCALE_FACTOR_100P, |
1122 images_path.AppendASCII(name), | 1122 images_path.AppendASCII(name), |
1123 file_paths); | 1123 file_paths); |
1124 } | 1124 } |
1125 } | 1125 } |
1126 } | 1126 } |
1127 } | 1127 } |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1476 false, | 1476 false, |
1477 &bitmap_data)) { | 1477 &bitmap_data)) { |
1478 NOTREACHED() << "Unable to encode theme image for prs_id=" | 1478 NOTREACHED() << "Unable to encode theme image for prs_id=" |
1479 << prs_id << " for scale_factor=" << scale_factors_[i]; | 1479 << prs_id << " for scale_factor=" << scale_factors_[i]; |
1480 break; | 1480 break; |
1481 } | 1481 } |
1482 image_memory_[scaled_raw_id] = | 1482 image_memory_[scaled_raw_id] = |
1483 base::RefCountedBytes::TakeVector(&bitmap_data); | 1483 base::RefCountedBytes::TakeVector(&bitmap_data); |
1484 } | 1484 } |
1485 } | 1485 } |
OLD | NEW |