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

Unified Diff: chrome/browser/extensions/api/tabs/tabs_api.cc

Issue 14651017: Move RuntimeData and related permissions out of Extension class (Closed) Base URL: http://git.chromium.org/chromium/src.git@dc_unref_permissions
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/tabs/tabs_api.cc
diff --git a/chrome/browser/extensions/api/tabs/tabs_api.cc b/chrome/browser/extensions/api/tabs/tabs_api.cc
index 650b8744550d13e90a31b29ad2ce5f23af16bb9c..f5885d4ff267052c6538e2e8820b81cbed8e075d 100644
--- a/chrome/browser/extensions/api/tabs/tabs_api.cc
+++ b/chrome/browser/extensions/api/tabs/tabs_api.cc
@@ -60,6 +60,7 @@
#include "chrome/common/extensions/extension_messages.h"
#include "chrome/common/extensions/incognito_handler.h"
#include "chrome/common/extensions/message_bundle.h"
+#include "chrome/common/extensions/permissions/permissions_data.h"
#include "chrome/common/extensions/user_script.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
@@ -1409,7 +1410,8 @@ bool TabsUpdateFunction::UpdateURLIfPresent(DictionaryValue* update_props,
// JavaScript URLs can do the same kinds of things as cross-origin XHR, so
// we need to check host permissions before allowing them.
if (url.SchemeIs(chrome::kJavaScriptScheme)) {
- if (!GetExtension()->CanExecuteScriptOnPage(
+ if (!extensions::PermissionsData::CanExecuteScriptOnPage(
+ GetExtension(),
web_contents_->GetURL(),
web_contents_->GetURL(),
tab_id,
@@ -1740,9 +1742,11 @@ bool TabsCaptureVisibleTabFunction::RunImpl() {
web_contents->GetController().GetLastCommittedEntry();
GURL last_committed_url = last_committed_entry ?
last_committed_entry->GetURL() : GURL();
- if (!GetExtension()->CanCaptureVisiblePage(last_committed_url,
- SessionID::IdForTab(web_contents),
- &error_)) {
+ if (!extensions::PermissionsData::CanCaptureVisiblePage(
+ GetExtension(),
+ last_committed_url,
+ SessionID::IdForTab(web_contents),
+ &error_)) {
return false;
}
@@ -1950,8 +1954,8 @@ ExecuteCodeInTabFunction::~ExecuteCodeInTabFunction() {}
bool ExecuteCodeInTabFunction::HasPermission() {
if (Init() &&
- extension_->HasAPIPermissionForTab(execute_tab_id_,
- extensions::APIPermission::kTab)) {
+ extensions::PermissionsData::HasAPIPermissionForTab(
+ extension_, execute_tab_id_, extensions::APIPermission::kTab)) {
return true;
}
return ExtensionFunction::HasPermission();
@@ -1983,11 +1987,12 @@ bool ExecuteCodeInTabFunction::RunImpl() {
// NOTE: This can give the wrong answer due to race conditions, but it is OK,
// we check again in the renderer.
CHECK(contents);
- if (!GetExtension()->CanExecuteScriptOnPage(contents->GetURL(),
- contents->GetURL(),
- execute_tab_id_,
- NULL,
- &error_)) {
+ if (!extensions::PermissionsData::CanExecuteScriptOnPage(GetExtension(),
+ contents->GetURL(),
+ contents->GetURL(),
+ execute_tab_id_,
+ NULL,
+ &error_)) {
return false;
}

Powered by Google App Engine
This is Rietveld 408576698