Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Side by Side Diff: chrome/common/extensions/extension.cc

Issue 11624036: Move the parsing of homepage_url" and "devtools_page" out of Extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/common/extensions/extension.h" 5 #include "chrome/common/extensions/extension.h"
6 6
7 #include <ostream> 7 #include <ostream>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 1569 matching lines...) Expand 10 before | Expand all | Expand 10 after
1580 return false; 1580 return false;
1581 1581
1582 if (!LoadThemeFeatures(error)) 1582 if (!LoadThemeFeatures(error))
1583 return false; 1583 return false;
1584 1584
1585 if (HasMultipleUISurfaces()) { 1585 if (HasMultipleUISurfaces()) {
1586 *error = ASCIIToUTF16(errors::kOneUISurfaceOnly); 1586 *error = ASCIIToUTF16(errors::kOneUISurfaceOnly);
1587 return false; 1587 return false;
1588 } 1588 }
1589 1589
1590 finished_parsing_manifest_ = true;
1591
1590 runtime_data_.SetActivePermissions(new PermissionSet( 1592 runtime_data_.SetActivePermissions(new PermissionSet(
1591 this, api_permissions, host_permissions)); 1593 this, api_permissions, host_permissions));
1592 required_permission_set_ = new PermissionSet( 1594 required_permission_set_ = new PermissionSet(
1593 this, api_permissions, host_permissions); 1595 this, api_permissions, host_permissions);
1594 optional_permission_set_ = new PermissionSet( 1596 optional_permission_set_ = new PermissionSet(
1595 optional_api_permissions, optional_host_permissions, URLPatternSet()); 1597 optional_api_permissions, optional_host_permissions, URLPatternSet());
1596 1598
1597 finished_parsing_manifest_ = true;
1598
1599 return true; 1599 return true;
1600 } 1600 }
1601 1601
1602 bool Extension::LoadAppIsolation(const APIPermissionSet& api_permissions, 1602 bool Extension::LoadAppIsolation(const APIPermissionSet& api_permissions,
1603 string16* error) { 1603 string16* error) {
1604 // Platform apps always get isolated storage. 1604 // Platform apps always get isolated storage.
1605 if (is_platform_app()) { 1605 if (is_platform_app()) {
1606 is_storage_isolated_ = true; 1606 is_storage_isolated_ = true;
1607 return true; 1607 return true;
1608 } 1608 }
(...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after
2784 return true; 2784 return true;
2785 } 2785 }
2786 2786
2787 bool Extension::LoadExtensionFeatures(APIPermissionSet* api_permissions, 2787 bool Extension::LoadExtensionFeatures(APIPermissionSet* api_permissions,
2788 string16* error) { 2788 string16* error) {
2789 if (manifest_->HasKey(keys::kConvertedFromUserScript)) 2789 if (manifest_->HasKey(keys::kConvertedFromUserScript))
2790 manifest_->GetBoolean(keys::kConvertedFromUserScript, 2790 manifest_->GetBoolean(keys::kConvertedFromUserScript,
2791 &converted_from_user_script_); 2791 &converted_from_user_script_);
2792 2792
2793 if (!LoadManifestHandlerFeatures(error) || 2793 if (!LoadManifestHandlerFeatures(error) ||
2794 !LoadDevToolsPage(error) ||
2795 !LoadInputComponents(*api_permissions, error) || 2794 !LoadInputComponents(*api_permissions, error) ||
2796 !LoadContentScripts(error) || 2795 !LoadContentScripts(error) ||
2797 !LoadPageAction(error) || 2796 !LoadPageAction(error) ||
2798 !LoadBrowserAction(error) || 2797 !LoadBrowserAction(error) ||
2799 !LoadSystemIndicator(api_permissions, error) || 2798 !LoadSystemIndicator(api_permissions, error) ||
2800 !LoadScriptBadge(error) || 2799 !LoadScriptBadge(error) ||
2801 !LoadFileBrowserHandlers(error) || 2800 !LoadFileBrowserHandlers(error) ||
2802 !LoadChromeURLOverrides(error) || 2801 !LoadChromeURLOverrides(error) ||
2803 !LoadTextToSpeechVoices(error) || 2802 !LoadTextToSpeechVoices(error) ||
2804 !LoadIncognitoMode(error) || 2803 !LoadIncognitoMode(error) ||
2805 !LoadFileHandlers(error) || 2804 !LoadFileHandlers(error) ||
2806 !LoadContentSecurityPolicy(error)) 2805 !LoadContentSecurityPolicy(error))
2807 return false; 2806 return false;
2808 2807
2809 return true; 2808 return true;
2810 } 2809 }
2811 2810
2812 bool Extension::LoadManifestHandlerFeatures(string16* error) { 2811 bool Extension::LoadManifestHandlerFeatures(string16* error) {
2813 std::vector<std::string> keys = ManifestHandler::GetKeys(); 2812 std::vector<std::string> keys = ManifestHandler::GetKeys();
2814 for (size_t i = 0; i < keys.size(); ++i) { 2813 for (size_t i = 0; i < keys.size(); ++i) {
2815 Value* value = NULL; 2814 Value* value = NULL;
2816 if (!manifest_->Get(keys[i], &value)) 2815 if (!manifest_->Get(keys[i], &value))
2817 continue; 2816 continue;
2818 if (!ManifestHandler::Get(keys[i])->Parse(value, this, error)) 2817 if (!ManifestHandler::Get(keys[i])->Parse(value, this, error))
2819 return false; 2818 return false;
2820 } 2819 }
2821 return true; 2820 return true;
2822 } 2821 }
2823 2822
2824 bool Extension::LoadDevToolsPage(string16* error) {
2825 if (!manifest_->HasKey(keys::kDevToolsPage))
2826 return true;
2827 std::string devtools_str;
2828 if (!manifest_->GetString(keys::kDevToolsPage, &devtools_str)) {
2829 *error = ASCIIToUTF16(errors::kInvalidDevToolsPage);
2830 return false;
2831 }
2832 devtools_url_ = GetResourceURL(devtools_str);
2833 return true;
2834 }
2835
2836 bool Extension::LoadInputComponents(const APIPermissionSet& api_permissions, 2823 bool Extension::LoadInputComponents(const APIPermissionSet& api_permissions,
2837 string16* error) { 2824 string16* error) {
2838 if (!manifest_->HasKey(keys::kInputComponents)) 2825 if (!manifest_->HasKey(keys::kInputComponents))
2839 return true; 2826 return true;
2840 ListValue* list_value = NULL; 2827 ListValue* list_value = NULL;
2841 if (!manifest_->GetList(keys::kInputComponents, &list_value)) { 2828 if (!manifest_->GetList(keys::kInputComponents, &list_value)) {
2842 *error = ASCIIToUTF16(errors::kInvalidInputComponents); 2829 *error = ASCIIToUTF16(errors::kInvalidInputComponents);
2843 return false; 2830 return false;
2844 } 2831 }
2845 2832
(...skipping 1378 matching lines...) Expand 10 before | Expand all | Expand 10 after
4224 4211
4225 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( 4212 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo(
4226 const Extension* extension, 4213 const Extension* extension,
4227 const PermissionSet* permissions, 4214 const PermissionSet* permissions,
4228 Reason reason) 4215 Reason reason)
4229 : reason(reason), 4216 : reason(reason),
4230 extension(extension), 4217 extension(extension),
4231 permissions(permissions) {} 4218 permissions(permissions) {}
4232 4219
4233 } // namespace extensions 4220 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698