summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-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
42 files changed, 141 insertions, 167 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;
}