Chromium Code Reviews| 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/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 535 } | 535 } |
| 536 | 536 |
| 537 DictionaryValue* colors_value; | 537 DictionaryValue* colors_value; |
| 538 if (theme_value->GetDictionary(kThemeColorsKey, &colors_value)) { | 538 if (theme_value->GetDictionary(kThemeColorsKey, &colors_value)) { |
| 539 // Validate that the colors are all three-item lists | 539 // Validate that the colors are all three-item lists |
| 540 DictionaryValue::key_iterator iter = colors_value->begin_keys(); | 540 DictionaryValue::key_iterator iter = colors_value->begin_keys(); |
| 541 while (iter != colors_value->end_keys()) { | 541 while (iter != colors_value->end_keys()) { |
| 542 std::string val; | 542 std::string val; |
| 543 int color = 0; | 543 int color = 0; |
| 544 ListValue* color_list; | 544 ListValue* color_list; |
| 545 if (!colors_value->GetList(*iter, &color_list) || | 545 if (colors_value->GetList(*iter, &color_list)) { |
| 546 color_list->GetSize() != 3 || | 546 if (color_list->GetSize() == 3 || |
|
Ben Goodger (Google)
2009/06/03 18:03:57
btw, this function has become so long its stupid.
| |
| 547 !color_list->GetInteger(0, &color) || | 547 color_list->GetSize() == 4) { |
| 548 !color_list->GetInteger(1, &color) || | 548 if (color_list->GetInteger(0, &color) && |
| 549 !color_list->GetInteger(2, &color)) { | 549 color_list->GetInteger(1, &color) && |
| 550 *error = kInvalidThemeColorsError; | 550 color_list->GetInteger(2, &color)) { |
| 551 return false; | 551 if (color_list->GetSize() == 4) { |
| 552 double alpha; | |
| 553 if (color_list->GetReal(3, &alpha)) { | |
| 554 ++iter; | |
| 555 continue; | |
| 556 } | |
| 557 } else { | |
| 558 ++iter; | |
| 559 continue; | |
| 560 } | |
| 561 } | |
| 562 } | |
| 552 } | 563 } |
| 564 *error = kInvalidThemeColorsError; | |
| 565 return false; | |
| 553 ++iter; | 566 ++iter; |
| 554 } | 567 } |
| 555 theme_colors_.reset( | 568 theme_colors_.reset( |
| 556 static_cast<DictionaryValue*>(colors_value->DeepCopy())); | 569 static_cast<DictionaryValue*>(colors_value->DeepCopy())); |
| 557 } | 570 } |
| 558 | 571 |
| 559 DictionaryValue* tints_value; | 572 DictionaryValue* tints_value; |
| 560 if (theme_value->GetDictionary(kThemeTintsKey, &tints_value)) { | 573 if (theme_value->GetDictionary(kThemeTintsKey, &tints_value)) { |
| 561 // Validate that the tints are all reals. | 574 // Validate that the tints are all reals. |
| 562 DictionaryValue::key_iterator iter = tints_value->begin_keys(); | 575 DictionaryValue::key_iterator iter = tints_value->begin_keys(); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 703 kInvalidPermissionSchemeError, IntToString(i)); | 716 kInvalidPermissionSchemeError, IntToString(i)); |
| 704 return false; | 717 return false; |
| 705 } | 718 } |
| 706 | 719 |
| 707 permissions_.push_back(pattern); | 720 permissions_.push_back(pattern); |
| 708 } | 721 } |
| 709 } | 722 } |
| 710 | 723 |
| 711 return true; | 724 return true; |
| 712 } | 725 } |
| OLD | NEW |