| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 int color = 0; | 630 int color = 0; |
| 631 ListValue* color_list; | 631 ListValue* color_list; |
| 632 if (colors_value->GetList(*iter, &color_list)) { | 632 if (colors_value->GetList(*iter, &color_list)) { |
| 633 if (color_list->GetSize() == 3 || | 633 if (color_list->GetSize() == 3 || |
| 634 color_list->GetSize() == 4) { | 634 color_list->GetSize() == 4) { |
| 635 if (color_list->GetInteger(0, &color) && | 635 if (color_list->GetInteger(0, &color) && |
| 636 color_list->GetInteger(1, &color) && | 636 color_list->GetInteger(1, &color) && |
| 637 color_list->GetInteger(2, &color)) { | 637 color_list->GetInteger(2, &color)) { |
| 638 if (color_list->GetSize() == 4) { | 638 if (color_list->GetSize() == 4) { |
| 639 double alpha; | 639 double alpha; |
| 640 if (color_list->GetReal(3, &alpha)) { | 640 int alpha_int; |
| 641 if (color_list->GetReal(3, &alpha) || |
| 642 color_list->GetInteger(3, &alpha_int)) { |
| 641 ++iter; | 643 ++iter; |
| 642 continue; | 644 continue; |
| 643 } | 645 } |
| 644 } else { | 646 } else { |
| 645 ++iter; | 647 ++iter; |
| 646 continue; | 648 continue; |
| 647 } | 649 } |
| 648 } | 650 } |
| 649 } | 651 } |
| 650 } | 652 } |
| 651 *error = errors::kInvalidThemeColors; | 653 *error = errors::kInvalidThemeColors; |
| 652 return false; | 654 return false; |
| 653 ++iter; | 655 ++iter; |
| 654 } | 656 } |
| 655 theme_colors_.reset( | 657 theme_colors_.reset( |
| 656 static_cast<DictionaryValue*>(colors_value->DeepCopy())); | 658 static_cast<DictionaryValue*>(colors_value->DeepCopy())); |
| 657 } | 659 } |
| 658 | 660 |
| 659 DictionaryValue* tints_value; | 661 DictionaryValue* tints_value; |
| 660 if (theme_value->GetDictionary(keys::kThemeTints, &tints_value)) { | 662 if (theme_value->GetDictionary(keys::kThemeTints, &tints_value)) { |
| 661 // Validate that the tints are all reals. | 663 // Validate that the tints are all reals. |
| 662 DictionaryValue::key_iterator iter = tints_value->begin_keys(); | 664 DictionaryValue::key_iterator iter = tints_value->begin_keys(); |
| 663 while (iter != tints_value->end_keys()) { | 665 while (iter != tints_value->end_keys()) { |
| 664 ListValue* tint_list; | 666 ListValue* tint_list; |
| 665 double hue = 0; | 667 double v = 0; |
| 668 int vi = 0; |
| 666 if (!tints_value->GetList(*iter, &tint_list) || | 669 if (!tints_value->GetList(*iter, &tint_list) || |
| 667 tint_list->GetSize() != 3 || | 670 tint_list->GetSize() != 3 || |
| 668 !tint_list->GetReal(0, &hue) || | 671 !(tint_list->GetReal(0, &v) || tint_list->GetInteger(0, &vi)) || |
| 669 !tint_list->GetReal(1, &hue) || | 672 !(tint_list->GetReal(1, &v) || tint_list->GetInteger(1, &vi)) || |
| 670 !tint_list->GetReal(2, &hue)) { | 673 !(tint_list->GetReal(2, &v) || tint_list->GetInteger(2, &vi))) { |
| 671 *error = errors::kInvalidThemeTints; | 674 *error = errors::kInvalidThemeTints; |
| 672 return false; | 675 return false; |
| 673 } | 676 } |
| 674 ++iter; | 677 ++iter; |
| 675 } | 678 } |
| 676 theme_tints_.reset( | 679 theme_tints_.reset( |
| 677 static_cast<DictionaryValue*>(tints_value->DeepCopy())); | 680 static_cast<DictionaryValue*>(tints_value->DeepCopy())); |
| 678 } | 681 } |
| 679 | 682 |
| 680 DictionaryValue* display_properties_value; | 683 DictionaryValue* display_properties_value; |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 874 it != page_actions().end(); ++it) { | 877 it != page_actions().end(); ++it) { |
| 875 const std::vector<FilePath>& icon_paths = it->second->icon_paths(); | 878 const std::vector<FilePath>& icon_paths = it->second->icon_paths(); |
| 876 for (std::vector<FilePath>::const_iterator iter = icon_paths.begin(); | 879 for (std::vector<FilePath>::const_iterator iter = icon_paths.begin(); |
| 877 iter != icon_paths.end(); ++iter) { | 880 iter != icon_paths.end(); ++iter) { |
| 878 image_paths.insert(*iter); | 881 image_paths.insert(*iter); |
| 879 } | 882 } |
| 880 } | 883 } |
| 881 | 884 |
| 882 return image_paths; | 885 return image_paths; |
| 883 } | 886 } |
| OLD | NEW |