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

Unified Diff: extensions/renderer/script_injection.h

Issue 934763003: Refactoring: de-couple Extensions from "script injection System" [render side]:3 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@decouple_brower_isolated_world_routingid_user_script_1
Patch Set: Created 5 years, 10 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: extensions/renderer/script_injection.h
diff --git a/extensions/renderer/script_injection.h b/extensions/renderer/script_injection.h
index 6c265894e145f3eb1577a3f3d8de0f3b20b3090c..a55c6e645949beaac5355abfb7046e205dbef096 100644
--- a/extensions/renderer/script_injection.h
+++ b/extensions/renderer/script_injection.h
@@ -8,9 +8,9 @@
#include "base/basictypes.h"
#include "base/macros.h"
#include "extensions/common/user_script.h"
+#include "extensions/renderer/injection_host.h"
#include "extensions/renderer/script_injector.h"
-class InjectionHost;
struct HostID;
namespace blink {
@@ -33,7 +33,7 @@ class ScriptInjection {
ScriptInjection(
scoped_ptr<ScriptInjector> injector,
blink::WebLocalFrame* web_frame,
- const HostID& host_id,
+ scoped_ptr<const InjectionHost> injection_host,
const UserScript::ConsumerInstanceType& consumer_instance_type,
UserScript::RunLocation run_location,
int tab_id);
@@ -53,9 +53,14 @@ class ScriptInjection {
bool OnPermissionGranted(const InjectionHost* injection_host,
ScriptsRunInfo* scripts_run_info);
+ // Gets the associated injection host. If the host is an extension, we check
+ // whether the extension exists first; and if the extension is gone, will
+ // return a nullptr.
+ const InjectionHost* GetInjectionHost();
+
// Accessors.
blink::WebLocalFrame* web_frame() const { return web_frame_; }
- const HostID& host_id() const { return host_id_; }
+ const HostID& host_id() const { return injection_host_->id(); }
int64 request_id() const { return request_id_; }
private:
@@ -84,8 +89,8 @@ class ScriptInjection {
// The (main) WebFrame into which this should inject the script.
blink::WebLocalFrame* web_frame_;
- // The id of the associated injection_host.
- HostID host_id_;
+ // The associated injection host.
+ scoped_ptr<const InjectionHost> injection_host_;
// The type of the instance on which the host will inject the script.
UserScript::ConsumerInstanceType consumer_instance_type_;

Powered by Google App Engine
This is Rietveld 408576698