| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/common/extensions/extension.h" | 5 #include "chrome/common/extensions/extension.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1486 ListValue* color_list; | 1486 ListValue* color_list; |
| 1487 double alpha; | 1487 double alpha; |
| 1488 int alpha_int; | 1488 int alpha_int; |
| 1489 int color; | 1489 int color; |
| 1490 // The color must be a list | 1490 // The color must be a list |
| 1491 if (!colors_value->GetListWithoutPathExpansion(*iter, &color_list) || | 1491 if (!colors_value->GetListWithoutPathExpansion(*iter, &color_list) || |
| 1492 // And either 3 items (RGB) or 4 (RGBA) | 1492 // And either 3 items (RGB) or 4 (RGBA) |
| 1493 ((color_list->GetSize() != 3) && | 1493 ((color_list->GetSize() != 3) && |
| 1494 ((color_list->GetSize() != 4) || | 1494 ((color_list->GetSize() != 4) || |
| 1495 // For RGBA, the fourth item must be a real or int alpha value | 1495 // For RGBA, the fourth item must be a real or int alpha value |
| 1496 (!color_list->GetReal(3, &alpha) && | 1496 (!color_list->GetDouble(3, &alpha) && |
| 1497 !color_list->GetInteger(3, &alpha_int)))) || | 1497 !color_list->GetInteger(3, &alpha_int)))) || |
| 1498 // For both RGB and RGBA, the first three items must be ints (R,G,B) | 1498 // For both RGB and RGBA, the first three items must be ints (R,G,B) |
| 1499 !color_list->GetInteger(0, &color) || | 1499 !color_list->GetInteger(0, &color) || |
| 1500 !color_list->GetInteger(1, &color) || | 1500 !color_list->GetInteger(1, &color) || |
| 1501 !color_list->GetInteger(2, &color)) { | 1501 !color_list->GetInteger(2, &color)) { |
| 1502 *error = errors::kInvalidThemeColors; | 1502 *error = errors::kInvalidThemeColors; |
| 1503 return false; | 1503 return false; |
| 1504 } | 1504 } |
| 1505 } | 1505 } |
| 1506 theme_colors_.reset(colors_value->DeepCopy()); | 1506 theme_colors_.reset(colors_value->DeepCopy()); |
| 1507 } | 1507 } |
| 1508 | 1508 |
| 1509 DictionaryValue* tints_value; | 1509 DictionaryValue* tints_value; |
| 1510 if (theme_value->GetDictionary(keys::kThemeTints, &tints_value)) { | 1510 if (theme_value->GetDictionary(keys::kThemeTints, &tints_value)) { |
| 1511 // Validate that the tints are all reals. | 1511 // Validate that the tints are all reals. |
| 1512 for (DictionaryValue::key_iterator iter = tints_value->begin_keys(); | 1512 for (DictionaryValue::key_iterator iter = tints_value->begin_keys(); |
| 1513 iter != tints_value->end_keys(); ++iter) { | 1513 iter != tints_value->end_keys(); ++iter) { |
| 1514 ListValue* tint_list; | 1514 ListValue* tint_list; |
| 1515 double v; | 1515 double v; |
| 1516 int vi; | 1516 int vi; |
| 1517 if (!tints_value->GetListWithoutPathExpansion(*iter, &tint_list) || | 1517 if (!tints_value->GetListWithoutPathExpansion(*iter, &tint_list) || |
| 1518 tint_list->GetSize() != 3 || | 1518 tint_list->GetSize() != 3 || |
| 1519 !(tint_list->GetReal(0, &v) || tint_list->GetInteger(0, &vi)) || | 1519 !(tint_list->GetDouble(0, &v) || tint_list->GetInteger(0, &vi)) || |
| 1520 !(tint_list->GetReal(1, &v) || tint_list->GetInteger(1, &vi)) || | 1520 !(tint_list->GetDouble(1, &v) || tint_list->GetInteger(1, &vi)) || |
| 1521 !(tint_list->GetReal(2, &v) || tint_list->GetInteger(2, &vi))) { | 1521 !(tint_list->GetDouble(2, &v) || tint_list->GetInteger(2, &vi))) { |
| 1522 *error = errors::kInvalidThemeTints; | 1522 *error = errors::kInvalidThemeTints; |
| 1523 return false; | 1523 return false; |
| 1524 } | 1524 } |
| 1525 } | 1525 } |
| 1526 theme_tints_.reset(tints_value->DeepCopy()); | 1526 theme_tints_.reset(tints_value->DeepCopy()); |
| 1527 } | 1527 } |
| 1528 | 1528 |
| 1529 DictionaryValue* display_properties_value; | 1529 DictionaryValue* display_properties_value; |
| 1530 if (theme_value->GetDictionary(keys::kThemeDisplayProperties, | 1530 if (theme_value->GetDictionary(keys::kThemeDisplayProperties, |
| 1531 &display_properties_value)) { | 1531 &display_properties_value)) { |
| (...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2382 | 2382 |
| 2383 UninstalledExtensionInfo::~UninstalledExtensionInfo() {} | 2383 UninstalledExtensionInfo::~UninstalledExtensionInfo() {} |
| 2384 | 2384 |
| 2385 | 2385 |
| 2386 UnloadedExtensionInfo::UnloadedExtensionInfo( | 2386 UnloadedExtensionInfo::UnloadedExtensionInfo( |
| 2387 const Extension* extension, | 2387 const Extension* extension, |
| 2388 Reason reason) | 2388 Reason reason) |
| 2389 : reason(reason), | 2389 : reason(reason), |
| 2390 already_disabled(false), | 2390 already_disabled(false), |
| 2391 extension(extension) {} | 2391 extension(extension) {} |
| OLD | NEW |