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

Side by Side Diff: chrome/browser/extensions/active_script_controller.cc

Issue 1150683007: [Extensions] Use document url (not top url) for tab-specific permissions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/extensions/active_tab_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/active_script_controller.h" 5 #include "chrome/browser/extensions/active_script_controller.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 134
135 // Allow the extension if it's been explicitly granted permission. 135 // Allow the extension if it's been explicitly granted permission.
136 if (permitted_extensions_.count(extension->id()) > 0) 136 if (permitted_extensions_.count(extension->id()) > 0)
137 return PermissionsData::ACCESS_ALLOWED; 137 return PermissionsData::ACCESS_ALLOWED;
138 138
139 GURL url = web_contents()->GetVisibleURL(); 139 GURL url = web_contents()->GetVisibleURL();
140 int tab_id = SessionTabHelper::IdForTab(web_contents()); 140 int tab_id = SessionTabHelper::IdForTab(web_contents());
141 switch (type) { 141 switch (type) {
142 case UserScript::CONTENT_SCRIPT: 142 case UserScript::CONTENT_SCRIPT:
143 return extension->permissions_data()->GetContentScriptAccess( 143 return extension->permissions_data()->GetContentScriptAccess(
144 extension, url, url, tab_id, -1, NULL); 144 extension, url, tab_id, -1, NULL);
145 case UserScript::PROGRAMMATIC_SCRIPT: 145 case UserScript::PROGRAMMATIC_SCRIPT:
146 return extension->permissions_data()->GetPageAccess( 146 return extension->permissions_data()->GetPageAccess(
147 extension, url, url, tab_id, -1, NULL); 147 extension, url, tab_id, -1, NULL);
148 } 148 }
149 149
150 NOTREACHED(); 150 NOTREACHED();
151 return PermissionsData::ACCESS_DENIED; 151 return PermissionsData::ACCESS_DENIED;
152 } 152 }
153 153
154 void ActiveScriptController::RequestScriptInjection( 154 void ActiveScriptController::RequestScriptInjection(
155 const Extension* extension, 155 const Extension* extension,
156 const base::Closure& callback) { 156 const base::Closure& callback) {
157 CHECK(extension); 157 CHECK(extension);
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 UnloadedExtensionInfo::Reason reason) { 330 UnloadedExtensionInfo::Reason reason) {
331 PendingRequestMap::iterator iter = pending_requests_.find(extension->id()); 331 PendingRequestMap::iterator iter = pending_requests_.find(extension->id());
332 if (iter != pending_requests_.end()) { 332 if (iter != pending_requests_.end()) {
333 pending_requests_.erase(iter); 333 pending_requests_.erase(iter);
334 ExtensionActionAPI::Get(browser_context_)-> 334 ExtensionActionAPI::Get(browser_context_)->
335 NotifyPageActionsChanged(web_contents()); 335 NotifyPageActionsChanged(web_contents());
336 } 336 }
337 } 337 }
338 338
339 } // namespace extensions 339 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/active_tab_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698