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

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: Latest master 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
« no previous file with comments | « chrome/browser/extensions/api/socket/socket_api.cc ('k') | chrome/browser/extensions/api/usb/usb_api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2d06ca43793cf58664bee13924c61b3087c62eb4..6e0f8ab4e912adcf319ff976e7a067fafcbd7fdb 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"
@@ -1394,7 +1395,8 @@ bool TabsUpdateFunction::UpdateURL(const std::string &url_string,
// 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 (!PermissionsData::CanExecuteScriptOnPage(
+ GetExtension(),
web_contents_->GetURL(),
web_contents_->GetURL(),
tab_id,
@@ -1738,9 +1740,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 (!PermissionsData::CanCaptureVisiblePage(
+ GetExtension(),
+ last_committed_url,
+ SessionID::IdForTab(web_contents),
+ &error_)) {
return false;
}
@@ -1952,8 +1956,8 @@ ExecuteCodeInTabFunction::~ExecuteCodeInTabFunction() {}
bool ExecuteCodeInTabFunction::HasPermission() {
if (Init() &&
- extension_->HasAPIPermissionForTab(execute_tab_id_,
- APIPermission::kTab)) {
+ PermissionsData::HasAPIPermissionForTab(
+ extension_, execute_tab_id_, APIPermission::kTab)) {
return true;
}
return ExtensionFunction::HasPermission();
@@ -1975,11 +1979,12 @@ bool ExecuteCodeInTabFunction::CanExecuteScriptOnPage() {
// NOTE: This can give the wrong answer due to race conditions, but it is OK,
// we check again in the renderer.
- if (!GetExtension()->CanExecuteScriptOnPage(contents->GetURL(),
- contents->GetURL(),
- execute_tab_id_,
- NULL,
- &error_)) {
+ if (!PermissionsData::CanExecuteScriptOnPage(GetExtension(),
+ contents->GetURL(),
+ contents->GetURL(),
+ execute_tab_id_,
+ NULL,
+ &error_)) {
return false;
}
« no previous file with comments | « chrome/browser/extensions/api/socket/socket_api.cc ('k') | chrome/browser/extensions/api/usb/usb_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698