Chromium Code Reviews| 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/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 1716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1727 return false; | 1727 return false; |
| 1728 } | 1728 } |
| 1729 } | 1729 } |
| 1730 | 1730 |
| 1731 plugins_.push_back(PluginInfo()); | 1731 plugins_.push_back(PluginInfo()); |
| 1732 plugins_.back().path = path().AppendASCII(path_str); | 1732 plugins_.back().path = path().AppendASCII(path_str); |
| 1733 plugins_.back().is_public = is_public; | 1733 plugins_.back().is_public = is_public; |
| 1734 } | 1734 } |
| 1735 } | 1735 } |
| 1736 | 1736 |
| 1737 if (CommandLine::ForCurrentProcess()->HasSwitch( | |
| 1738 switches::kEnableExperimentalExtensionApis) && | |
| 1739 source.HasKey(keys::kNaClModules)) { | |
| 1740 ListValue* list_value; | |
|
Aaron Boodman
2011/04/08 00:07:37
nit: initialize primitives
| |
| 1741 if (!source.GetList(keys::kNaClModules, &list_value)) { | |
| 1742 *error = errors::kInvalidNaClModules; | |
| 1743 return false; | |
| 1744 } | |
| 1745 | |
| 1746 for (size_t i = 0; i < list_value->GetSize(); ++i) { | |
| 1747 DictionaryValue* module_value; | |
| 1748 std::string path_str; | |
| 1749 std::string mime_type; | |
| 1750 | |
| 1751 if (!list_value->GetDictionary(i, &module_value)) { | |
| 1752 *error = errors::kInvalidNaClModules; | |
| 1753 return false; | |
| 1754 } | |
| 1755 | |
| 1756 // Get nacl_modules[i].path. | |
| 1757 if (!module_value->GetString(keys::kNaClModulesPath, &path_str)) { | |
| 1758 *error = ExtensionErrorUtils::FormatErrorMessage( | |
| 1759 errors::kInvalidNaClModulesPath, base::IntToString(i)); | |
| 1760 return false; | |
| 1761 } | |
| 1762 | |
| 1763 // Get nacl_modules[i].mime_type. | |
| 1764 if (!module_value->GetString(keys::kNaClModulesMIMEType, &mime_type)) { | |
| 1765 *error = ExtensionErrorUtils::FormatErrorMessage( | |
| 1766 errors::kInvalidNaClModulesMIMEType, base::IntToString(i)); | |
| 1767 return false; | |
| 1768 } | |
| 1769 | |
| 1770 nacl_modules_.push_back(NaClModuleInfo()); | |
| 1771 nacl_modules_.back().path = path().AppendASCII(path_str); | |
| 1772 nacl_modules_.back().mime_type = mime_type; | |
| 1773 } | |
| 1774 } | |
| 1775 | |
| 1737 // Initialize background url (optional). | 1776 // Initialize background url (optional). |
| 1738 if (source.HasKey(keys::kBackground)) { | 1777 if (source.HasKey(keys::kBackground)) { |
| 1739 std::string background_str; | 1778 std::string background_str; |
| 1740 if (!source.GetString(keys::kBackground, &background_str)) { | 1779 if (!source.GetString(keys::kBackground, &background_str)) { |
| 1741 *error = errors::kInvalidBackground; | 1780 *error = errors::kInvalidBackground; |
| 1742 return false; | 1781 return false; |
| 1743 } | 1782 } |
| 1744 background_url_ = GetResourceURL(background_str); | 1783 background_url_ = GetResourceURL(background_str); |
| 1745 } | 1784 } |
| 1746 | 1785 |
| (...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2594 | 2633 |
| 2595 UninstalledExtensionInfo::~UninstalledExtensionInfo() {} | 2634 UninstalledExtensionInfo::~UninstalledExtensionInfo() {} |
| 2596 | 2635 |
| 2597 | 2636 |
| 2598 UnloadedExtensionInfo::UnloadedExtensionInfo( | 2637 UnloadedExtensionInfo::UnloadedExtensionInfo( |
| 2599 const Extension* extension, | 2638 const Extension* extension, |
| 2600 Reason reason) | 2639 Reason reason) |
| 2601 : reason(reason), | 2640 : reason(reason), |
| 2602 already_disabled(false), | 2641 already_disabled(false), |
| 2603 extension(extension) {} | 2642 extension(extension) {} |
| OLD | NEW |