summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkouhei@chromium.org <kouhei@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-10 18:46:08 +0000
committerkouhei@chromium.org <kouhei@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-10 18:46:08 +0000
commit17a9bc9822d4a551db44a09ffbb6eb0ee3f5abd3 (patch)
tree4cf41de32bbdb9575030687a6e126d9f893d4f73
parent09560f7fd1e6cab1dcc129574c647624a9a30f5e (diff)
downloadchromium_src-17a9bc9822d4a551db44a09ffbb6eb0ee3f5abd3.zip
chromium_src-17a9bc9822d4a551db44a09ffbb6eb0ee3f5abd3.tar.gz
chromium_src-17a9bc9822d4a551db44a09ffbb6eb0ee3f5abd3.tar.bz2
Remove param |context_type| from InitOriginPermissions
This CL is to prepare for https://codereview.chromium.org/315143003 . This param |context_type| was added in https://codereview.chromium.org/169053005 , but its only usage in |ChromeExtensionsDispatcherDelegate::InitOriginPermissions| seems unnecesary. The reason is that |WebSecurityPolicy::addOriginAccessWhitelistEntry| operates on the global whitelist map valid for all context within the renderer process. BUG=380346, 380502 Review URL: https://codereview.chromium.org/315413004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@276101 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc4
-rw-r--r--chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.h5
-rw-r--r--extensions/renderer/dispatcher.cc8
-rw-r--r--extensions/renderer/dispatcher.h3
-rw-r--r--extensions/renderer/dispatcher_delegate.h2
5 files changed, 10 insertions, 12 deletions
diff --git a/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc b/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc
index 04db8f1..79b937a 100644
--- a/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc
+++ b/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc
@@ -70,11 +70,11 @@ ChromeExtensionsDispatcherDelegate::CreateScriptContext(
void ChromeExtensionsDispatcherDelegate::InitOriginPermissions(
const extensions::Extension* extension,
- extensions::Feature::Context context_type) {
+ bool is_extension_active) {
// TODO(jstritar): We should try to remove this special case. Also, these
// whitelist entries need to be updated when the kManagement permission
// changes.
- if (context_type == extensions::Feature::BLESSED_EXTENSION_CONTEXT &&
+ if (is_extension_active &&
extension->permissions_data()->HasAPIPermission(
extensions::APIPermission::kManagement)) {
blink::WebSecurityPolicy::addOriginAccessWhitelistEntry(
diff --git a/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.h b/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.h
index 5a24e2b4..5bb8006 100644
--- a/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.h
+++ b/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.h
@@ -31,9 +31,8 @@ class ChromeExtensionsDispatcherDelegate
blink::WebFrame* frame,
const extensions::Extension* extension,
extensions::Feature::Context context_type) OVERRIDE;
- virtual void InitOriginPermissions(
- const extensions::Extension* extension,
- extensions::Feature::Context context_type) OVERRIDE;
+ virtual void InitOriginPermissions(const extensions::Extension* extension,
+ bool is_extension_active) OVERRIDE;
virtual void RegisterNativeHandlers(
extensions::Dispatcher* dispatcher,
extensions::ModuleSystem* module_system,
diff --git a/extensions/renderer/dispatcher.cc b/extensions/renderer/dispatcher.cc
index 39d862d..7197159 100644
--- a/extensions/renderer/dispatcher.cc
+++ b/extensions/renderer/dispatcher.cc
@@ -259,7 +259,7 @@ void Dispatcher::DidCreateScriptContext(
script_context_set_.Add(context);
if (extension) {
- InitOriginPermissions(extension, context_type);
+ InitOriginPermissions(extension);
}
{
@@ -797,9 +797,9 @@ void Dispatcher::UpdateActiveExtensions() {
delegate_->OnActiveExtensionsUpdated(active_extensions);
}
-void Dispatcher::InitOriginPermissions(const Extension* extension,
- Feature::Context context_type) {
- delegate_->InitOriginPermissions(extension, context_type);
+void Dispatcher::InitOriginPermissions(const Extension* extension) {
+ delegate_->InitOriginPermissions(extension,
+ IsExtensionActive(extension->id()));
UpdateOriginPermissions(
UpdatedExtensionPermissionsInfo::ADDED,
extension,
diff --git a/extensions/renderer/dispatcher.h b/extensions/renderer/dispatcher.h
index 7358607..aaf2724 100644
--- a/extensions/renderer/dispatcher.h
+++ b/extensions/renderer/dispatcher.h
@@ -189,8 +189,7 @@ class Dispatcher : public content::RenderProcessObserver {
void UpdateActiveExtensions();
// Sets up the host permissions for |extension|.
- void InitOriginPermissions(const Extension* extension,
- Feature::Context context_type);
+ void InitOriginPermissions(const Extension* extension);
void UpdateOriginPermissions(UpdatedExtensionPermissionsInfo::Reason reason,
const Extension* extension,
const URLPatternSet& origins);
diff --git a/extensions/renderer/dispatcher_delegate.h b/extensions/renderer/dispatcher_delegate.h
index 13d557f..c8120c0 100644
--- a/extensions/renderer/dispatcher_delegate.h
+++ b/extensions/renderer/dispatcher_delegate.h
@@ -40,7 +40,7 @@ class DispatcherDelegate {
// Initializes origin permissions for a newly created extension context.
virtual void InitOriginPermissions(const Extension* extension,
- Feature::Context context_type) {}
+ bool is_extension_active) {}
// Includes additional native handlers in a given ModuleSystem.
virtual void RegisterNativeHandlers(Dispatcher* dispatcher,