summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrdevlin.cronin@chromium.org <rdevlin.cronin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-06 05:04:36 +0000
committerrdevlin.cronin@chromium.org <rdevlin.cronin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-06 05:04:36 +0000
commita6910e7458ad8ce393b97696307230ceb12a6b77 (patch)
tree24afa5b7b8a8c41a24755007e747a67b084d744f
parentbebb1a87602202e572d4a817d5aa047d32a70cf0 (diff)
downloadchromium_src-a6910e7458ad8ce393b97696307230ceb12a6b77.zip
chromium_src-a6910e7458ad8ce393b97696307230ceb12a6b77.tar.gz
chromium_src-a6910e7458ad8ce393b97696307230ceb12a6b77.tar.bz2
Remove PermissionsData::ForExtension() completely
There's no reason to have this. It was originally because PermissionsData didn't really belong on Extension (and was to be taken off), but now that PermissionsData is refactored to only include active permissions, it belongs on the extension object. TBR=ben@chromium.org (c/b/ui - simple refactor, no functional changes) TBR=thestig@chromium.org (c/b/media_galleries - simple refactor, no functional changes) BUG=379356 Review URL: https://codereview.chromium.org/315573003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@275332 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/apps/ephemeral_app_launcher.cc3
-rw-r--r--chrome/browser/chrome_content_browser_client.cc2
-rw-r--r--chrome/browser/extensions/active_script_controller.cc9
-rw-r--r--chrome/browser/extensions/active_tab_permission_granter.cc6
-rw-r--r--chrome/browser/extensions/active_tab_unittest.cc11
-rw-r--r--chrome/browser/extensions/api/automation_internal/automation_internal_api.cc2
-rw-r--r--chrome/browser/extensions/api/autotest_private/autotest_private_api.cc28
-rw-r--r--chrome/browser/extensions/api/commands/command_service.cc8
-rw-r--r--chrome/browser/extensions/api/cookies/cookies_api.cc3
-rw-r--r--chrome/browser/extensions/api/cookies/cookies_helpers.cc3
-rw-r--r--chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry.cc2
-rw-r--r--chrome/browser/extensions/api/extension_action/browser_action_interactive_test.cc4
-rw-r--r--chrome/browser/extensions/api/hid/hid_api.cc8
-rw-r--r--chrome/browser/extensions/api/management/management_api.cc2
-rw-r--r--chrome/browser/extensions/api/media_galleries/media_galleries_api.cc5
-rw-r--r--chrome/browser/extensions/api/tab_capture/tab_capture_api.cc4
-rw-r--r--chrome/browser/extensions/api/tabs/tabs_api.cc40
-rw-r--r--chrome/browser/extensions/api/web_request/web_request_api.cc4
-rw-r--r--chrome/browser/extensions/api/web_request/web_request_permissions.cc6
-rw-r--r--chrome/browser/extensions/browser_permissions_policy_delegate_unittest.cc3
-rw-r--r--chrome/browser/extensions/bundle_installer.cc3
-rw-r--r--chrome/browser/extensions/crx_installer.cc9
-rw-r--r--chrome/browser/extensions/extension_gcm_app_handler.cc3
-rw-r--r--chrome/browser/extensions/extension_install_prompt.cc2
-rw-r--r--chrome/browser/extensions/extension_keybinding_apitest.cc2
-rw-r--r--chrome/browser/extensions/extension_service.cc6
-rw-r--r--chrome/browser/extensions/extension_tab_util.cc7
-rw-r--r--chrome/browser/extensions/permissions_updater.cc2
-rw-r--r--chrome/browser/media_galleries/media_galleries_dialog_controller.cc2
-rw-r--r--chrome/browser/media_galleries/media_galleries_preferences.cc7
-rw-r--r--chrome/browser/media_galleries/media_galleries_scan_result_dialog_controller.cc2
-rw-r--r--chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm8
-rw-r--r--chrome/browser/ui/omnibox/location_bar.cc2
-rw-r--r--chrome/browser/ui/views/location_bar/location_bar_view.cc11
-rw-r--r--chrome/browser/ui/webui/extensions/extension_settings_handler.cc7
-rw-r--r--chrome/common/extensions/extension_unittest.cc24
-rw-r--r--chrome/common/extensions/manifest_tests/extension_manifests_chromepermission_unittest.cc2
-rw-r--r--chrome/common/extensions/manifest_tests/extension_manifests_devtools_unittest.cc3
-rw-r--r--chrome/common/extensions/permissions/permission_set_unittest.cc23
-rw-r--r--chrome/common/extensions/permissions/settings_override_permission_unittest.cc6
-rw-r--r--chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc16
-rw-r--r--chrome/renderer/extensions/renderer_permissions_policy_delegate_unittest.cc8
-rw-r--r--extensions/browser/api/socket/socket_api.cc28
-rw-r--r--extensions/browser/api/usb/usb_api.cc12
-rw-r--r--extensions/common/extension.cc6
-rw-r--r--extensions/common/extension_messages.cc5
-rw-r--r--extensions/common/features/permission_feature.cc3
-rw-r--r--extensions/common/permissions/permissions_data.cc8
-rw-r--r--extensions/common/permissions/permissions_data.h3
-rw-r--r--extensions/common/permissions/permissions_data_unittest.cc143
-rw-r--r--extensions/renderer/dispatcher.cc4
-rw-r--r--extensions/renderer/script_injection.cc22
-rw-r--r--extensions/renderer/user_script_scheduler.cc16
53 files changed, 242 insertions, 316 deletions
diff --git a/chrome/browser/apps/ephemeral_app_launcher.cc b/chrome/browser/apps/ephemeral_app_launcher.cc
index ed6405c..d95e833 100644
--- a/chrome/browser/apps/ephemeral_app_launcher.cc
+++ b/chrome/browser/apps/ephemeral_app_launcher.cc
@@ -175,8 +175,7 @@ EphemeralAppLauncher::CreateInstallPrompt() const {
// Skip the prompt by returning null if the app does not need to display
// permission warnings.
extensions::PermissionMessages permissions =
- extensions::PermissionsData::ForExtension(extension_)
- ->GetPermissionMessages();
+ extension_->permissions_data()->GetPermissionMessages();
if (permissions.empty())
return scoped_ptr<ExtensionInstallPrompt::Prompt>();
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index 0c8f733..573d1c8 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -2508,7 +2508,7 @@ bool ChromeContentBrowserClient::AllowPepperSocketAPI(
const Extension* extension = extension_set->GetByID(url.host());
if (extension) {
const extensions::PermissionsData* permissions_data =
- extensions::PermissionsData::ForExtension(extension);
+ extension->permissions_data();
if (params) {
extensions::SocketPermission::CheckParam check_params(
params->type, params->host, params->port);
diff --git a/chrome/browser/extensions/active_script_controller.cc b/chrome/browser/extensions/active_script_controller.cc
index 1ea6295..62d1ce5 100644
--- a/chrome/browser/extensions/active_script_controller.cc
+++ b/chrome/browser/extensions/active_script_controller.cc
@@ -73,11 +73,10 @@ ActiveScriptController* ActiveScriptController::GetForWebContents(
bool ActiveScriptController::RequiresUserConsentForScriptInjection(
const Extension* extension) {
CHECK(extension);
- if (!PermissionsData::ForExtension(extension)
- ->RequiresActionForScriptExecution(
- extension,
- SessionID::IdForTab(web_contents()),
- web_contents()->GetVisibleURL()) ||
+ if (!extension->permissions_data()->RequiresActionForScriptExecution(
+ extension,
+ SessionID::IdForTab(web_contents()),
+ web_contents()->GetVisibleURL()) ||
util::AllowedScriptingOnAllUrls(extension->id(),
web_contents()->GetBrowserContext())) {
return false;
diff --git a/chrome/browser/extensions/active_tab_permission_granter.cc b/chrome/browser/extensions/active_tab_permission_granter.cc
index 995cce4..978bbfc 100644
--- a/chrome/browser/extensions/active_tab_permission_granter.cc
+++ b/chrome/browser/extensions/active_tab_permission_granter.cc
@@ -43,8 +43,7 @@ void ActiveTabPermissionGranter::GrantIfRequested(const Extension* extension) {
APIPermissionSet new_apis;
URLPatternSet new_hosts;
- const PermissionsData* permissions_data =
- PermissionsData::ForExtension(extension);
+ const PermissionsData* permissions_data = extension->permissions_data();
// If the extension requires action for script execution, we grant it
// active tab-style permissions, even if it doesn't have the activeTab
@@ -125,8 +124,7 @@ void ActiveTabPermissionGranter::ClearActiveExtensionsAndNotify() {
for (ExtensionSet::const_iterator it = granted_extensions_.begin();
it != granted_extensions_.end(); ++it) {
- PermissionsData::ForExtension(it->get())
- ->ClearTabSpecificPermissions(tab_id_);
+ it->get()->permissions_data()->ClearTabSpecificPermissions(tab_id_);
extension_ids.push_back((*it)->id());
}
diff --git a/chrome/browser/extensions/active_tab_unittest.cc b/chrome/browser/extensions/active_tab_unittest.cc
index 93be34e..6f7823a 100644
--- a/chrome/browser/extensions/active_tab_unittest.cc
+++ b/chrome/browser/extensions/active_tab_unittest.cc
@@ -107,8 +107,7 @@ class ActiveTabTest : public ChromeRenderViewHostTestHarness {
const GURL& url,
PermittedFeature feature,
int tab_id) {
- const PermissionsData* permissions_data =
- PermissionsData::ForExtension(extension);
+ const PermissionsData* permissions_data = extension->permissions_data();
bool script = permissions_data->CanExecuteScriptOnPage(
extension, url, url, tab_id, NULL, -1, NULL);
bool capture = HasTabsPermission(extension, tab_id) &&
@@ -144,13 +143,13 @@ class ActiveTabTest : public ChromeRenderViewHostTestHarness {
bool HasTabsPermission(const scoped_refptr<const Extension>& extension,
int tab_id) {
- return PermissionsData::ForExtension(extension)
- ->HasAPIPermissionForTab(tab_id, APIPermission::kTab);
+ return extension->permissions_data()->HasAPIPermissionForTab(
+ tab_id, APIPermission::kTab);
}
bool IsGrantedForTab(const Extension* extension,
const content::WebContents* web_contents) {
- return PermissionsData::ForExtension(extension)->HasAPIPermissionForTab(
+ return extension->permissions_data()->HasAPIPermissionForTab(
SessionID::IdForTab(web_contents), APIPermission::kTab);
}
@@ -370,7 +369,7 @@ TEST_F(ActiveTabTest, ChromeUrlGrants) {
EXPECT_TRUE(IsAllowed(extension_with_tab_capture, internal,
PERMITTED_CAPTURE_ONLY));
const PermissionsData* permissions_data =
- PermissionsData::ForExtension(extension_with_tab_capture);
+ extension_with_tab_capture->permissions_data();
EXPECT_TRUE(permissions_data->HasAPIPermissionForTab(
tab_id(), APIPermission::kTabCaptureForTab));
diff --git a/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc b/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc
index ff816df..cf03b4b 100644
--- a/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc
+++ b/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc
@@ -59,7 +59,7 @@ bool CanRequestAutomation(const Extension* extension,
content::RenderProcessHost* process = contents->GetRenderProcessHost();
int process_id = process ? process->GetID() : -1;
std::string unused_error;
- return PermissionsData::ForExtension(extension)->CanExecuteScriptOnPage(
+ return extension->permissions_data()->CanExecuteScriptOnPage(
extension, url, url, tab_id, NULL, process_id, &unused_error);
}
diff --git a/chrome/browser/extensions/api/autotest_private/autotest_private_api.cc b/chrome/browser/extensions/api/autotest_private/autotest_private_api.cc
index d31c58e..d5a3fe6 100644
--- a/chrome/browser/extensions/api/autotest_private/autotest_private_api.cc
+++ b/chrome/browser/extensions/api/autotest_private/autotest_private_api.cc
@@ -32,17 +32,16 @@ namespace extensions {
namespace {
base::ListValue* GetHostPermissions(const Extension* ext, bool effective_perm) {
- extensions::URLPatternSet pattern_set;
- if (effective_perm) {
- pattern_set = extensions::PermissionsData::ForExtension(ext)
- ->GetEffectiveHostPermissions();
- } else {
+ URLPatternSet pattern_set;
+ if (effective_perm)
+ pattern_set = ext->permissions_data()->GetEffectiveHostPermissions();
+ else
pattern_set = ext->GetActivePermissions()->explicit_hosts();
- }
base::ListValue* permissions = new base::ListValue;
- for (extensions::URLPatternSet::const_iterator perm = pattern_set.begin();
- perm != pattern_set.end(); ++perm) {
+ for (URLPatternSet::const_iterator perm = pattern_set.begin();
+ perm != pattern_set.end();
+ ++perm) {
permissions->Append(new base::StringValue(perm->GetAsString()));
}
@@ -150,10 +149,9 @@ bool AutotestPrivateLockScreenFunction::RunSync() {
bool AutotestPrivateGetExtensionsInfoFunction::RunSync() {
DVLOG(1) << "AutotestPrivateGetExtensionsInfoFunction";
- ExtensionService* service = extensions::ExtensionSystem::Get(
- GetProfile())->extension_service();
- ExtensionRegistry* registry =
- extensions::ExtensionRegistry::Get(GetProfile());
+ ExtensionService* service =
+ ExtensionSystem::Get(GetProfile())->extension_service();
+ ExtensionRegistry* registry = ExtensionRegistry::Get(GetProfile());
const ExtensionSet& extensions = registry->enabled_extensions();
const ExtensionSet& disabled_extensions = registry->disabled_extensions();
ExtensionActionManager* extension_action_manager =
@@ -173,10 +171,10 @@ bool AutotestPrivateGetExtensionsInfoFunction::RunSync() {
extension_value->SetString("name", extension->name());
extension_value->SetString("publicKey", extension->public_key());
extension_value->SetString("description", extension->description());
- extension_value->SetString("backgroundUrl",
- extensions::BackgroundInfo::GetBackgroundURL(extension).spec());
+ extension_value->SetString(
+ "backgroundUrl", BackgroundInfo::GetBackgroundURL(extension).spec());
extension_value->SetString("optionsUrl",
- extensions::ManifestURL::GetOptionsPage(extension).spec());
+ ManifestURL::GetOptionsPage(extension).spec());
extension_value->Set("hostPermissions",
GetHostPermissions(extension, false));
diff --git a/chrome/browser/extensions/api/commands/command_service.cc b/chrome/browser/extensions/api/commands/command_service.cc
index 89f8b2a..ff447eb 100644
--- a/chrome/browser/extensions/api/commands/command_service.cc
+++ b/chrome/browser/extensions/api/commands/command_service.cc
@@ -171,8 +171,8 @@ bool CommandService::RemovesBookmarkShortcut(const Extension* extension) {
SettingsOverrides::RemovesBookmarkShortcut(*settings_overrides)) ||
(ui_overrides &&
UIOverrides::RemovesBookmarkShortcut(*ui_overrides))) &&
- (PermissionsData::ForExtension(extension)
- ->HasAPIPermission(APIPermission::kBookmarkManagerPrivate) ||
+ (extension->permissions_data()->HasAPIPermission(
+ APIPermission::kBookmarkManagerPrivate) ||
FeatureSwitch::enable_override_bookmarks_ui()->IsEnabled());
}
@@ -188,8 +188,8 @@ bool CommandService::RemovesBookmarkOpenPagesShortcut(
*settings_overrides)) ||
(ui_overrides &&
UIOverrides::RemovesBookmarkOpenPagesShortcut(*ui_overrides))) &&
- (PermissionsData::ForExtension(extension)
- ->HasAPIPermission(APIPermission::kBookmarkManagerPrivate) ||
+ (extension->permissions_data()->HasAPIPermission(
+ APIPermission::kBookmarkManagerPrivate) ||
FeatureSwitch::enable_override_bookmarks_ui()->IsEnabled());
}
diff --git a/chrome/browser/extensions/api/cookies/cookies_api.cc b/chrome/browser/extensions/api/cookies/cookies_api.cc
index b03a05a..cbb93dc 100644
--- a/chrome/browser/extensions/api/cookies/cookies_api.cc
+++ b/chrome/browser/extensions/api/cookies/cookies_api.cc
@@ -62,8 +62,7 @@ bool ParseUrl(ChromeAsyncExtensionFunction* function,
}
// Check against host permissions if needed.
if (check_host_permissions &&
- !PermissionsData::ForExtension(function->GetExtension())
- ->HasHostPermission(*url)) {
+ !function->GetExtension()->permissions_data()->HasHostPermission(*url)) {
function->SetError(ErrorUtils::FormatErrorMessage(
keys::kNoHostPermissionsError, url->spec()));
return false;
diff --git a/chrome/browser/extensions/api/cookies/cookies_helpers.cc b/chrome/browser/extensions/api/cookies/cookies_helpers.cc
index 71e5818..f22fc7d 100644
--- a/chrome/browser/extensions/api/cookies/cookies_helpers.cc
+++ b/chrome/browser/extensions/api/cookies/cookies_helpers.cc
@@ -136,8 +136,7 @@ void AppendMatchingCookiesToVector(const net::CookieList& all_cookies,
// Ignore any cookie whose domain doesn't match the extension's
// host permissions.
GURL cookie_domain_url = GetURLFromCanonicalCookie(*it);
- if (!PermissionsData::ForExtension(extension)
- ->HasHostPermission(cookie_domain_url))
+ if (!extension->permissions_data()->HasHostPermission(cookie_domain_url))
continue;
// Filter the cookie using the match filter.
cookies_helpers::MatchFilter filter(details);
diff --git a/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry.cc b/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry.cc
index 1ac200e..5def40b 100644
--- a/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry.cc
+++ b/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry.cc
@@ -344,7 +344,7 @@ bool WebRequestRulesRegistry::HostPermissionsChecker(
const Extension* extension,
const WebRequestActionSet* actions,
std::string* error) {
- if (PermissionsData::ForExtension(extension)->HasEffectiveAccessToAllHosts())
+ if (extension->permissions_data()->HasEffectiveAccessToAllHosts())
return true;
// Without the permission for all URLs, actions with the STRATEGY_DEFAULT
diff --git a/chrome/browser/extensions/api/extension_action/browser_action_interactive_test.cc b/chrome/browser/extensions/api/extension_action/browser_action_interactive_test.cc
index 2bb0177..7c1d6a0 100644
--- a/chrome/browser/extensions/api/extension_action/browser_action_interactive_test.cc
+++ b/chrome/browser/extensions/api/extension_action/browser_action_interactive_test.cc
@@ -196,8 +196,8 @@ IN_PROC_BROWSER_TEST_F(BrowserActionInteractiveTest,
ExtensionService* service = extensions::ExtensionSystem::Get(
browser()->profile())->extension_service();
ASSERT_FALSE(
- PermissionsData::ForExtension(
- service->GetExtensionById(last_loaded_extension_id(), false))
+ service->GetExtensionById(last_loaded_extension_id(), false)
+ ->permissions_data()
->HasAPIPermissionForTab(
SessionID::IdForTab(
browser()->tab_strip_model()->GetActiveWebContents()),
diff --git a/chrome/browser/extensions/api/hid/hid_api.cc b/chrome/browser/extensions/api/hid/hid_api.cc
index 6d41ad8..2462384 100644
--- a/chrome/browser/extensions/api/hid/hid_api.cc
+++ b/chrome/browser/extensions/api/hid/hid_api.cc
@@ -87,8 +87,8 @@ void HidGetDevicesFunction::AsyncWorkStart() {
const uint16_t product_id = parameters_->options.product_id;
UsbDevicePermission::CheckParam param(
vendor_id, product_id, UsbDevicePermissionData::UNSPECIFIED_INTERFACE);
- if (!PermissionsData::ForExtension(GetExtension())
- ->CheckAPIPermissionWithParam(APIPermission::kUsbDevice, &param)) {
+ if (!GetExtension()->permissions_data()->CheckAPIPermissionWithParam(
+ APIPermission::kUsbDevice, &param)) {
LOG(WARNING) << "Insufficient permissions to access device.";
CompleteWithError(kErrorPermissionDenied);
return;
@@ -119,8 +119,8 @@ void HidConnectFunction::AsyncWorkStart() {
device_info.vendor_id,
device_info.product_id,
UsbDevicePermissionData::UNSPECIFIED_INTERFACE);
- if (!PermissionsData::ForExtension(GetExtension())
- ->CheckAPIPermissionWithParam(APIPermission::kUsbDevice, &param)) {
+ if (!GetExtension()->permissions_data()->CheckAPIPermissionWithParam(
+ APIPermission::kUsbDevice, &param)) {
LOG(WARNING) << "Insufficient permissions to access device.";
CompleteWithError(kErrorPermissionDenied);
return;
diff --git a/chrome/browser/extensions/api/management/management_api.cc b/chrome/browser/extensions/api/management/management_api.cc
index fdc4b35..1e7d3f8 100644
--- a/chrome/browser/extensions/api/management/management_api.cc
+++ b/chrome/browser/extensions/api/management/management_api.cc
@@ -90,7 +90,7 @@ AutoConfirmForTest auto_confirm_for_test = DO_NOT_SKIP;
std::vector<std::string> CreateWarningsList(const Extension* extension) {
std::vector<std::string> warnings_list;
PermissionMessages warnings =
- PermissionsData::ForExtension(extension)->GetPermissionMessages();
+ extension->permissions_data()->GetPermissionMessages();
for (PermissionMessages::const_iterator iter = warnings.begin();
iter != warnings.end(); ++iter) {
warnings_list.push_back(base::UTF16ToUTF8(iter->message()));
diff --git a/chrome/browser/extensions/api/media_galleries/media_galleries_api.cc b/chrome/browser/extensions/api/media_galleries/media_galleries_api.cc
index 77edb3e..21d205d 100644
--- a/chrome/browser/extensions/api/media_galleries/media_galleries_api.cc
+++ b/chrome/browser/extensions/api/media_galleries/media_galleries_api.cc
@@ -143,8 +143,7 @@ base::ListValue* ConstructFileSystemList(
MediaGalleriesPermission::CheckParam read_param(
MediaGalleriesPermission::kReadPermission);
- const PermissionsData* permissions_data =
- PermissionsData::ForExtension(extension);
+ const PermissionsData* permissions_data = extension->permissions_data();
bool has_read_permission = permissions_data->CheckAPIPermissionWithParam(
APIPermission::kMediaGalleries, &read_param);
MediaGalleriesPermission::CheckParam copy_to_param(
@@ -211,7 +210,7 @@ bool CheckScanPermission(const extensions::Extension* extension,
MediaGalleriesPermission::CheckParam scan_param(
MediaGalleriesPermission::kScanPermission);
bool has_scan_permission =
- PermissionsData::ForExtension(extension)->CheckAPIPermissionWithParam(
+ extension->permissions_data()->CheckAPIPermissionWithParam(
APIPermission::kMediaGalleries, &scan_param);
if (!has_scan_permission)
*error = kNoScanPermission;
diff --git a/chrome/browser/extensions/api/tab_capture/tab_capture_api.cc b/chrome/browser/extensions/api/tab_capture/tab_capture_api.cc
index 5967dac..c88fbc9 100644
--- a/chrome/browser/extensions/api/tab_capture/tab_capture_api.cc
+++ b/chrome/browser/extensions/api/tab_capture/tab_capture_api.cc
@@ -89,8 +89,8 @@ bool TabCaptureCaptureFunction::RunSync() {
// Make sure either we have been granted permission to capture through an
// extension icon click or our extension is whitelisted.
- if (!PermissionsData::ForExtension(extension)
- ->HasAPIPermissionForTab(tab_id, APIPermission::kTabCaptureForTab) &&
+ if (!extension->permissions_data()->HasAPIPermissionForTab(
+ tab_id, APIPermission::kTabCaptureForTab) &&
CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
switches::kWhitelistedExtensionID) != extension_id &&
!SimpleFeature::IsIdInList(
diff --git a/chrome/browser/extensions/api/tabs/tabs_api.cc b/chrome/browser/extensions/api/tabs/tabs_api.cc
index cf0bab4..876d5a2 100644
--- a/chrome/browser/extensions/api/tabs/tabs_api.cc
+++ b/chrome/browser/extensions/api/tabs/tabs_api.cc
@@ -1178,14 +1178,14 @@ bool TabsUpdateFunction::UpdateURL(const std::string &url_string,
// we need to check host permissions before allowing them.
if (url.SchemeIs(url::kJavaScriptScheme)) {
content::RenderProcessHost* process = web_contents_->GetRenderProcessHost();
- if (!PermissionsData::ForExtension(GetExtension())
- ->CanExecuteScriptOnPage(GetExtension(),
- web_contents_->GetURL(),
- web_contents_->GetURL(),
- tab_id,
- NULL,
- process ? process->GetID() : -1,
- &error_)) {
+ if (!GetExtension()->permissions_data()->CanExecuteScriptOnPage(
+ GetExtension(),
+ web_contents_->GetURL(),
+ web_contents_->GetURL(),
+ tab_id,
+ NULL,
+ process ? process->GetID() : -1,
+ &error_)) {
return false;
}
@@ -1504,8 +1504,8 @@ WebContents* TabsCaptureVisibleTabFunction::GetWebContentsForID(int window_id) {
return NULL;
}
- if (!PermissionsData::ForExtension(GetExtension())
- ->CanCaptureVisiblePage(SessionID::IdForTab(contents), &error_)) {
+ if (!GetExtension()->permissions_data()->CanCaptureVisiblePage(
+ SessionID::IdForTab(contents), &error_)) {
return NULL;
}
return contents;
@@ -1627,8 +1627,8 @@ ExecuteCodeInTabFunction::~ExecuteCodeInTabFunction() {}
bool ExecuteCodeInTabFunction::HasPermission() {
if (Init() &&
- PermissionsData::ForExtension(extension_)
- ->HasAPIPermissionForTab(execute_tab_id_, APIPermission::kTab)) {
+ extension_->permissions_data()->HasAPIPermissionForTab(
+ execute_tab_id_, APIPermission::kTab)) {
return true;
}
return ExtensionFunction::HasPermission();
@@ -1656,14 +1656,14 @@ bool ExecuteCodeInTabFunction::CanExecuteScriptOnPage() {
// NOTE: This can give the wrong answer due to race conditions, but it is OK,
// we check again in the renderer.
content::RenderProcessHost* process = contents->GetRenderProcessHost();
- if (!PermissionsData::ForExtension(GetExtension())
- ->CanExecuteScriptOnPage(GetExtension(),
- contents->GetURL(),
- contents->GetURL(),
- execute_tab_id_,
- NULL,
- process ? process->GetID() : -1,
- &error_)) {
+ if (!GetExtension()->permissions_data()->CanExecuteScriptOnPage(
+ GetExtension(),
+ contents->GetURL(),
+ contents->GetURL(),
+ execute_tab_id_,
+ NULL,
+ process ? process->GetID() : -1,
+ &error_)) {
return false;
}
diff --git a/chrome/browser/extensions/api/web_request/web_request_api.cc b/chrome/browser/extensions/api/web_request/web_request_api.cc
index 005d58a..b4e8158d 100644
--- a/chrome/browser/extensions/api/web_request/web_request_api.cc
+++ b/chrome/browser/extensions/api/web_request/web_request_api.cc
@@ -2230,9 +2230,7 @@ bool WebRequestInternalAddEventListenerFunction::RunSync() {
// For this reason we do only a coarse check here to warn the extension
// developer if he does something obviously wrong.
if (!is_web_view_guest &&
- extensions::PermissionsData::ForExtension(extension)
- ->GetEffectiveHostPermissions()
- .is_empty()) {
+ extension->permissions_data()->GetEffectiveHostPermissions().is_empty()) {
error_ = keys::kHostPermissionsRequired;
return false;
}
diff --git a/chrome/browser/extensions/api/web_request/web_request_permissions.cc b/chrome/browser/extensions/api/web_request/web_request_permissions.cc
index 5d0d7a8..1617c72 100644
--- a/chrome/browser/extensions/api/web_request/web_request_permissions.cc
+++ b/chrome/browser/extensions/api/web_request/web_request_permissions.cc
@@ -133,15 +133,13 @@ bool WebRequestPermissions::CanExtensionAccessURL(
// about: URLs are not covered in host permissions, but are allowed
// anyway.
if (!((url.SchemeIs(content::kAboutScheme) ||
- extensions::PermissionsData::ForExtension(extension)
- ->HasHostPermission(url) ||
+ extension->permissions_data()->HasHostPermission(url) ||
url.GetOrigin() == extension->url()))) {
return false;
}
break;
case REQUIRE_ALL_URLS:
- if (!extensions::PermissionsData::ForExtension(extension)
- ->HasEffectiveAccessToAllHosts())
+ if (!extension->permissions_data()->HasEffectiveAccessToAllHosts())
return false;
break;
}
diff --git a/chrome/browser/extensions/browser_permissions_policy_delegate_unittest.cc b/chrome/browser/extensions/browser_permissions_policy_delegate_unittest.cc
index ca96634..6c7e8d4 100644
--- a/chrome/browser/extensions/browser_permissions_policy_delegate_unittest.cc
+++ b/chrome/browser/extensions/browser_permissions_policy_delegate_unittest.cc
@@ -74,8 +74,7 @@ TEST_F(BrowserPermissionsPolicyDelegateTest, CanExecuteScriptOnPage) {
// The same call should succeed with a normal process, but fail with a signin
// process.
- const PermissionsData* permissions_data =
- PermissionsData::ForExtension(extension);
+ const PermissionsData* permissions_data = extension->permissions_data();
EXPECT_TRUE(permissions_data->CanExecuteScriptOnPage(extension,
kSigninUrl,
kSigninUrl,
diff --git a/chrome/browser/extensions/bundle_installer.cc b/chrome/browser/extensions/bundle_installer.cc
index 9cebb3b..9a77ff0 100644
--- a/chrome/browser/extensions/bundle_installer.cc
+++ b/chrome/browser/extensions/bundle_installer.cc
@@ -258,8 +258,7 @@ void BundleInstaller::ShowPrompt() {
for (size_t i = 0; i < dummy_extensions_.size(); ++i) {
permissions = PermissionSet::CreateUnion(
permissions.get(),
- PermissionsData::ForExtension(dummy_extensions_[i])
- ->active_permissions());
+ dummy_extensions_[i]->permissions_data()->active_permissions());
}
if (g_auto_approve_for_test == PROCEED) {
diff --git a/chrome/browser/extensions/crx_installer.cc b/chrome/browser/extensions/crx_installer.cc
index 7d4a35e..7503b97 100644
--- a/chrome/browser/extensions/crx_installer.cc
+++ b/chrome/browser/extensions/crx_installer.cc
@@ -297,9 +297,7 @@ CrxInstallerError CrxInstaller::AllowInstall(const Extension* extension) {
// To skip manifest checking, the extension must be a shared module
// and not request any permissions.
if (SharedModuleInfo::IsSharedModule(extension) &&
- PermissionsData::ForExtension(extension)
- ->active_permissions()
- ->IsEmpty()) {
+ extension->permissions_data()->active_permissions()->IsEmpty()) {
valid = true;
}
} else {
@@ -315,11 +313,10 @@ CrxInstallerError CrxInstaller::AllowInstall(const Extension* extension) {
&error);
if (error.empty()) {
scoped_refptr<const PermissionSet> expected_permissions =
- PermissionsData::ForExtension(dummy_extension)
- ->active_permissions();
+ dummy_extension->permissions_data()->active_permissions();
valid = !(PermissionMessageProvider::Get()->IsPrivilegeIncrease(
expected_permissions,
- PermissionsData::ForExtension(extension)->active_permissions(),
+ extension->permissions_data()->active_permissions(),
extension->GetType()));
}
}
diff --git a/chrome/browser/extensions/extension_gcm_app_handler.cc b/chrome/browser/extensions/extension_gcm_app_handler.cc
index fd515ef..c55111e 100644
--- a/chrome/browser/extensions/extension_gcm_app_handler.cc
+++ b/chrome/browser/extensions/extension_gcm_app_handler.cc
@@ -29,8 +29,7 @@ base::LazyInstance<BrowserContextKeyedAPIFactory<ExtensionGCMAppHandler> >
g_factory = LAZY_INSTANCE_INITIALIZER;
bool IsGCMPermissionEnabled(const Extension* extension) {
- return PermissionsData::ForExtension(extension)
- ->HasAPIPermission(APIPermission::kGcm);
+ return extension->permissions_data()->HasAPIPermission(APIPermission::kGcm);
}
} // namespace
diff --git a/chrome/browser/extensions/extension_install_prompt.cc b/chrome/browser/extensions/extension_install_prompt.cc
index ca5f86a..f0947c2 100644
--- a/chrome/browser/extensions/extension_install_prompt.cc
+++ b/chrome/browser/extensions/extension_install_prompt.cc
@@ -711,7 +711,7 @@ void ExtensionInstallPrompt::ShowConfirmation() {
if (permissions_.get()) {
if (extension_) {
const extensions::PermissionsData* permissions_data =
- extensions::PermissionsData::ForExtension(extension_);
+ extension_->permissions_data();
prompt_.SetPermissions(permissions_data->GetPermissionMessageStrings());
prompt_.SetPermissionsDetails(
permissions_data->GetPermissionMessageDetailsStrings());
diff --git a/chrome/browser/extensions/extension_keybinding_apitest.cc b/chrome/browser/extensions/extension_keybinding_apitest.cc
index 0f4b073..1073f63 100644
--- a/chrome/browser/extensions/extension_keybinding_apitest.cc
+++ b/chrome/browser/extensions/extension_keybinding_apitest.cc
@@ -37,7 +37,7 @@ class CommandsApiTest : public ExtensionApiTest {
bool IsGrantedForTab(const Extension* extension,
const content::WebContents* web_contents) {
- return PermissionsData::ForExtension(extension)->HasAPIPermissionForTab(
+ return extension->permissions_data()->HasAPIPermissionForTab(
SessionID::IdForTab(web_contents), APIPermission::kTab);
}
};
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index 1128e23..bb23964 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -979,8 +979,8 @@ void ExtensionService::RecordPermissionMessagesHistogram(
PermissionMessage::kEnumBoundary + 1,
base::HistogramBase::kUmaTargetedHistogramFlag);
- PermissionMessages permissions = extensions::PermissionsData::ForExtension(
- extension)->GetPermissionMessages();
+ PermissionMessages permissions =
+ extension->permissions_data()->GetPermissionMessages();
if (permissions.empty()) {
counter->Add(PermissionMessage::kNone);
} else {
@@ -1044,7 +1044,7 @@ void ExtensionService::NotifyExtensionLoaded(const Extension* extension) {
UpdateActiveExtensionsInCrashReporter();
const extensions::PermissionsData* permissions_data =
- extensions::PermissionsData::ForExtension(extension);
+ extension->permissions_data();
// If the extension has permission to load chrome://favicon/ resources we need
// to make sure that the FaviconSource is registered with the
diff --git a/chrome/browser/extensions/extension_tab_util.cc b/chrome/browser/extensions/extension_tab_util.cc
index b0177e1..fc1d3c5 100644
--- a/chrome/browser/extensions/extension_tab_util.cc
+++ b/chrome/browser/extensions/extension_tab_util.cc
@@ -389,10 +389,9 @@ void ExtensionTabUtil::ScrubTabValueForExtension(
WebContents* contents,
const Extension* extension,
base::DictionaryValue* tab_info) {
- bool has_permission =
- extension &&
- PermissionsData::ForExtension(extension)
- ->HasAPIPermissionForTab(GetTabId(contents), APIPermission::kTab);
+ bool has_permission = extension &&
+ extension->permissions_data()->HasAPIPermissionForTab(
+ GetTabId(contents), APIPermission::kTab);
if (!has_permission) {
tab_info->Remove(keys::kUrlKey, NULL);
diff --git a/chrome/browser/extensions/permissions_updater.cc b/chrome/browser/extensions/permissions_updater.cc
index 09adfb9..c132adb 100644
--- a/chrome/browser/extensions/permissions_updater.cc
+++ b/chrome/browser/extensions/permissions_updater.cc
@@ -84,7 +84,7 @@ void PermissionsUpdater::UpdateActivePermissions(
const Extension* extension, const PermissionSet* permissions) {
ExtensionPrefs::Get(profile_)->SetActivePermissions(
extension->id(), permissions);
- PermissionsData::ForExtension(extension)->SetActivePermissions(permissions);
+ extension->permissions_data()->SetActivePermissions(permissions);
}
void PermissionsUpdater::DispatchEvent(
diff --git a/chrome/browser/media_galleries/media_galleries_dialog_controller.cc b/chrome/browser/media_galleries/media_galleries_dialog_controller.cc
index 93fb700..f4f39d4 100644
--- a/chrome/browser/media_galleries/media_galleries_dialog_controller.cc
+++ b/chrome/browser/media_galleries/media_galleries_dialog_controller.cc
@@ -123,7 +123,7 @@ base::string16 MediaGalleriesDialogController::GetSubtext() const {
extensions::MediaGalleriesPermission::CheckParam delete_param(
extensions::MediaGalleriesPermission::kDeletePermission);
const extensions::PermissionsData* permissions_data =
- extensions::PermissionsData::ForExtension(extension_);
+ extension_->permissions_data();
bool has_copy_to_permission = permissions_data->CheckAPIPermissionWithParam(
APIPermission::kMediaGalleries, &copy_to_param);
bool has_delete_permission = permissions_data->CheckAPIPermissionWithParam(
diff --git a/chrome/browser/media_galleries/media_galleries_preferences.cc b/chrome/browser/media_galleries/media_galleries_preferences.cc
index f3ec78a..a780656 100644
--- a/chrome/browser/media_galleries/media_galleries_preferences.cc
+++ b/chrome/browser/media_galleries/media_galleries_preferences.cc
@@ -97,7 +97,7 @@ int NumberExtensionsUsingMediaGalleries(Profile* profile) {
for (extensions::ExtensionSet::const_iterator i = extensions->begin();
i != extensions->end(); ++i) {
const extensions::PermissionsData* permissions_data =
- extensions::PermissionsData::ForExtension(*i);
+ (*i)->permissions_data();
if (permissions_data->HasAPIPermission(
extensions::APIPermission::kMediaGalleries) ||
permissions_data->HasAPIPermission(
@@ -279,9 +279,8 @@ base::DictionaryValue* CreateGalleryPrefInfoDictionary(
bool HasAutoDetectedGalleryPermission(const extensions::Extension& extension) {
extensions::MediaGalleriesPermission::CheckParam param(
extensions::MediaGalleriesPermission::kAllAutoDetectedPermission);
- return extensions::PermissionsData::ForExtension(&extension)->
- CheckAPIPermissionWithParam(extensions::APIPermission::kMediaGalleries,
- &param);
+ return extension.permissions_data()->CheckAPIPermissionWithParam(
+ extensions::APIPermission::kMediaGalleries, &param);
}
// Retrieves the MediaGalleryPermission from the given dictionary; DCHECKs on
diff --git a/chrome/browser/media_galleries/media_galleries_scan_result_dialog_controller.cc b/chrome/browser/media_galleries/media_galleries_scan_result_dialog_controller.cc
index b5cd3fe..91a3a5b 100644
--- a/chrome/browser/media_galleries/media_galleries_scan_result_dialog_controller.cc
+++ b/chrome/browser/media_galleries/media_galleries_scan_result_dialog_controller.cc
@@ -121,7 +121,7 @@ base::string16 MediaGalleriesScanResultDialogController::GetSubtext() const {
extensions::MediaGalleriesPermission::CheckParam delete_param(
extensions::MediaGalleriesPermission::kDeletePermission);
const extensions::PermissionsData* permissions_data =
- extensions::PermissionsData::ForExtension(extension_);
+ extension_->permissions_data();
bool has_copy_to_permission = permissions_data->CheckAPIPermissionWithParam(
extensions::APIPermission::kMediaGalleries, &copy_to_param);
bool has_delete_permission = permissions_data->CheckAPIPermissionWithParam(
diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm
index 8f10858..34c6f7f 100644
--- a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm
+++ b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm
@@ -93,10 +93,10 @@ class IsPageActionViewRightAligned {
: extension_service_(extension_service) {}
bool operator()(PageActionDecoration* page_action_decoration) {
- return extensions::PermissionsData::ForExtension(
- extension_service_->GetExtensionById(
- page_action_decoration->page_action()->extension_id(),
- false))
+ return extension_service_
+ ->GetExtensionById(
+ page_action_decoration->page_action()->extension_id(), false)
+ ->permissions_data()
->HasAPIPermission(extensions::APIPermission::kBookmarkManagerPrivate);
}
diff --git a/chrome/browser/ui/omnibox/location_bar.cc b/chrome/browser/ui/omnibox/location_bar.cc
index f51dfce..c41bb10 100644
--- a/chrome/browser/ui/omnibox/location_bar.cc
+++ b/chrome/browser/ui/omnibox/location_bar.cc
@@ -33,7 +33,7 @@ bool LocationBar::IsBookmarkStarHiddenByExtension() const {
if (((settings_overrides &&
SettingsOverrides::RemovesBookmarkButton(*settings_overrides)) ||
(ui_overrides && UIOverrides::RemovesBookmarkButton(*ui_overrides))) &&
- (extensions::PermissionsData::ForExtension(*i)->HasAPIPermission(
+ ((*i)->permissions_data()->HasAPIPermission(
extensions::APIPermission::kBookmarkManagerPrivate) ||
extensions::FeatureSwitch::enable_override_bookmarks_ui()
->IsEnabled()))
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc
index 5e3bbdd..8a71d56 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -170,12 +170,11 @@ class IsPageActionViewRightAligned {
: extension_service_(extension_service) {}
bool operator()(PageActionWithBadgeView* page_action_view) {
- return extensions::PermissionsData::ForExtension(
- extension_service_->GetExtensionById(
- page_action_view->image_view()
- ->page_action()
- ->extension_id(),
- false))
+ return extension_service_
+ ->GetExtensionById(
+ page_action_view->image_view()->page_action()->extension_id(),
+ false)
+ ->permissions_data()
->HasAPIPermission(extensions::APIPermission::kBookmarkManagerPrivate);
}
diff --git a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc
index 9511051..e50de2f 100644
--- a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc
+++ b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc
@@ -260,9 +260,10 @@ base::DictionaryValue* ExtensionSettingsHandler::CreateExtensionDetailValue(
// - The feature is enabled.
// - The extension has access to enough urls that we can't just let it run
// on those specified in the permissions.
- bool wants_all_urls = FeatureSwitch::scripts_require_action()->IsEnabled() &&
- PermissionsData::ForExtension(extension)
- ->RequiresActionForScriptExecution(extension);
+ bool wants_all_urls =
+ FeatureSwitch::scripts_require_action()->IsEnabled() &&
+ extension->permissions_data()->RequiresActionForScriptExecution(
+ extension);
extension_data->SetBoolean("wantsAllUrls", wants_all_urls);
extension_data->SetBoolean(
"allowAllUrls",
diff --git a/chrome/common/extensions/extension_unittest.cc b/chrome/common/extensions/extension_unittest.cc
index c2f73b6..1ee777c 100644
--- a/chrome/common/extensions/extension_unittest.cc
+++ b/chrome/common/extensions/extension_unittest.cc
@@ -236,42 +236,42 @@ TEST(ExtensionTest, WantsFileAccess) {
// <all_urls> permission
extension = LoadManifest("permissions", "permissions_all_urls.json");
EXPECT_TRUE(extension->wants_file_access());
- EXPECT_FALSE(PermissionsData::ForExtension(extension)->CanExecuteScriptOnPage(
+ EXPECT_FALSE(extension->permissions_data()->CanExecuteScriptOnPage(
extension, file_url, file_url, -1, NULL, -1, NULL));
extension = LoadManifest(
"permissions", "permissions_all_urls.json", Extension::ALLOW_FILE_ACCESS);
EXPECT_TRUE(extension->wants_file_access());
- EXPECT_TRUE(PermissionsData::ForExtension(extension)->CanExecuteScriptOnPage(
+ EXPECT_TRUE(extension->permissions_data()->CanExecuteScriptOnPage(
extension, file_url, file_url, -1, NULL, -1, NULL));
// file:///* permission
extension = LoadManifest("permissions", "permissions_file_scheme.json");
EXPECT_TRUE(extension->wants_file_access());
- EXPECT_FALSE(PermissionsData::ForExtension(extension)->CanExecuteScriptOnPage(
+ EXPECT_FALSE(extension->permissions_data()->CanExecuteScriptOnPage(
extension, file_url, file_url, -1, NULL, -1, NULL));
extension = LoadManifest("permissions",
"permissions_file_scheme.json",
Extension::ALLOW_FILE_ACCESS);
EXPECT_TRUE(extension->wants_file_access());
- EXPECT_TRUE(PermissionsData::ForExtension(extension)->CanExecuteScriptOnPage(
+ EXPECT_TRUE(extension->permissions_data()->CanExecuteScriptOnPage(
extension, file_url, file_url, -1, NULL, -1, NULL));
// http://* permission
extension = LoadManifest("permissions", "permissions_http_scheme.json");
EXPECT_FALSE(extension->wants_file_access());
- EXPECT_FALSE(PermissionsData::ForExtension(extension)->CanExecuteScriptOnPage(
+ EXPECT_FALSE(extension->permissions_data()->CanExecuteScriptOnPage(
extension, file_url, file_url, -1, NULL, -1, NULL));
extension = LoadManifest("permissions",
"permissions_http_scheme.json",
Extension::ALLOW_FILE_ACCESS);
EXPECT_FALSE(extension->wants_file_access());
- EXPECT_FALSE(PermissionsData::ForExtension(extension)->CanExecuteScriptOnPage(
+ EXPECT_FALSE(extension->permissions_data()->CanExecuteScriptOnPage(
extension, file_url, file_url, -1, NULL, -1, NULL));
// <all_urls> content script match
extension = LoadManifest("permissions", "content_script_all_urls.json");
EXPECT_TRUE(extension->wants_file_access());
- EXPECT_FALSE(PermissionsData::ForExtension(extension)->CanExecuteScriptOnPage(
+ EXPECT_FALSE(extension->permissions_data()->CanExecuteScriptOnPage(
extension,
file_url,
file_url,
@@ -282,7 +282,7 @@ TEST(ExtensionTest, WantsFileAccess) {
extension = LoadManifest("permissions", "content_script_all_urls.json",
Extension::ALLOW_FILE_ACCESS);
EXPECT_TRUE(extension->wants_file_access());
- EXPECT_TRUE(PermissionsData::ForExtension(extension)->CanExecuteScriptOnPage(
+ EXPECT_TRUE(extension->permissions_data()->CanExecuteScriptOnPage(
extension,
file_url,
file_url,
@@ -294,7 +294,7 @@ TEST(ExtensionTest, WantsFileAccess) {
// file:///* content script match
extension = LoadManifest("permissions", "content_script_file_scheme.json");
EXPECT_TRUE(extension->wants_file_access());
- EXPECT_FALSE(PermissionsData::ForExtension(extension)->CanExecuteScriptOnPage(
+ EXPECT_FALSE(extension->permissions_data()->CanExecuteScriptOnPage(
extension,
file_url,
file_url,
@@ -305,7 +305,7 @@ TEST(ExtensionTest, WantsFileAccess) {
extension = LoadManifest("permissions", "content_script_file_scheme.json",
Extension::ALLOW_FILE_ACCESS);
EXPECT_TRUE(extension->wants_file_access());
- EXPECT_TRUE(PermissionsData::ForExtension(extension)->CanExecuteScriptOnPage(
+ EXPECT_TRUE(extension->permissions_data()->CanExecuteScriptOnPage(
extension,
file_url,
file_url,
@@ -317,7 +317,7 @@ TEST(ExtensionTest, WantsFileAccess) {
// http://* content script match
extension = LoadManifest("permissions", "content_script_http_scheme.json");
EXPECT_FALSE(extension->wants_file_access());
- EXPECT_FALSE(PermissionsData::ForExtension(extension)->CanExecuteScriptOnPage(
+ EXPECT_FALSE(extension->permissions_data()->CanExecuteScriptOnPage(
extension,
file_url,
file_url,
@@ -328,7 +328,7 @@ TEST(ExtensionTest, WantsFileAccess) {
extension = LoadManifest("permissions", "content_script_http_scheme.json",
Extension::ALLOW_FILE_ACCESS);
EXPECT_FALSE(extension->wants_file_access());
- EXPECT_FALSE(PermissionsData::ForExtension(extension)->CanExecuteScriptOnPage(
+ EXPECT_FALSE(extension->permissions_data()->CanExecuteScriptOnPage(
extension,
file_url,
file_url,
diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_chromepermission_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_chromepermission_unittest.cc
index e6e781e..d18512f 100644
--- a/chrome/common/extensions/manifest_tests/extension_manifests_chromepermission_unittest.cc
+++ b/chrome/common/extensions/manifest_tests/extension_manifests_chromepermission_unittest.cc
@@ -34,7 +34,7 @@ TEST_F(ExtensionManifestTest, ChromeURLPermissionAllowedWithFlag) {
LoadAndExpectSuccess("permission_chrome_url_invalid.json");
EXPECT_EQ("", error);
const GURL newtab_url(chrome::kChromeUINewTabURL);
- EXPECT_TRUE(PermissionsData::ForExtension(extension)->CanExecuteScriptOnPage(
+ EXPECT_TRUE(extension->permissions_data()->CanExecuteScriptOnPage(
extension, newtab_url, newtab_url, 0, NULL, -1, &error))
<< error;
}
diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_devtools_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_devtools_unittest.cc
index 5394b69..290a434 100644
--- a/chrome/common/extensions/manifest_tests/extension_manifests_devtools_unittest.cc
+++ b/chrome/common/extensions/manifest_tests/extension_manifests_devtools_unittest.cc
@@ -20,6 +20,5 @@ TEST_F(DevToolsPageManifestTest, DevToolsExtensions) {
extension = LoadAndExpectSuccess("devtools_extension.json");
EXPECT_EQ(extension->url().spec() + "devtools.html",
extensions::ManifestURL::GetDevToolsPage(extension.get()).spec());
- EXPECT_TRUE(extensions::PermissionsData::ForExtension(extension)
- ->HasEffectiveAccessToAllHosts());
+ EXPECT_TRUE(extension->permissions_data()->HasEffectiveAccessToAllHosts());
}
diff --git a/chrome/common/extensions/permissions/permission_set_unittest.cc b/chrome/common/extensions/permissions/permission_set_unittest.cc
index 637cd15..864bfbf 100644
--- a/chrome/common/extensions/permissions/permission_set_unittest.cc
+++ b/chrome/common/extensions/permissions/permission_set_unittest.cc
@@ -133,7 +133,7 @@ TEST(PermissionsTest, EffectiveHostPermissions) {
extension = LoadManifest("effective_host_permissions", "empty.json");
permissions = extension->GetActivePermissions();
EXPECT_EQ(0u,
- PermissionsData::ForExtension(extension)
+ extension->permissions_data()
->GetEffectiveHostPermissions()
.patterns()
.size());
@@ -914,7 +914,7 @@ TEST(PermissionsTest, GetWarningMessages_ManyHosts) {
extension = LoadManifest("permissions", "many-hosts.json");
std::vector<base::string16> warnings =
- PermissionsData::ForExtension(extension)->GetPermissionMessageStrings();
+ extension->permissions_data()->GetPermissionMessageStrings();
ASSERT_EQ(1u, warnings.size());
EXPECT_EQ(
"Read and modify your data on encrypted.google.com and "
@@ -928,7 +928,7 @@ TEST(PermissionsTest, GetWarningMessages_Plugins) {
extension = LoadManifest("permissions", "plugins.json");
std::vector<base::string16> warnings =
- PermissionsData::ForExtension(extension)->GetPermissionMessageStrings();
+ extension->permissions_data()->GetPermissionMessageStrings();
// We don't parse the plugins key on Chrome OS, so it should not ask for any
// permissions.
#if defined(OS_CHROMEOS)
@@ -1016,7 +1016,7 @@ TEST(PermissionsTest, GetWarningMessages_Serial) {
EXPECT_TRUE(extension->is_platform_app());
EXPECT_TRUE(extension->HasAPIPermission(APIPermission::kSerial));
std::vector<base::string16> warnings =
- PermissionsData::ForExtension(extension)->GetPermissionMessageStrings();
+ extension->permissions_data()->GetPermissionMessageStrings();
EXPECT_TRUE(
Contains(warnings, "Use serial devices attached to your computer"));
ASSERT_EQ(1u, warnings.size());
@@ -1030,7 +1030,7 @@ TEST(PermissionsTest, GetWarningMessages_Socket_AnyHost) {
EXPECT_TRUE(extension->is_platform_app());
EXPECT_TRUE(extension->HasAPIPermission(APIPermission::kSocket));
std::vector<base::string16> warnings =
- PermissionsData::ForExtension(extension)->GetPermissionMessageStrings();
+ extension->permissions_data()->GetPermissionMessageStrings();
EXPECT_EQ(1u, warnings.size());
EXPECT_TRUE(Contains(warnings, "Exchange data with any computer "
"on the local network or internet"));
@@ -1044,7 +1044,7 @@ TEST(PermissionsTest, GetWarningMessages_Socket_OneDomainTwoHostnames) {
EXPECT_TRUE(extension->is_platform_app());
EXPECT_TRUE(extension->HasAPIPermission(APIPermission::kSocket));
std::vector<base::string16> warnings =
- PermissionsData::ForExtension(extension)->GetPermissionMessageStrings();
+ extension->permissions_data()->GetPermissionMessageStrings();
// Verify the warnings, including support for unicode characters, the fact
// that domain host warnings come before specific host warnings, and the fact
@@ -1070,7 +1070,7 @@ TEST(PermissionsTest, GetWarningMessages_Socket_TwoDomainsOneHostname) {
EXPECT_TRUE(extension->is_platform_app());
EXPECT_TRUE(extension->HasAPIPermission(APIPermission::kSocket));
std::vector<base::string16> warnings =
- PermissionsData::ForExtension(extension)->GetPermissionMessageStrings();
+ extension->permissions_data()->GetPermissionMessageStrings();
// Verify the warnings, including the fact that domain host warnings come
// before specific host warnings and the fact that domains and hostnames are
@@ -1092,13 +1092,12 @@ TEST(PermissionsTest, GetWarningMessages_PlatformApppHosts) {
extension = LoadManifest("permissions", "platform_app_hosts.json");
EXPECT_TRUE(extension->is_platform_app());
std::vector<base::string16> warnings =
- PermissionsData::ForExtension(extension)->GetPermissionMessageStrings();
+ extension->permissions_data()->GetPermissionMessageStrings();
ASSERT_EQ(0u, warnings.size());
extension = LoadManifest("permissions", "platform_app_all_urls.json");
EXPECT_TRUE(extension->is_platform_app());
- warnings =
- PermissionsData::ForExtension(extension)->GetPermissionMessageStrings();
+ warnings = extension->permissions_data()->GetPermissionMessageStrings();
ASSERT_EQ(0u, warnings.size());
}
@@ -1113,7 +1112,7 @@ bool ShowsAllHostsWarning(const std::string& pattern) {
.Build();
std::vector<base::string16> warnings =
- PermissionsData::ForExtension(extension)->GetPermissionMessageStrings();
+ extension->permissions_data()->GetPermissionMessageStrings();
if (warnings.empty())
return false;
@@ -1546,7 +1545,7 @@ TEST(PermissionsTest, SyncFileSystemPermission) {
EXPECT_TRUE(extension->is_platform_app());
EXPECT_TRUE(extension->HasAPIPermission(APIPermission::kSyncFileSystem));
std::vector<base::string16> warnings =
- PermissionsData::ForExtension(extension)->GetPermissionMessageStrings();
+ extension->permissions_data()->GetPermissionMessageStrings();
EXPECT_TRUE(Contains(warnings, "Store data in your Google Drive account"));
ASSERT_EQ(1u, warnings.size());
}
diff --git a/chrome/common/extensions/permissions/settings_override_permission_unittest.cc b/chrome/common/extensions/permissions/settings_override_permission_unittest.cc
index 54d1774..7f92290 100644
--- a/chrome/common/extensions/permissions/settings_override_permission_unittest.cc
+++ b/chrome/common/extensions/permissions/settings_override_permission_unittest.cc
@@ -69,7 +69,7 @@ TEST_F(SettingsOverridePermissionTest, HomePage) {
#if defined(OS_WIN)
EXPECT_TRUE(permission_set->HasAPIPermission(APIPermission::kHomepage));
std::vector<base::string16> warnings =
- PermissionsData::ForExtension(extension)->GetPermissionMessageStrings();
+ extension->permissions_data()->GetPermissionMessageStrings();
ASSERT_EQ(1u, warnings.size());
EXPECT_EQ("Change your home page to: google.com/",
base::UTF16ToUTF8(warnings[0]));
@@ -93,7 +93,7 @@ TEST_F(SettingsOverridePermissionTest, StartupPages) {
#if defined(OS_WIN)
EXPECT_TRUE(permission_set->HasAPIPermission(APIPermission::kStartupPages));
std::vector<base::string16> warnings =
- PermissionsData::ForExtension(extension)->GetPermissionMessageStrings();
+ extension->permissions_data()->GetPermissionMessageStrings();
ASSERT_EQ(1u, warnings.size());
EXPECT_EQ("Change your start page to: startup.com/startup.html",
base::UTF16ToUTF8(warnings[0]));
@@ -117,7 +117,7 @@ TEST_F(SettingsOverridePermissionTest, SearchSettings) {
#if defined(OS_WIN)
EXPECT_TRUE(permission_set->HasAPIPermission(APIPermission::kSearchProvider));
std::vector<base::string16> warnings =
- PermissionsData::ForExtension(extension)->GetPermissionMessageStrings();
+ extension->permissions_data()->GetPermissionMessageStrings();
ASSERT_EQ(1u, warnings.size());
EXPECT_EQ("Change your search settings to: google.com",
base::UTF16ToUTF8(warnings[0]));
diff --git a/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc b/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc
index ef6a60f..9eb290b 100644
--- a/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc
+++ b/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc
@@ -335,8 +335,7 @@ void ChromeExtensionsDispatcherDelegate::ClearTabSpecificPermissions(
const extensions::Extension* extension =
dispatcher->extensions()->GetByID(*it);
if (extension)
- extensions::PermissionsData::ForExtension(extension)
- ->ClearTabSpecificPermissions(tab_id);
+ extension->permissions_data()->ClearTabSpecificPermissions(tab_id);
}
}
@@ -360,13 +359,12 @@ void ChromeExtensionsDispatcherDelegate::UpdateTabSpecificPermissions(
if (!extension)
return;
- extensions::PermissionsData::ForExtension(extension)
- ->UpdateTabSpecificPermissions(
- tab_id,
- new extensions::PermissionSet(extensions::APIPermissionSet(),
- extensions::ManifestPermissionSet(),
- origin_set,
- extensions::URLPatternSet()));
+ extension->permissions_data()->UpdateTabSpecificPermissions(
+ tab_id,
+ new extensions::PermissionSet(extensions::APIPermissionSet(),
+ extensions::ManifestPermissionSet(),
+ origin_set,
+ extensions::URLPatternSet()));
}
void ChromeExtensionsDispatcherDelegate::HandleWebRequestAPIUsage(
diff --git a/chrome/renderer/extensions/renderer_permissions_policy_delegate_unittest.cc b/chrome/renderer/extensions/renderer_permissions_policy_delegate_unittest.cc
index bf5181c..e0eca8e 100644
--- a/chrome/renderer/extensions/renderer_permissions_policy_delegate_unittest.cc
+++ b/chrome/renderer/extensions/renderer_permissions_policy_delegate_unittest.cc
@@ -68,13 +68,13 @@ TEST_F(RendererPermissionsPolicyDelegateTest, CannotScriptSigninProcess) {
scoped_refptr<const Extension> extension(CreateTestExtension("a"));
std::string error;
- EXPECT_TRUE(PermissionsData::ForExtension(extension)->CanExecuteScriptOnPage(
+ EXPECT_TRUE(extension->permissions_data()->CanExecuteScriptOnPage(
extension, kSigninUrl, kSigninUrl, -1, NULL, -1, &error))
<< error;
// Pretend we are in the signin process. We should not be able to execute
// script.
CommandLine::ForCurrentProcess()->AppendSwitch(switches::kSigninProcess);
- EXPECT_FALSE(PermissionsData::ForExtension(extension)->CanExecuteScriptOnPage(
+ EXPECT_FALSE(extension->permissions_data()->CanExecuteScriptOnPage(
extension, kSigninUrl, kSigninUrl, -1, NULL, -1, &error))
<< error;
}
@@ -86,7 +86,7 @@ TEST_F(RendererPermissionsPolicyDelegateTest, CannotScriptWebstore) {
scoped_refptr<const Extension> extension(CreateTestExtension("a"));
std::string error;
- EXPECT_TRUE(PermissionsData::ForExtension(extension)->CanExecuteScriptOnPage(
+ EXPECT_TRUE(extension->permissions_data()->CanExecuteScriptOnPage(
extension, kAnyUrl, kAnyUrl, -1, NULL, -1, &error))
<< error;
@@ -96,7 +96,7 @@ TEST_F(RendererPermissionsPolicyDelegateTest, CannotScriptWebstore) {
CreateTestExtension(extension_misc::kWebStoreAppId));
extension_dispatcher_->OnLoadedInternal(webstore_extension);
extension_dispatcher_->OnActivateExtension(extension_misc::kWebStoreAppId);
- EXPECT_FALSE(PermissionsData::ForExtension(extension)->CanExecuteScriptOnPage(
+ EXPECT_FALSE(extension->permissions_data()->CanExecuteScriptOnPage(
extension, kAnyUrl, kAnyUrl, -1, NULL, -1, &error))
<< error;
}
diff --git a/extensions/browser/api/socket/socket_api.cc b/extensions/browser/api/socket/socket_api.cc
index 62d7718..3225827 100644
--- a/extensions/browser/api/socket/socket_api.cc
+++ b/extensions/browser/api/socket/socket_api.cc
@@ -210,8 +210,8 @@ void SocketConnectFunction::AsyncWorkStart() {
}
SocketPermission::CheckParam param(operation_type, hostname_, port_);
- if (!PermissionsData::ForExtension(GetExtension())
- ->CheckAPIPermissionWithParam(APIPermission::kSocket, &param)) {
+ if (!GetExtension()->permissions_data()->CheckAPIPermissionWithParam(
+ APIPermission::kSocket, &param)) {
error_ = kPermissionError;
SetResult(new base::FundamentalValue(-1));
AsyncWorkCompleted();
@@ -275,8 +275,8 @@ void SocketBindFunction::Work() {
if (socket->GetSocketType() == Socket::TYPE_UDP) {
SocketPermission::CheckParam param(
SocketPermissionRequest::UDP_BIND, address_, port_);
- if (!PermissionsData::ForExtension(GetExtension())
- ->CheckAPIPermissionWithParam(APIPermission::kSocket, &param)) {
+ if (!GetExtension()->permissions_data()->CheckAPIPermissionWithParam(
+ APIPermission::kSocket, &param)) {
error_ = kPermissionError;
SetResult(new base::FundamentalValue(result));
return;
@@ -308,8 +308,8 @@ void SocketListenFunction::Work() {
if (socket) {
SocketPermission::CheckParam param(
SocketPermissionRequest::TCP_LISTEN, params_->address, params_->port);
- if (!PermissionsData::ForExtension(GetExtension())
- ->CheckAPIPermissionWithParam(APIPermission::kSocket, &param)) {
+ if (!GetExtension()->permissions_data()->CheckAPIPermissionWithParam(
+ APIPermission::kSocket, &param)) {
error_ = kPermissionError;
SetResult(new base::FundamentalValue(result));
return;
@@ -510,8 +510,8 @@ void SocketSendToFunction::AsyncWorkStart() {
if (socket_->GetSocketType() == Socket::TYPE_UDP) {
SocketPermission::CheckParam param(
SocketPermissionRequest::UDP_SEND_TO, hostname_, port_);
- if (!PermissionsData::ForExtension(GetExtension())
- ->CheckAPIPermissionWithParam(APIPermission::kSocket, &param)) {
+ if (!GetExtension()->permissions_data()->CheckAPIPermissionWithParam(
+ APIPermission::kSocket, &param)) {
error_ = kPermissionError;
SetResult(new base::FundamentalValue(-1));
AsyncWorkCompleted();
@@ -724,8 +724,8 @@ void SocketJoinGroupFunction::Work() {
kWildcardAddress,
kWildcardPort);
- if (!PermissionsData::ForExtension(GetExtension())
- ->CheckAPIPermissionWithParam(APIPermission::kSocket, &param)) {
+ if (!GetExtension()->permissions_data()->CheckAPIPermissionWithParam(
+ APIPermission::kSocket, &param)) {
error_ = kPermissionError;
SetResult(new base::FundamentalValue(result));
return;
@@ -768,8 +768,8 @@ void SocketLeaveGroupFunction::Work() {
SocketPermissionRequest::UDP_MULTICAST_MEMBERSHIP,
kWildcardAddress,
kWildcardPort);
- if (!PermissionsData::ForExtension(GetExtension())
- ->CheckAPIPermissionWithParam(APIPermission::kSocket, &param)) {
+ if (!GetExtension()->permissions_data()->CheckAPIPermissionWithParam(
+ APIPermission::kSocket, &param)) {
error_ = kPermissionError;
SetResult(new base::FundamentalValue(result));
return;
@@ -875,8 +875,8 @@ void SocketGetJoinedGroupsFunction::Work() {
SocketPermissionRequest::UDP_MULTICAST_MEMBERSHIP,
kWildcardAddress,
kWildcardPort);
- if (!PermissionsData::ForExtension(GetExtension())
- ->CheckAPIPermissionWithParam(APIPermission::kSocket, &param)) {
+ if (!GetExtension()->permissions_data()->CheckAPIPermissionWithParam(
+ APIPermission::kSocket, &param)) {
error_ = kPermissionError;
SetResult(new base::FundamentalValue(result));
return;
diff --git a/extensions/browser/api/usb/usb_api.cc b/extensions/browser/api/usb/usb_api.cc
index 8bf2779..b888a2b 100644
--- a/extensions/browser/api/usb/usb_api.cc
+++ b/extensions/browser/api/usb/usb_api.cc
@@ -422,8 +422,8 @@ scoped_refptr<UsbDevice> UsbAsyncApiFunction::GetDeviceOrOrCompleteWithError(
const uint16_t product_id = input_device.product_id;
UsbDevicePermission::CheckParam param(
vendor_id, product_id, UsbDevicePermissionData::UNSPECIFIED_INTERFACE);
- if (!PermissionsData::ForExtension(GetExtension())
- ->CheckAPIPermissionWithParam(APIPermission::kUsbDevice, &param)) {
+ if (!GetExtension()->permissions_data()->CheckAPIPermissionWithParam(
+ APIPermission::kUsbDevice, &param)) {
LOG(WARNING) << "Insufficient permissions to access device.";
CompleteWithError(kErrorPermissionDenied);
return NULL;
@@ -553,8 +553,8 @@ void UsbFindDevicesFunction::AsyncWorkStart() {
? *parameters_->options.interface_id.get()
: UsbDevicePermissionData::ANY_INTERFACE;
UsbDevicePermission::CheckParam param(vendor_id, product_id, interface_id);
- if (!PermissionsData::ForExtension(GetExtension())
- ->CheckAPIPermissionWithParam(APIPermission::kUsbDevice, &param)) {
+ if (!GetExtension()->permissions_data()->CheckAPIPermissionWithParam(
+ APIPermission::kUsbDevice, &param)) {
LOG(WARNING) << "Insufficient permissions to access device.";
CompleteWithError(kErrorPermissionDenied);
return;
@@ -629,8 +629,8 @@ void UsbGetDevicesFunction::AsyncWorkStart() {
const uint16_t product_id = parameters_->options.product_id;
UsbDevicePermission::CheckParam param(
vendor_id, product_id, UsbDevicePermissionData::UNSPECIFIED_INTERFACE);
- if (!PermissionsData::ForExtension(GetExtension())
- ->CheckAPIPermissionWithParam(APIPermission::kUsbDevice, &param)) {
+ if (!GetExtension()->permissions_data()->CheckAPIPermissionWithParam(
+ APIPermission::kUsbDevice, &param)) {
LOG(WARNING) << "Insufficient permissions to access device.";
CompleteWithError(kErrorPermissionDenied);
return;
diff --git a/extensions/common/extension.cc b/extensions/common/extension.cc
index 91e6f2e..9179d46 100644
--- a/extensions/common/extension.cc
+++ b/extensions/common/extension.cc
@@ -288,15 +288,15 @@ GURL Extension::GetBaseURLFromExtensionId(const std::string& extension_id) {
}
bool Extension::HasAPIPermission(APIPermission::ID permission) const {
- return PermissionsData::ForExtension(this)->HasAPIPermission(permission);
+ return permissions_data_->HasAPIPermission(permission);
}
bool Extension::HasAPIPermission(const std::string& permission_name) const {
- return PermissionsData::ForExtension(this)->HasAPIPermission(permission_name);
+ return permissions_data_->HasAPIPermission(permission_name);
}
scoped_refptr<const PermissionSet> Extension::GetActivePermissions() const {
- return PermissionsData::ForExtension(this)->active_permissions();
+ return permissions_data_->active_permissions();
}
bool Extension::ShowConfigureContextMenus() const {
diff --git a/extensions/common/extension_messages.cc b/extensions/common/extension_messages.cc
index afba3af..ae1c180 100644
--- a/extensions/common/extension_messages.cc
+++ b/extensions/common/extension_messages.cc
@@ -47,9 +47,8 @@ scoped_refptr<Extension> ExtensionMsg_Loaded_Params::ConvertToExtension(
scoped_refptr<Extension> extension =
Extension::Create(path, location, *manifest, creation_flags, error);
if (extension.get()) {
- extensions::PermissionsData::ForExtension(extension)
- ->SetActivePermissions(new PermissionSet(
- apis, manifest_permissions, explicit_hosts, scriptable_hosts));
+ extension->permissions_data()->SetActivePermissions(new PermissionSet(
+ apis, manifest_permissions, explicit_hosts, scriptable_hosts));
}
return extension;
}
diff --git a/extensions/common/features/permission_feature.cc b/extensions/common/features/permission_feature.cc
index 7be136d..82f676bf 100644
--- a/extensions/common/features/permission_feature.cc
+++ b/extensions/common/features/permission_feature.cc
@@ -27,8 +27,7 @@ Feature::Availability PermissionFeature::IsAvailableToContext(
if (!availability.is_available())
return availability;
- if (extension &&
- !PermissionsData::ForExtension(extension)->HasAPIPermission(name()))
+ if (extension && !extension->permissions_data()->HasAPIPermission(name()))
return CreateAvailability(NOT_PRESENT, extension->GetType());
return CreateAvailability(IS_AVAILABLE);
diff --git a/extensions/common/permissions/permissions_data.cc b/extensions/common/permissions/permissions_data.cc
index 12dfaa6..a624826 100644
--- a/extensions/common/permissions/permissions_data.cc
+++ b/extensions/common/permissions/permissions_data.cc
@@ -53,14 +53,6 @@ void PermissionsData::SetPolicyDelegate(PolicyDelegate* delegate) {
}
// static
-const PermissionsData* PermissionsData::ForExtension(
- const Extension* extension) {
- // TODO(rdevlin.cronin): Figure out what we're doing with this (i.e. whether
- // or not we want to expose PermissionsData on the extension).
- return extension->permissions_data();
-}
-
-// static
bool PermissionsData::CanSilentlyIncreasePermissions(
const Extension* extension) {
return extension->location() != Manifest::INTERNAL;
diff --git a/extensions/common/permissions/permissions_data.h b/extensions/common/permissions/permissions_data.h
index 57c6880..8b55c85 100644
--- a/extensions/common/permissions/permissions_data.h
+++ b/extensions/common/permissions/permissions_data.h
@@ -57,9 +57,6 @@ class PermissionsData {
PermissionsData(const Extension* extension);
virtual ~PermissionsData();
- // Return the PermissionsData associated with the given |extension|.
- static const PermissionsData* ForExtension(const Extension* extension);
-
// Returns true if the |extension| can silently increase its permission level.
// Users must approve permissions for unpacked and packed extensions in the
// following situations:
diff --git a/extensions/common/permissions/permissions_data_unittest.cc b/extensions/common/permissions/permissions_data_unittest.cc
index ff5ca86..f7fad22 100644
--- a/extensions/common/permissions/permissions_data_unittest.cc
+++ b/extensions/common/permissions/permissions_data_unittest.cc
@@ -46,8 +46,8 @@ bool CheckSocketPermission(
const char* host,
int port) {
SocketPermission::CheckParam param(type, host, port);
- return PermissionsData::ForExtension(extension)
- ->CheckAPIPermissionWithParam(APIPermission::kSocket, &param);
+ return extension->permissions_data()->CheckAPIPermissionWithParam(
+ APIPermission::kSocket, &param);
}
// Creates and returns an extension with the given |id|, |host_permissions|, and
@@ -81,10 +81,10 @@ bool RequiresActionForScriptExecution(const std::string& extension_id,
GetExtensionWithHostPermission(extension_id,
host_permissions,
location);
- return PermissionsData::ForExtension(extension)
- ->RequiresActionForScriptExecution(extension,
- -1, // Ignore tab id for these.
- GURL::EmptyGURL());
+ return extension->permissions_data()->RequiresActionForScriptExecution(
+ extension,
+ -1, // Ignore tab id for these.
+ GURL::EmptyGURL());
}
} // namespace
@@ -95,52 +95,42 @@ TEST(ExtensionPermissionsTest, EffectiveHostPermissions) {
extension = LoadManifest("effective_host_permissions", "empty.json");
EXPECT_EQ(0u,
- PermissionsData::ForExtension(extension)
+ extension->permissions_data()
->GetEffectiveHostPermissions()
.patterns()
.size());
EXPECT_FALSE(hosts.MatchesURL(GURL("http://www.google.com")));
- EXPECT_FALSE(
- PermissionsData::ForExtension(extension)->HasEffectiveAccessToAllHosts());
+ EXPECT_FALSE(extension->permissions_data()->HasEffectiveAccessToAllHosts());
extension = LoadManifest("effective_host_permissions", "one_host.json");
- hosts =
- PermissionsData::ForExtension(extension)->GetEffectiveHostPermissions();
+ hosts = extension->permissions_data()->GetEffectiveHostPermissions();
EXPECT_TRUE(hosts.MatchesURL(GURL("http://www.google.com")));
EXPECT_FALSE(hosts.MatchesURL(GURL("https://www.google.com")));
- EXPECT_FALSE(
- PermissionsData::ForExtension(extension)->HasEffectiveAccessToAllHosts());
+ EXPECT_FALSE(extension->permissions_data()->HasEffectiveAccessToAllHosts());
extension = LoadManifest("effective_host_permissions",
"one_host_wildcard.json");
- hosts =
- PermissionsData::ForExtension(extension)->GetEffectiveHostPermissions();
+ hosts = extension->permissions_data()->GetEffectiveHostPermissions();
EXPECT_TRUE(hosts.MatchesURL(GURL("http://google.com")));
EXPECT_TRUE(hosts.MatchesURL(GURL("http://foo.google.com")));
- EXPECT_FALSE(
- PermissionsData::ForExtension(extension)->HasEffectiveAccessToAllHosts());
+ EXPECT_FALSE(extension->permissions_data()->HasEffectiveAccessToAllHosts());
extension = LoadManifest("effective_host_permissions", "two_hosts.json");
- hosts =
- PermissionsData::ForExtension(extension)->GetEffectiveHostPermissions();
+ hosts = extension->permissions_data()->GetEffectiveHostPermissions();
EXPECT_TRUE(hosts.MatchesURL(GURL("http://www.google.com")));
EXPECT_TRUE(hosts.MatchesURL(GURL("http://www.reddit.com")));
- EXPECT_FALSE(
- PermissionsData::ForExtension(extension)->HasEffectiveAccessToAllHosts());
+ EXPECT_FALSE(extension->permissions_data()->HasEffectiveAccessToAllHosts());
extension = LoadManifest("effective_host_permissions",
"https_not_considered.json");
- hosts =
- PermissionsData::ForExtension(extension)->GetEffectiveHostPermissions();
+ hosts = extension->permissions_data()->GetEffectiveHostPermissions();
EXPECT_TRUE(hosts.MatchesURL(GURL("http://google.com")));
EXPECT_TRUE(hosts.MatchesURL(GURL("https://google.com")));
- EXPECT_FALSE(
- PermissionsData::ForExtension(extension)->HasEffectiveAccessToAllHosts());
+ EXPECT_FALSE(extension->permissions_data()->HasEffectiveAccessToAllHosts());
extension = LoadManifest("effective_host_permissions",
"two_content_scripts.json");
- hosts =
- PermissionsData::ForExtension(extension)->GetEffectiveHostPermissions();
+ hosts = extension->permissions_data()->GetEffectiveHostPermissions();
EXPECT_TRUE(hosts.MatchesURL(GURL("http://google.com")));
EXPECT_TRUE(hosts.MatchesURL(GURL("http://www.reddit.com")));
EXPECT_TRUE(extension->GetActivePermissions()->HasEffectiveAccessToURL(
@@ -148,34 +138,27 @@ TEST(ExtensionPermissionsTest, EffectiveHostPermissions) {
EXPECT_TRUE(hosts.MatchesURL(GURL("http://news.ycombinator.com")));
EXPECT_TRUE(extension->GetActivePermissions()->HasEffectiveAccessToURL(
GURL("http://news.ycombinator.com")));
- EXPECT_FALSE(
- PermissionsData::ForExtension(extension)->HasEffectiveAccessToAllHosts());
+ EXPECT_FALSE(extension->permissions_data()->HasEffectiveAccessToAllHosts());
extension = LoadManifest("effective_host_permissions", "all_hosts.json");
- hosts =
- PermissionsData::ForExtension(extension)->GetEffectiveHostPermissions();
+ hosts = extension->permissions_data()->GetEffectiveHostPermissions();
EXPECT_TRUE(hosts.MatchesURL(GURL("http://test/")));
EXPECT_FALSE(hosts.MatchesURL(GURL("https://test/")));
EXPECT_TRUE(hosts.MatchesURL(GURL("http://www.google.com")));
- EXPECT_TRUE(
- PermissionsData::ForExtension(extension)->HasEffectiveAccessToAllHosts());
+ EXPECT_TRUE(extension->permissions_data()->HasEffectiveAccessToAllHosts());
extension = LoadManifest("effective_host_permissions", "all_hosts2.json");
- hosts =
- PermissionsData::ForExtension(extension)->GetEffectiveHostPermissions();
+ hosts = extension->permissions_data()->GetEffectiveHostPermissions();
EXPECT_TRUE(hosts.MatchesURL(GURL("http://test/")));
EXPECT_TRUE(hosts.MatchesURL(GURL("http://www.google.com")));
- EXPECT_TRUE(
- PermissionsData::ForExtension(extension)->HasEffectiveAccessToAllHosts());
+ EXPECT_TRUE(extension->permissions_data()->HasEffectiveAccessToAllHosts());
extension = LoadManifest("effective_host_permissions", "all_hosts3.json");
- hosts =
- PermissionsData::ForExtension(extension)->GetEffectiveHostPermissions();
+ hosts = extension->permissions_data()->GetEffectiveHostPermissions();
EXPECT_FALSE(hosts.MatchesURL(GURL("http://test/")));
EXPECT_TRUE(hosts.MatchesURL(GURL("https://test/")));
EXPECT_TRUE(hosts.MatchesURL(GURL("http://www.google.com")));
- EXPECT_TRUE(
- PermissionsData::ForExtension(extension)->HasEffectiveAccessToAllHosts());
+ EXPECT_TRUE(extension->permissions_data()->HasEffectiveAccessToAllHosts());
}
TEST(ExtensionPermissionsTest, SocketPermissions) {
@@ -250,18 +233,17 @@ TEST(ExtensionPermissionsTest, RequiresActionForScriptExecution) {
ManifestPermissionSet(),
allowed_hosts,
URLPatternSet()));
- PermissionsData::ForExtension(extension)
- ->UpdateTabSpecificPermissions(0, tab_permissions);
- EXPECT_FALSE(PermissionsData::ForExtension(extension)
- ->RequiresActionForScriptExecution(
- extension, 0, GURL("https://www.google.com/")));
+ extension->permissions_data()->UpdateTabSpecificPermissions(0,
+ tab_permissions);
+ EXPECT_FALSE(extension->permissions_data()->RequiresActionForScriptExecution(
+ extension, 0, GURL("https://www.google.com/")));
}
TEST(ExtensionPermissionsTest, GetPermissionMessages_ManyAPIPermissions) {
scoped_refptr<Extension> extension;
extension = LoadManifest("permissions", "many-apis.json");
std::vector<base::string16> warnings =
- PermissionsData::ForExtension(extension)->GetPermissionMessageStrings();
+ extension->permissions_data()->GetPermissionMessageStrings();
// Warning for "tabs" is suppressed by "history" permission.
ASSERT_EQ(5u, warnings.size());
EXPECT_EQ("Read and modify your data on api.flickr.com",
@@ -277,10 +259,9 @@ TEST(ExtensionPermissionsTest, GetPermissionMessages_ManyHostsPermissions) {
scoped_refptr<Extension> extension;
extension = LoadManifest("permissions", "more-than-3-hosts.json");
std::vector<base::string16> warnings =
- PermissionsData::ForExtension(extension)->GetPermissionMessageStrings();
+ extension->permissions_data()->GetPermissionMessageStrings();
std::vector<base::string16> warnings_details =
- PermissionsData::ForExtension(extension)
- ->GetPermissionMessageDetailsStrings();
+ extension->permissions_data()->GetPermissionMessageDetailsStrings();
ASSERT_EQ(1u, warnings.size());
ASSERT_EQ(1u, warnings_details.size());
EXPECT_EQ("Read and modify your data on 5 websites",
@@ -296,7 +277,7 @@ TEST(ExtensionPermissionsTest, GetPermissionMessages_LocationApiPermission) {
Manifest::COMPONENT,
Extension::NO_FLAGS);
std::vector<base::string16> warnings =
- PermissionsData::ForExtension(extension)->GetPermissionMessageStrings();
+ extension->permissions_data()->GetPermissionMessageStrings();
ASSERT_EQ(1u, warnings.size());
EXPECT_EQ("Detect your physical location", UTF16ToUTF8(warnings[0]));
}
@@ -305,7 +286,7 @@ TEST(ExtensionPermissionsTest, GetPermissionMessages_ManyHosts) {
scoped_refptr<Extension> extension;
extension = LoadManifest("permissions", "many-hosts.json");
std::vector<base::string16> warnings =
- PermissionsData::ForExtension(extension)->GetPermissionMessageStrings();
+ extension->permissions_data()->GetPermissionMessageStrings();
ASSERT_EQ(1u, warnings.size());
EXPECT_EQ(
"Read and modify your data on encrypted.google.com and www.google.com",
@@ -316,7 +297,7 @@ TEST(ExtensionPermissionsTest, GetPermissionMessages_Plugins) {
scoped_refptr<Extension> extension;
extension = LoadManifest("permissions", "plugins.json");
std::vector<base::string16> warnings =
- PermissionsData::ForExtension(extension)->GetPermissionMessageStrings();
+ extension->permissions_data()->GetPermissionMessageStrings();
// We don't parse the plugins key on Chrome OS, so it should not ask for any
// permissions.
#if defined(OS_CHROMEOS)
@@ -364,13 +345,13 @@ class ExtensionScriptAndCaptureVisibleTest : public testing::Test {
bool AllowedScript(const Extension* extension, const GURL& url,
const GURL& top_url, int tab_id) {
- return PermissionsData::ForExtension(extension)->CanExecuteScriptOnPage(
+ return extension->permissions_data()->CanExecuteScriptOnPage(
extension, url, top_url, tab_id, NULL, -1, NULL);
}
bool BlockedScript(const Extension* extension, const GURL& url,
const GURL& top_url) {
- return !PermissionsData::ForExtension(extension)->CanExecuteScriptOnPage(
+ return !extension->permissions_data()->CanExecuteScriptOnPage(
extension, url, top_url, -1, NULL, -1, NULL);
}
@@ -379,10 +360,9 @@ class ExtensionScriptAndCaptureVisibleTest : public testing::Test {
}
bool Allowed(const Extension* extension, const GURL& url, int tab_id) {
- return (PermissionsData::ForExtension(extension)->CanExecuteScriptOnPage(
+ return (extension->permissions_data()->CanExecuteScriptOnPage(
extension, url, url, tab_id, NULL, -1, NULL) &&
- PermissionsData::ForExtension(extension)
- ->CanCaptureVisiblePage(tab_id, NULL));
+ extension->permissions_data()->CanCaptureVisiblePage(tab_id, NULL));
}
bool CaptureOnly(const Extension* extension, const GURL& url) {
@@ -390,10 +370,9 @@ class ExtensionScriptAndCaptureVisibleTest : public testing::Test {
}
bool CaptureOnly(const Extension* extension, const GURL& url, int tab_id) {
- return !PermissionsData::ForExtension(extension)->CanExecuteScriptOnPage(
+ return !extension->permissions_data()->CanExecuteScriptOnPage(
extension, url, url, tab_id, NULL, -1, NULL) &&
- PermissionsData::ForExtension(extension)
- ->CanCaptureVisiblePage(tab_id, NULL);
+ extension->permissions_data()->CanCaptureVisiblePage(tab_id, NULL);
}
bool ScriptOnly(const Extension* extension, const GURL& url,
@@ -404,8 +383,7 @@ class ExtensionScriptAndCaptureVisibleTest : public testing::Test {
bool ScriptOnly(const Extension* extension, const GURL& url,
const GURL& top_url, int tab_id) {
return AllowedScript(extension, url, top_url, tab_id) &&
- !PermissionsData::ForExtension(extension)
- ->CanCaptureVisiblePage(tab_id, NULL);
+ !extension->permissions_data()->CanCaptureVisiblePage(tab_id, NULL);
}
bool Blocked(const Extension* extension, const GURL& url) {
@@ -413,10 +391,10 @@ class ExtensionScriptAndCaptureVisibleTest : public testing::Test {
}
bool Blocked(const Extension* extension, const GURL& url, int tab_id) {
- return !(PermissionsData::ForExtension(extension)->CanExecuteScriptOnPage(
+ return !(extension->permissions_data()->CanExecuteScriptOnPage(
extension, url, url, tab_id, NULL, -1, NULL) ||
- PermissionsData::ForExtension(extension)
- ->CanCaptureVisiblePage(tab_id, NULL));
+ extension->permissions_data()->CanCaptureVisiblePage(tab_id,
+ NULL));
}
bool ScriptAllowedExclusivelyOnTab(
@@ -477,12 +455,9 @@ TEST_F(ExtensionScriptAndCaptureVisibleTest, Permissions) {
EXPECT_TRUE(BlockedScript(extension.get(), http_url, extension_url));
EXPECT_TRUE(BlockedScript(extension.get(), https_url, extension_url));
- EXPECT_FALSE(PermissionsData::ForExtension(extension)
- ->HasHostPermission(settings_url));
- EXPECT_FALSE(
- PermissionsData::ForExtension(extension)->HasHostPermission(about_url));
- EXPECT_TRUE(
- PermissionsData::ForExtension(extension)->HasHostPermission(favicon_url));
+ EXPECT_FALSE(extension->permissions_data()->HasHostPermission(settings_url));
+ EXPECT_FALSE(extension->permissions_data()->HasHostPermission(about_url));
+ EXPECT_TRUE(extension->permissions_data()->HasHostPermission(favicon_url));
// Test * for scheme, which implies just the http/https schemes.
extension = LoadManifestStrict("script_and_capture",
@@ -520,8 +495,7 @@ TEST_F(ExtensionScriptAndCaptureVisibleTest, Permissions) {
EXPECT_TRUE(Blocked(extension.get(), settings_url));
EXPECT_TRUE(Blocked(extension.get(), favicon_url));
EXPECT_TRUE(Blocked(extension.get(), about_url));
- EXPECT_TRUE(
- PermissionsData::ForExtension(extension)->HasHostPermission(favicon_url));
+ EXPECT_TRUE(extension->permissions_data()->HasHostPermission(favicon_url));
// Having http://favicon should not give you chrome://favicon
extension = LoadManifestStrict("script_and_capture",
@@ -537,8 +511,7 @@ TEST_F(ExtensionScriptAndCaptureVisibleTest, Permissions) {
EXPECT_TRUE(Allowed(extension.get(), settings_url));
EXPECT_TRUE(Allowed(extension.get(), about_url));
EXPECT_TRUE(Allowed(extension.get(), favicon_url));
- EXPECT_TRUE(
- PermissionsData::ForExtension(extension)->HasHostPermission(favicon_url));
+ EXPECT_TRUE(extension->permissions_data()->HasHostPermission(favicon_url));
// Component extensions should only get access to what they ask for.
extension = LoadManifest("script_and_capture",
@@ -551,8 +524,7 @@ TEST_F(ExtensionScriptAndCaptureVisibleTest, Permissions) {
EXPECT_TRUE(Blocked(extension.get(), favicon_url));
EXPECT_TRUE(Blocked(extension.get(), about_url));
EXPECT_TRUE(Blocked(extension.get(), extension_url));
- EXPECT_FALSE(PermissionsData::ForExtension(extension)
- ->HasHostPermission(settings_url));
+ EXPECT_FALSE(extension->permissions_data()->HasHostPermission(settings_url));
}
TEST_F(ExtensionScriptAndCaptureVisibleTest, PermissionsWithChromeURLsEnabled) {
@@ -581,8 +553,7 @@ TEST_F(ExtensionScriptAndCaptureVisibleTest, PermissionsWithChromeURLsEnabled) {
EXPECT_TRUE(BlockedScript(extension.get(), http_url, extension_url));
EXPECT_TRUE(BlockedScript(extension.get(), https_url, extension_url));
- const PermissionsData* permissions_data =
- PermissionsData::ForExtension(extension);
+ const PermissionsData* permissions_data = extension->permissions_data();
EXPECT_FALSE(permissions_data->HasHostPermission(settings_url));
EXPECT_FALSE(permissions_data->HasHostPermission(about_url));
EXPECT_TRUE(permissions_data->HasHostPermission(favicon_url));
@@ -621,8 +592,7 @@ TEST_F(ExtensionScriptAndCaptureVisibleTest, PermissionsWithChromeURLsEnabled) {
EXPECT_TRUE(Blocked(extension.get(), settings_url));
EXPECT_TRUE(ScriptOnly(extension.get(), favicon_url, favicon_url));
EXPECT_TRUE(Blocked(extension.get(), about_url));
- EXPECT_TRUE(
- PermissionsData::ForExtension(extension)->HasHostPermission(favicon_url));
+ EXPECT_TRUE(extension->permissions_data()->HasHostPermission(favicon_url));
// Having http://favicon should not give you chrome://favicon
extension = LoadManifestStrict("script_and_capture",
@@ -638,8 +608,7 @@ TEST_F(ExtensionScriptAndCaptureVisibleTest, PermissionsWithChromeURLsEnabled) {
EXPECT_TRUE(Allowed(extension.get(), settings_url));
EXPECT_TRUE(Allowed(extension.get(), about_url));
EXPECT_TRUE(Allowed(extension.get(), favicon_url));
- EXPECT_TRUE(
- PermissionsData::ForExtension(extension)->HasHostPermission(favicon_url));
+ EXPECT_TRUE(extension->permissions_data()->HasHostPermission(favicon_url));
// Component extensions should only get access to what they ask for.
extension = LoadManifest("script_and_capture",
@@ -652,16 +621,14 @@ TEST_F(ExtensionScriptAndCaptureVisibleTest, PermissionsWithChromeURLsEnabled) {
EXPECT_TRUE(Blocked(extension.get(), favicon_url));
EXPECT_TRUE(Blocked(extension.get(), about_url));
EXPECT_TRUE(Blocked(extension.get(), extension_url));
- EXPECT_FALSE(PermissionsData::ForExtension(extension)
- ->HasHostPermission(settings_url));
+ EXPECT_FALSE(extension->permissions_data()->HasHostPermission(settings_url));
}
TEST_F(ExtensionScriptAndCaptureVisibleTest, TabSpecific) {
scoped_refptr<Extension> extension =
LoadManifestStrict("script_and_capture", "tab_specific.json");
- const PermissionsData* permissions_data =
- PermissionsData::ForExtension(extension);
+ const PermissionsData* permissions_data = extension->permissions_data();
EXPECT_FALSE(permissions_data->GetTabSpecificPermissionsForTesting(0));
EXPECT_FALSE(permissions_data->GetTabSpecificPermissionsForTesting(1));
EXPECT_FALSE(permissions_data->GetTabSpecificPermissionsForTesting(2));
diff --git a/extensions/renderer/dispatcher.cc b/extensions/renderer/dispatcher.cc
index 96de05b..cfa6afd6 100644
--- a/extensions/renderer/dispatcher.cc
+++ b/extensions/renderer/dispatcher.cc
@@ -750,7 +750,7 @@ void Dispatcher::OnUpdatePermissions(
break;
}
- PermissionsData::ForExtension(extension)->SetActivePermissions(new_active);
+ extension->permissions_data()->SetActivePermissions(new_active);
UpdateOriginPermissions(reason, extension, explicit_hosts);
UpdateBindings(extension->id());
}
@@ -803,7 +803,7 @@ void Dispatcher::InitOriginPermissions(const Extension* extension,
UpdateOriginPermissions(
UpdatedExtensionPermissionsInfo::ADDED,
extension,
- PermissionsData::ForExtension(extension)->GetEffectiveHostPermissions());
+ extension->permissions_data()->GetEffectiveHostPermissions());
}
void Dispatcher::UpdateOriginPermissions(
diff --git a/extensions/renderer/script_injection.cc b/extensions/renderer/script_injection.cc
index 5299bd4..c7eb9a4 100644
--- a/extensions/renderer/script_injection.cc
+++ b/extensions/renderer/script_injection.cc
@@ -154,10 +154,8 @@ void ScriptInjection::InjectIfAllowed(blink::WebFrame* frame,
// valid tab id (if we don't have a tab id, we have no UI surface to ask for
// user consent).
if (tab_id != -1 &&
- PermissionsData::ForExtension(extension)
- ->RequiresActionForScriptExecution(extension,
- tab_id,
- frame->top()->document().url())) {
+ extension->permissions_data()->RequiresActionForScriptExecution(
+ extension, tab_id, frame->top()->document().url())) {
int64 request_id = kInvalidRequestId;
int page_id = top_render_view->GetPageId();
@@ -256,14 +254,14 @@ bool ScriptInjection::WantsToRun(blink::WebFrame* frame,
GURL effective_document_url = ScriptContext::GetEffectiveDocumentURL(
frame, document_url, script_->match_about_blank());
- if (!PermissionsData::ForExtension(extension)
- ->CanExecuteScriptOnPage(extension,
- effective_document_url,
- frame->top()->document().url(),
- kNoTabId,
- script_.get(),
- kNoProcessId,
- NULL /* ignore error */)) {
+ if (!extension->permissions_data()->CanExecuteScriptOnPage(
+ extension,
+ effective_document_url,
+ frame->top()->document().url(),
+ kNoTabId,
+ script_.get(),
+ kNoProcessId,
+ NULL /* ignore error */)) {
return false;
}
diff --git a/extensions/renderer/user_script_scheduler.cc b/extensions/renderer/user_script_scheduler.cc
index 2214c77..4058daa 100644
--- a/extensions/renderer/user_script_scheduler.cc
+++ b/extensions/renderer/user_script_scheduler.cc
@@ -192,14 +192,14 @@ void UserScriptScheduler::ExecuteCodeImpl(
GURL document_url = ScriptContext::GetEffectiveDocumentURL(
child_frame, child_frame->document().url(), params.match_about_blank);
bool can_execute_script =
- PermissionsData::ForExtension(extension)
- ->CanExecuteScriptOnPage(extension,
- document_url,
- top_url,
- extension_helper->tab_id(),
- NULL,
- -1,
- NULL);
+ extension->permissions_data()->CanExecuteScriptOnPage(
+ extension,
+ document_url,
+ top_url,
+ extension_helper->tab_id(),
+ NULL,
+ -1,
+ NULL);
if ((!params.is_web_view && !can_execute_script) ||
(params.is_web_view && document_url != params.webview_src)) {
if (child_frame->parent()) {