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

Side by Side Diff: extensions/renderer/script_injection.cc

Issue 315573003: Remove PermissionsData::ForExtension() completely (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
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 "extensions/renderer/script_injection.h" 5 #include "extensions/renderer/script_injection.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 return false; 249 return false;
250 250
251 // Content scripts are not tab-specific. 251 // Content scripts are not tab-specific.
252 static const int kNoTabId = -1; 252 static const int kNoTabId = -1;
253 // We don't have a process id in this context. 253 // We don't have a process id in this context.
254 static const int kNoProcessId = -1; 254 static const int kNoProcessId = -1;
255 255
256 GURL effective_document_url = ScriptContext::GetEffectiveDocumentURL( 256 GURL effective_document_url = ScriptContext::GetEffectiveDocumentURL(
257 frame, document_url, script_->match_about_blank()); 257 frame, document_url, script_->match_about_blank());
258 258
259 if (!PermissionsData::ForExtension(extension) 259 if (!extension->permissions_data()->CanExecuteScriptOnPage(
260 ->CanExecuteScriptOnPage(extension, 260 extension,
261 effective_document_url, 261 effective_document_url,
262 frame->top()->document().url(), 262 frame->top()->document().url(),
263 kNoTabId, 263 kNoTabId,
264 script_.get(), 264 script_.get(),
265 kNoProcessId, 265 kNoProcessId,
266 NULL /* ignore error */)) { 266 NULL /* ignore error */)) {
267 return false; 267 return false;
268 } 268 }
269 269
270 return ShouldInjectCSS(run_location) || ShouldInjectJS(run_location); 270 return ShouldInjectCSS(run_location) || ShouldInjectJS(run_location);
271 } 271 }
272 272
273 void ScriptInjection::Inject(blink::WebFrame* frame, 273 void ScriptInjection::Inject(blink::WebFrame* frame,
274 UserScript::RunLocation run_location, 274 UserScript::RunLocation run_location,
275 ScriptsRunInfo* scripts_run_info) const { 275 ScriptsRunInfo* scripts_run_info) const {
276 DCHECK(frame); 276 DCHECK(frame);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 scripts_run_info->num_css += css_scripts.size(); 349 scripts_run_info->num_css += css_scripts.size();
350 for (UserScript::FileList::const_iterator iter = css_scripts.begin(); 350 for (UserScript::FileList::const_iterator iter = css_scripts.begin();
351 iter != css_scripts.end(); 351 iter != css_scripts.end();
352 ++iter) { 352 ++iter) {
353 frame->document().insertStyleSheet( 353 frame->document().insertStyleSheet(
354 blink::WebString::fromUTF8(iter->GetContent().as_string())); 354 blink::WebString::fromUTF8(iter->GetContent().as_string()));
355 } 355 }
356 } 356 }
357 357
358 } // namespace extensions 358 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698