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

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

Issue 11644057: Move BrowserAction out of Extension (Closed) Base URL: http://git.chromium.org/chromium/src.git@dc_ungoop_extension_action
Patch Set: Latest master for CQ Created 7 years, 10 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
« no previous file with comments | « chrome/common/extensions/extension.h ('k') | chrome/common/extensions/extension_file_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 898 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 909
910 if (page_action_info() && !page_action_info()->default_icon.empty()) { 910 if (page_action_info() && !page_action_info()->default_icon.empty()) {
911 for (ExtensionIconSet::IconMap::const_iterator iter = 911 for (ExtensionIconSet::IconMap::const_iterator iter =
912 page_action_info()->default_icon.map().begin(); 912 page_action_info()->default_icon.map().begin();
913 iter != page_action_info()->default_icon.map().end(); 913 iter != page_action_info()->default_icon.map().end();
914 ++iter) { 914 ++iter) {
915 image_paths.insert(FilePath::FromWStringHack(UTF8ToWide(iter->second))); 915 image_paths.insert(FilePath::FromWStringHack(UTF8ToWide(iter->second)));
916 } 916 }
917 } 917 }
918 918
919 if (browser_action_info() && !browser_action_info()->default_icon.empty()) { 919 const ActionInfo* browser_action = ActionInfo::GetBrowserActionInfo(this);
920 if (browser_action && !browser_action->default_icon.empty()) {
920 for (ExtensionIconSet::IconMap::const_iterator iter = 921 for (ExtensionIconSet::IconMap::const_iterator iter =
921 browser_action_info()->default_icon.map().begin(); 922 browser_action->default_icon.map().begin();
922 iter != browser_action_info()->default_icon.map().end(); 923 iter != browser_action->default_icon.map().end();
923 ++iter) { 924 ++iter) {
924 image_paths.insert(FilePath::FromWStringHack(UTF8ToWide(iter->second))); 925 image_paths.insert(FilePath::FromWStringHack(UTF8ToWide(iter->second)));
925 } 926 }
926 } 927 }
927 928
928 return image_paths; 929 return image_paths;
929 } 930 }
930 931
931 ExtensionResource Extension::GetIconResource( 932 ExtensionResource Extension::GetIconResource(
932 int size, ExtensionIconSet::MatchType match_type) const { 933 int size, ExtensionIconSet::MatchType match_type) const {
(...skipping 1441 matching lines...) Expand 10 before | Expand all | Expand 10 after
2374 2375
2375 bool Extension::LoadExtensionFeatures(APIPermissionSet* api_permissions, 2376 bool Extension::LoadExtensionFeatures(APIPermissionSet* api_permissions,
2376 string16* error) { 2377 string16* error) {
2377 if (manifest_->HasKey(keys::kConvertedFromUserScript)) 2378 if (manifest_->HasKey(keys::kConvertedFromUserScript))
2378 manifest_->GetBoolean(keys::kConvertedFromUserScript, 2379 manifest_->GetBoolean(keys::kConvertedFromUserScript,
2379 &converted_from_user_script_); 2380 &converted_from_user_script_);
2380 2381
2381 if (!LoadManifestHandlerFeatures(error) || 2382 if (!LoadManifestHandlerFeatures(error) ||
2382 !LoadContentScripts(error) || 2383 !LoadContentScripts(error) ||
2383 !LoadPageAction(error) || 2384 !LoadPageAction(error) ||
2384 !LoadBrowserAction(error) ||
2385 !LoadSystemIndicator(api_permissions, error) || 2385 !LoadSystemIndicator(api_permissions, error) ||
2386 !LoadIncognitoMode(error) || 2386 !LoadIncognitoMode(error) ||
2387 !LoadContentSecurityPolicy(error)) 2387 !LoadContentSecurityPolicy(error))
2388 return false; 2388 return false;
2389 2389
2390 return true; 2390 return true;
2391 } 2391 }
2392 2392
2393 bool Extension::LoadManifestHandlerFeatures(string16* error) { 2393 bool Extension::LoadManifestHandlerFeatures(string16* error) {
2394 std::vector<std::string> keys = ManifestHandler::GetKeys(); 2394 std::vector<std::string> keys = ManifestHandler::GetKeys();
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
2469 if (page_action_value) { 2469 if (page_action_value) {
2470 page_action_info_ = LoadExtensionActionInfoHelper( 2470 page_action_info_ = LoadExtensionActionInfoHelper(
2471 this, page_action_value, error); 2471 this, page_action_value, error);
2472 if (!page_action_info_.get()) 2472 if (!page_action_info_.get())
2473 return false; // Failed to parse page action definition. 2473 return false; // Failed to parse page action definition.
2474 } 2474 }
2475 2475
2476 return true; 2476 return true;
2477 } 2477 }
2478 2478
2479 bool Extension::LoadBrowserAction(string16* error) {
2480 if (!manifest_->HasKey(keys::kBrowserAction))
2481 return true;
2482 DictionaryValue* browser_action_value = NULL;
2483 if (!manifest_->GetDictionary(keys::kBrowserAction, &browser_action_value)) {
2484 *error = ASCIIToUTF16(errors::kInvalidBrowserAction);
2485 return false;
2486 }
2487
2488 browser_action_info_ = LoadExtensionActionInfoHelper(
2489 this, browser_action_value, error);
2490 if (!browser_action_info_.get())
2491 return false; // Failed to parse browser action definition.
2492 return true;
2493 }
2494
2495 bool Extension::LoadSystemIndicator(APIPermissionSet* api_permissions, 2479 bool Extension::LoadSystemIndicator(APIPermissionSet* api_permissions,
2496 string16* error) { 2480 string16* error) {
2497 if (!manifest_->HasKey(keys::kSystemIndicator)) { 2481 if (!manifest_->HasKey(keys::kSystemIndicator)) {
2498 // There was no manifest entry for the system indicator. 2482 // There was no manifest entry for the system indicator.
2499 return true; 2483 return true;
2500 } 2484 }
2501 2485
2502 DictionaryValue* system_indicator_value = NULL; 2486 DictionaryValue* system_indicator_value = NULL;
2503 if (!manifest_->GetDictionary(keys::kSystemIndicator, 2487 if (!manifest_->GetDictionary(keys::kSystemIndicator,
2504 &system_indicator_value)) { 2488 &system_indicator_value)) {
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
2973 2957
2974 return true; 2958 return true;
2975 } 2959 }
2976 2960
2977 bool Extension::HasMultipleUISurfaces() const { 2961 bool Extension::HasMultipleUISurfaces() const {
2978 int num_surfaces = 0; 2962 int num_surfaces = 0;
2979 2963
2980 if (page_action_info()) 2964 if (page_action_info())
2981 ++num_surfaces; 2965 ++num_surfaces;
2982 2966
2983 if (browser_action_info()) 2967 if (ActionInfo::GetBrowserActionInfo(this))
2984 ++num_surfaces; 2968 ++num_surfaces;
2985 2969
2986 if (is_app()) 2970 if (is_app())
2987 ++num_surfaces; 2971 ++num_surfaces;
2988 2972
2989 return num_surfaces > 1; 2973 return num_surfaces > 1;
2990 } 2974 }
2991 2975
2992 void Extension::OverrideLaunchUrl(const GURL& override_url) { 2976 void Extension::OverrideLaunchUrl(const GURL& override_url) {
2993 GURL new_url(override_url); 2977 GURL new_url(override_url);
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
3158 3142
3159 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( 3143 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo(
3160 const Extension* extension, 3144 const Extension* extension,
3161 const PermissionSet* permissions, 3145 const PermissionSet* permissions,
3162 Reason reason) 3146 Reason reason)
3163 : reason(reason), 3147 : reason(reason),
3164 extension(extension), 3148 extension(extension),
3165 permissions(permissions) {} 3149 permissions(permissions) {}
3166 3150
3167 } // namespace extensions 3151 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension.h ('k') | chrome/common/extensions/extension_file_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698