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

Unified Diff: chrome/common/extensions/api/extension_api.cc

Issue 8806025: Whitelist experimental.storage as an unprivileged extension API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/common/extensions/api/extension_api.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/api/extension_api.cc
diff --git a/chrome/common/extensions/api/extension_api.cc b/chrome/common/extensions/api/extension_api.cc
index ba81b64b6dbfa534400d500397250df995434c75..c75fb6014f83a30c969db656c1880a56c6c9998e 100644
--- a/chrome/common/extensions/api/extension_api.cc
+++ b/chrome/common/extensions/api/extension_api.cc
@@ -43,13 +43,20 @@ ExtensionAPI::~ExtensionAPI() {
}
bool ExtensionAPI::IsPrivileged(const std::string& full_name) const {
- std::vector<std::string> name_space;
- base::SplitString(full_name, '.', &name_space);
- std::string name = name_space.back();
- name_space.pop_back();
+ std::vector<std::string> split_full_name;
+ base::SplitString(full_name, '.', &split_full_name);
+ std::string name = split_full_name.back();
+ split_full_name.pop_back();
+ std::string name_space = JoinString(split_full_name, '.');
+
+ // HACK(kalman): explicitly mark all Storage API methods as unprivileged.
+ // TODO(kalman): solve this in a more general way; the problem is that
+ // functions-on-properties are not found with the following algorithm.
+ if (name_space == "experimental.storage")
+ return false;
base::DictionaryValue* name_space_node =
- FindListItem(value_.get(), "namespace", JoinString(name_space, '.'));
+ FindListItem(value_.get(), "namespace", name_space);
if (!name_space_node)
return true;
« no previous file with comments | « no previous file | chrome/common/extensions/api/extension_api.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698