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

Side by Side Diff: extensions/browser/api/guest_view/web_view/web_view_internal_api.h

Issue 959413003: Implement <webview>.addContentScript/removeContentScript API [1] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make the API work before the first navigation of guest. Created 5 years, 9 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 #ifndef EXTENSIONS_BROWSER_API_WEB_VIEW_WEB_VIEW_INTERNAL_API_H_ 5 #ifndef EXTENSIONS_BROWSER_API_WEB_VIEW_WEB_VIEW_INTERNAL_API_H_
6 #define EXTENSIONS_BROWSER_API_WEB_VIEW_WEB_VIEW_INTERNAL_API_H_ 6 #define EXTENSIONS_BROWSER_API_WEB_VIEW_WEB_VIEW_INTERNAL_API_H_
7 7
8 #include "extensions/browser/api/capture_web_contents_function.h" 8 #include "extensions/browser/api/capture_web_contents_function.h"
9 #include "extensions/browser/api/execute_code_function.h" 9 #include "extensions/browser/api/execute_code_function.h"
10 #include "extensions/browser/extension_function.h" 10 #include "extensions/browser/extension_function.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 108
109 bool ShouldInsertCSS() const override; 109 bool ShouldInsertCSS() const override;
110 110
111 DECLARE_EXTENSION_FUNCTION("webViewInternal.insertCSS", 111 DECLARE_EXTENSION_FUNCTION("webViewInternal.insertCSS",
112 WEBVIEWINTERNAL_INSERTCSS) 112 WEBVIEWINTERNAL_INSERTCSS)
113 113
114 private: 114 private:
115 DISALLOW_COPY_AND_ASSIGN(WebViewInternalInsertCSSFunction); 115 DISALLOW_COPY_AND_ASSIGN(WebViewInternalInsertCSSFunction);
116 }; 116 };
117 117
118 class WebViewInternalAddContentScriptsFunction : public AsyncExtensionFunction {
119 public:
120 DECLARE_EXTENSION_FUNCTION("webViewInternal.addContentScripts",
121 WEBVIEWINTERNAL_ADDCONTENTSCRIPTS);
122
123 WebViewInternalAddContentScriptsFunction();
124
125 const HostID& host_id() const { return host_id_; }
126 void set_host_id(HostID host_id) { host_id_ = host_id; }
127
128 protected:
129 ~WebViewInternalAddContentScriptsFunction() override;
130
131 private:
132 bool RunAsync() override;
133
134 // The ID of the injection host.
135 HostID host_id_;
136
137 // The instance ID of the <*view> element.
138 int guest_view_instance_id_;
139
140 DISALLOW_COPY_AND_ASSIGN(WebViewInternalAddContentScriptsFunction);
141 };
142
143 class WebViewInternalRemoveContentScriptsFunction
144 : public AsyncExtensionFunction {
145 public:
146 DECLARE_EXTENSION_FUNCTION("webViewInternal.removeContentScripts",
147 WEBVIEWINTERNAL_REMOVECONTENTSCRIPTS);
148
149 WebViewInternalRemoveContentScriptsFunction();
150
151 protected:
152 ~WebViewInternalRemoveContentScriptsFunction() override;
153
154 private:
155 bool RunAsync() override;
156
157 DISALLOW_COPY_AND_ASSIGN(WebViewInternalRemoveContentScriptsFunction);
158 };
159
118 class WebViewInternalSetNameFunction : public WebViewInternalExtensionFunction { 160 class WebViewInternalSetNameFunction : public WebViewInternalExtensionFunction {
119 public: 161 public:
120 DECLARE_EXTENSION_FUNCTION("webViewInternal.setName", 162 DECLARE_EXTENSION_FUNCTION("webViewInternal.setName",
121 WEBVIEWINTERNAL_SETNAME); 163 WEBVIEWINTERNAL_SETNAME);
122 164
123 WebViewInternalSetNameFunction(); 165 WebViewInternalSetNameFunction();
124 166
125 protected: 167 protected:
126 ~WebViewInternalSetNameFunction() override; 168 ~WebViewInternalSetNameFunction() override;
127 169
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 uint32 remove_mask_; 419 uint32 remove_mask_;
378 // Tracks any data related or parse errors. 420 // Tracks any data related or parse errors.
379 bool bad_message_; 421 bool bad_message_;
380 422
381 DISALLOW_COPY_AND_ASSIGN(WebViewInternalClearDataFunction); 423 DISALLOW_COPY_AND_ASSIGN(WebViewInternalClearDataFunction);
382 }; 424 };
383 425
384 } // namespace extensions 426 } // namespace extensions
385 427
386 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_VIEW_WEB_VIEW_INTERNAL_API_H_ 428 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_VIEW_WEB_VIEW_INTERNAL_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698