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

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

Issue 11361189: Initial skeleton for System Indicator API (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase; Make system_indicator manifest entry grant systemIndicator permission. Created 8 years, 1 month 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 2168 matching lines...) Expand 10 before | Expand all | Expand 10 after
2179 if (!LoadFileHandler(*iter, *handler, error)) 2179 if (!LoadFileHandler(*iter, *handler, error))
2180 return false; 2180 return false;
2181 } else { 2181 } else {
2182 *error = ASCIIToUTF16(errors::kInvalidFileHandlers); 2182 *error = ASCIIToUTF16(errors::kInvalidFileHandlers);
2183 return false; 2183 return false;
2184 } 2184 }
2185 } 2185 }
2186 return true; 2186 return true;
2187 } 2187 }
2188 2188
2189 bool Extension::LoadExtensionFeatures(const APIPermissionSet& api_permissions, 2189 bool Extension::LoadExtensionFeatures(APIPermissionSet& api_permissions,
2190 string16* error) { 2190 string16* error) {
2191 if (manifest_->HasKey(keys::kConvertedFromUserScript)) 2191 if (manifest_->HasKey(keys::kConvertedFromUserScript))
2192 manifest_->GetBoolean(keys::kConvertedFromUserScript, 2192 manifest_->GetBoolean(keys::kConvertedFromUserScript,
2193 &converted_from_user_script_); 2193 &converted_from_user_script_);
2194 2194
2195 if (!LoadDevToolsPage(error) || 2195 if (!LoadDevToolsPage(error) ||
2196 !LoadInputComponents(api_permissions, error) || 2196 !LoadInputComponents(api_permissions, error) ||
2197 !LoadContentScripts(error) || 2197 !LoadContentScripts(error) ||
2198 !LoadPageAction(error) || 2198 !LoadPageAction(error) ||
2199 !LoadBrowserAction(error) || 2199 !LoadBrowserAction(error) ||
2200 !LoadSystemIndicator(api_permissions, error) ||
2200 !LoadScriptBadge(error) || 2201 !LoadScriptBadge(error) ||
2201 !LoadFileBrowserHandlers(error) || 2202 !LoadFileBrowserHandlers(error) ||
2202 !LoadChromeURLOverrides(error) || 2203 !LoadChromeURLOverrides(error) ||
2203 !LoadOmnibox(error) || 2204 !LoadOmnibox(error) ||
2204 !LoadTextToSpeechVoices(error) || 2205 !LoadTextToSpeechVoices(error) ||
2205 !LoadIncognitoMode(error) || 2206 !LoadIncognitoMode(error) ||
2206 !LoadFileHandlers(error) || 2207 !LoadFileHandlers(error) ||
2207 !LoadContentSecurityPolicy(error)) 2208 !LoadContentSecurityPolicy(error))
2208 return false; 2209 return false;
2209 2210
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
2436 return false; 2437 return false;
2437 } 2438 }
2438 2439
2439 browser_action_info_ = LoadExtensionActionInfoHelper( 2440 browser_action_info_ = LoadExtensionActionInfoHelper(
2440 browser_action_value, Extension::ActionInfo::TYPE_BROWSER, error); 2441 browser_action_value, Extension::ActionInfo::TYPE_BROWSER, error);
2441 if (!browser_action_info_.get()) 2442 if (!browser_action_info_.get())
2442 return false; // Failed to parse browser action definition. 2443 return false; // Failed to parse browser action definition.
2443 return true; 2444 return true;
2444 } 2445 }
2445 2446
2447 bool Extension::LoadSystemIndicator(APIPermissionSet& api_permissions,
2448 string16* error) {
2449 if (!manifest_->HasKey(keys::kSystemIndicator)) {
2450 return true;
2451 }
2452
2453 DictionaryValue* system_indicator_value = NULL;
2454 if (!manifest_->GetDictionary(keys::kSystemIndicator,
2455 &system_indicator_value)) {
2456 *error = ASCIIToUTF16(errors::kInvalidSystemIndicator);
2457 return false;
2458 }
2459
2460 // Because the manifest was successfully parsed, auto-grant the permission.
2461 api_permissions.insert(APIPermission::kSystemIndicator);
not at google - send to devlin 2012/11/20 23:58:08 I like this idea. We should make it happen for all
dewittj 2012/11/21 22:09:41 Will add to the rest of the _actions in a separate
not at google - send to devlin 2012/11/21 23:39:23 Ok. The status of the Feature system is partially
2462
2463 // TODO(dewittj) Parse browser action section.
2464 return true;
not at google - send to devlin 2012/11/20 23:58:08 Why not just implement it now?
dewittj 2012/11/21 22:09:41 I still have doubts about what the final format wi
not at google - send to devlin 2012/11/21 23:39:23 Yep sounds good, but I hope that any improvements
2465 }
2466
2446 bool Extension::LoadScriptBadge(string16* error) { 2467 bool Extension::LoadScriptBadge(string16* error) {
2447 if (manifest_->HasKey(keys::kScriptBadge)) { 2468 if (manifest_->HasKey(keys::kScriptBadge)) {
2448 if (!FeatureSwitch::script_badges()->IsEnabled()) { 2469 if (!FeatureSwitch::script_badges()->IsEnabled()) {
2449 // So as to not confuse developers if they specify a script badge section 2470 // So as to not confuse developers if they specify a script badge section
2450 // in the manifest, show a warning if the script badge declaration isn't 2471 // in the manifest, show a warning if the script badge declaration isn't
2451 // going to have any effect. 2472 // going to have any effect.
2452 install_warnings_.push_back( 2473 install_warnings_.push_back(
2453 InstallWarning(InstallWarning::FORMAT_TEXT, 2474 InstallWarning(InstallWarning::FORMAT_TEXT,
2454 errors::kScriptBadgeRequiresFlag)); 2475 errors::kScriptBadgeRequiresFlag));
2455 } 2476 }
(...skipping 1639 matching lines...) Expand 10 before | Expand all | Expand 10 after
4095 4116
4096 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( 4117 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo(
4097 const Extension* extension, 4118 const Extension* extension,
4098 const PermissionSet* permissions, 4119 const PermissionSet* permissions,
4099 Reason reason) 4120 Reason reason)
4100 : reason(reason), 4121 : reason(reason),
4101 extension(extension), 4122 extension(extension),
4102 permissions(permissions) {} 4123 permissions(permissions) {}
4103 4124
4104 } // namespace extensions 4125 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698