diff options
author | jochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-24 08:40:49 +0000 |
---|---|---|
committer | jochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-24 08:40:49 +0000 |
commit | d725947e8a370c790794a66fd36d349b7b33b8b8 (patch) | |
tree | a4e71071b7efee3341da93b451989b95ba8f8920 /chrome/renderer/extensions/extension_process_bindings.cc | |
parent | c83658c33bdf286c7d4cf8f766616e297624daec (diff) | |
download | chromium_src-d725947e8a370c790794a66fd36d349b7b33b8b8.zip chromium_src-d725947e8a370c790794a66fd36d349b7b33b8b8.tar.gz chromium_src-d725947e8a370c790794a66fd36d349b7b33b8b8.tar.bz2 |
Enforce extension permissions in C++ (instead of Javascript).
BUG=38920
TEST=ExtensionApiTest.Incognito
Review URL: http://codereview.chromium.org/1148009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42441 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/extensions/extension_process_bindings.cc')
-rw-r--r-- | chrome/renderer/extensions/extension_process_bindings.cc | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/chrome/renderer/extensions/extension_process_bindings.cc b/chrome/renderer/extensions/extension_process_bindings.cc index 694c276..78285b1 100644 --- a/chrome/renderer/extensions/extension_process_bindings.cc +++ b/chrome/renderer/extensions/extension_process_bindings.cc @@ -71,7 +71,7 @@ struct SingletonData { std::set<std::string> function_names_; PageActionIdMap page_action_ids_; ExtensionPermissionsMap permissions_; - std::map<std::string, bool> incognito_enabled_map_; + IncognitoEnabledMap incognito_enabled_map_; }; static std::set<std::string>* GetFunctionNameSet() { @@ -245,8 +245,6 @@ class ExtensionImpl : public ExtensionBase { return v8::FunctionTemplate::New(GetPopupParentWindow); } else if (name->Equals(v8::String::New("SetExtensionActionIcon"))) { return v8::FunctionTemplate::New(SetExtensionActionIcon); - } else if (name->Equals(v8::String::New("CanAccessIncognito"))) { - return v8::FunctionTemplate::New(CanAccessIncognito); } return ExtensionBase::GetNativeFunction(name); @@ -505,16 +503,6 @@ class ExtensionImpl : public ExtensionBase { return StartRequestCommon(args, dict); } - // Returns true if the extension can access incognito data. - static v8::Handle<v8::Value> CanAccessIncognito(const v8::Arguments& args) { - std::string extension_id = ExtensionIdForCurrentContext(); - if (extension_id.empty()) - return v8::False(); - - bool enabled = (*GetIncognitoEnabledMap())[extension_id]; - return v8::Boolean::New(enabled); - } - static v8::Handle<v8::Value> GetRenderViewId(const v8::Arguments& args) { RenderView* renderview = bindings_utils::GetRenderViewForCurrentContext(); if (!renderview) @@ -546,6 +534,12 @@ void ExtensionProcessBindings::SetIncognitoEnabled( } // static +bool ExtensionProcessBindings::HasIncognitoEnabled( + const std::string& extension_id) { + return (!extension_id.empty() && (*GetIncognitoEnabledMap())[extension_id]); +} + +// static void ExtensionProcessBindings::HandleResponse(int request_id, bool success, const std::string& response, const std::string& error) { |