Index: extensions/browser/guest_view/web_view/web_view_guest.h |
diff --git a/extensions/browser/guest_view/web_view/web_view_guest.h b/extensions/browser/guest_view/web_view/web_view_guest.h |
index cb190d9230b27414932897b33d77a9821599d5b6..408ce0acb3429bb6570d5cd4d8a66651b0917d1c 100644 |
--- a/extensions/browser/guest_view/web_view/web_view_guest.h |
+++ b/extensions/browser/guest_view/web_view/web_view_guest.h |
@@ -25,6 +25,7 @@ struct WebFindOptions; |
namespace extensions { |
+class DeclarativeUserScriptMaster; |
class WebViewInternalFindFunction; |
// A WebViewGuest provides the browser-side implementation of the <webview> API |
@@ -235,11 +236,27 @@ class WebViewGuest : public GuestView<WebViewGuest>, |
uint32 removal_mask, |
const base::Closure& callback); |
+ // Adds content script to inject on the guest. |
+ void AddContentScripts(const std::string& script_name, |
+ const UserScript& script); |
+ |
+ // Removes content script by |script_name|. |
+ void RemoveContentScripts(const std::string& script_name); |
+ |
+ // Removes all content scripts added by the guest. |
+ void RemoveAllContentScripts(); |
+ |
ScriptExecutor* script_executor() { return script_executor_.get(); } |
+ const HostID* host_id() const { return host_id_.get(); } |
+ void set_host_id(scoped_ptr<const HostID> host_id) { |
+ host_id_ = host_id.Pass(); |
+ } |
private: |
friend class WebViewPermissionHelper; |
+ using UserScriptMap = std::map<std::string, UserScript>; |
+ |
explicit WebViewGuest(content::WebContents* owner_web_contents); |
~WebViewGuest() override; |
@@ -372,6 +389,13 @@ class WebViewGuest : public GuestView<WebViewGuest>, |
// Determines if this guest accepts pinch-zoom gestures. |
bool allow_scaling_; |
+ // The ID of the injection host of the guest. |
+ scoped_ptr<const HostID> host_id_; |
+ |
+ DeclarativeUserScriptMaster* master_; |
+ |
+ UserScriptMap user_script_map_; |
+ |
// This is used to ensure pending tasks will not fire after this object is |
// destroyed. |
base::WeakPtrFactory<WebViewGuest> weak_ptr_factory_; |