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

Side by Side Diff: extensions/renderer/script_injection_manager.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: Fix extension page content scripts 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
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_manager.h" 5 #include "extensions/renderer/script_injection_manager.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 364
365 void ScriptInjectionManager::TryToInject( 365 void ScriptInjectionManager::TryToInject(
366 scoped_ptr<ScriptInjection> injection, 366 scoped_ptr<ScriptInjection> injection,
367 UserScript::RunLocation run_location, 367 UserScript::RunLocation run_location,
368 ScriptsRunInfo* scripts_run_info) { 368 ScriptsRunInfo* scripts_run_info) {
369 // Try to inject the script. If the injection is waiting (i.e., for 369 // Try to inject the script. If the injection is waiting (i.e., for
370 // permission), add it to the list of pending injections. If the injection 370 // permission), add it to the list of pending injections. If the injection
371 // has blocked, add it to the list of running injections. 371 // has blocked, add it to the list of running injections.
372 // The Unretained below is safe because this object owns all the 372 // The Unretained below is safe because this object owns all the
373 // ScriptInjections, so is guaranteed to outlive them. 373 // ScriptInjections, so is guaranteed to outlive them.
374 LOG(WARNING) << "Trying to inject!";
not at google - send to devlin 2015/06/03 20:15:45 oops
Devlin 2015/06/03 20:28:47 Very oops.
374 switch (injection->TryToInject( 375 switch (injection->TryToInject(
375 run_location, 376 run_location,
376 scripts_run_info, 377 scripts_run_info,
377 base::Bind(&ScriptInjectionManager::OnInjectionFinished, 378 base::Bind(&ScriptInjectionManager::OnInjectionFinished,
378 base::Unretained(this)))) { 379 base::Unretained(this)))) {
379 case ScriptInjection::INJECTION_WAITING: 380 case ScriptInjection::INJECTION_WAITING:
380 pending_injections_.push_back(injection.Pass()); 381 pending_injections_.push_back(injection.Pass());
381 break; 382 break;
382 case ScriptInjection::INJECTION_BLOCKED: 383 case ScriptInjection::INJECTION_BLOCKED:
383 running_injections_.push_back(injection.Pass()); 384 running_injections_.push_back(injection.Pass());
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 467
467 ScriptsRunInfo scripts_run_info; 468 ScriptsRunInfo scripts_run_info;
468 ScriptInjection::InjectionResult res = injection->OnPermissionGranted( 469 ScriptInjection::InjectionResult res = injection->OnPermissionGranted(
469 &scripts_run_info); 470 &scripts_run_info);
470 if (res == ScriptInjection::INJECTION_BLOCKED) 471 if (res == ScriptInjection::INJECTION_BLOCKED)
471 running_injections_.push_back(injection.Pass()); 472 running_injections_.push_back(injection.Pass());
472 scripts_run_info.LogRun(injection->web_frame(), UserScript::RUN_DEFERRED); 473 scripts_run_info.LogRun(injection->web_frame(), UserScript::RUN_DEFERRED);
473 } 474 }
474 475
475 } // namespace extensions 476 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698