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

Side by Side Diff: third_party/WebKit/public/web/WebLocalFrame.h

Issue 2922803003: Move most scripting-related methods from WebFrame to WebLocalFrame. (Closed)
Patch Set: Rebasing... Created 3 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
« no previous file with comments | « third_party/WebKit/public/web/WebFrame.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 WebLocalFrame_h 5 #ifndef WebLocalFrame_h
6 #define WebLocalFrame_h 6 #define WebLocalFrame_h
7 7
8 #include <set> 8 #include <set>
9 #include "WebCompositionUnderline.h" 9 #include "WebCompositionUnderline.h"
10 #include "WebFrame.h" 10 #include "WebFrame.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 class WebTextCheckClient; 43 class WebTextCheckClient;
44 class WebURLLoader; 44 class WebURLLoader;
45 enum class WebCachePolicy; 45 enum class WebCachePolicy;
46 enum class WebSandboxFlags; 46 enum class WebSandboxFlags;
47 enum class WebTreeScopeType; 47 enum class WebTreeScopeType;
48 struct WebConsoleMessage; 48 struct WebConsoleMessage;
49 struct WebContentSecurityPolicyViolation; 49 struct WebContentSecurityPolicyViolation;
50 struct WebFindOptions; 50 struct WebFindOptions;
51 struct WebFloatRect; 51 struct WebFloatRect;
52 struct WebPrintPresetOptions; 52 struct WebPrintPresetOptions;
53 struct WebScriptSource;
53 struct WebSourceLocation; 54 struct WebSourceLocation;
54 55
55 // Interface for interacting with in process frames. This contains methods that 56 // Interface for interacting with in process frames. This contains methods that
56 // require interacting with a frame's document. 57 // require interacting with a frame's document.
57 // FIXME: Move lots of methods from WebFrame in here. 58 // FIXME: Move lots of methods from WebFrame in here.
58 class WebLocalFrame : public WebFrame { 59 class WebLocalFrame : public WebFrame {
59 public: 60 public:
60 // Creates a WebFrame. Delete this WebFrame by calling WebFrame::close(). 61 // Creates a WebFrame. Delete this WebFrame by calling WebFrame::close().
61 // WebFrameClient may not be null. 62 // WebFrameClient may not be null.
62 BLINK_EXPORT static WebLocalFrame* Create(WebTreeScopeType, 63 BLINK_EXPORT static WebLocalFrame* Create(WebTreeScopeType,
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 // Returns the value for a page property that is only defined when printing. 291 // Returns the value for a page property that is only defined when printing.
291 // printBegin must have been called before this method. 292 // printBegin must have been called before this method.
292 virtual WebString PageProperty(const WebString& property_name, 293 virtual WebString PageProperty(const WebString& property_name,
293 int page_index) = 0; 294 int page_index) = 0;
294 295
295 // Scripting -------------------------------------------------------------- 296 // Scripting --------------------------------------------------------------
296 297
297 // Executes script in the context of the current page. 298 // Executes script in the context of the current page.
298 virtual void ExecuteScript(const WebScriptSource&) = 0; 299 virtual void ExecuteScript(const WebScriptSource&) = 0;
299 300
301 // Executes JavaScript in a new world associated with the web frame.
302 // The script gets its own global scope and its own prototypes for
303 // intrinsic JavaScript objects (String, Array, and so-on). It also
304 // gets its own wrappers for all DOM nodes and DOM constructors.
305 //
306 // worldID must be > 0 (as 0 represents the main world).
307 // worldID must be < EmbedderWorldIdLimit, high number used internally.
308 virtual void ExecuteScriptInIsolatedWorld(int world_id,
309 const WebScriptSource* sources,
310 unsigned num_sources) = 0;
311
312 // worldID must be > 0 (as 0 represents the main world).
313 // worldID must be < EmbedderWorldIdLimit, high number used internally.
314 // DEPRECATED: Use WebLocalFrame::requestExecuteScriptInIsolatedWorld.
315 virtual void ExecuteScriptInIsolatedWorld(
316 int world_id,
317 const WebScriptSource* sources_in,
318 unsigned num_sources,
319 WebVector<v8::Local<v8::Value>>* results) = 0;
320
321 // Associates an isolated world (see above for description) with a security
322 // origin. XMLHttpRequest instances used in that world will be considered
323 // to come from that origin, not the frame's.
324 virtual void SetIsolatedWorldSecurityOrigin(int world_id,
325 const WebSecurityOrigin&) = 0;
326
327 // Associates a content security policy with an isolated world. This policy
328 // should be used when evaluating script in the isolated world, and should
329 // also replace a protected resource's CSP when evaluating resources
330 // injected into the DOM.
331 //
332 // FIXME: Setting this simply bypasses the protected resource's CSP. It
333 // doesn't yet restrict the isolated world to the provided policy.
334 virtual void SetIsolatedWorldContentSecurityPolicy(int world_id,
335 const WebString&) = 0;
336
337 // Calls window.gc() if it is defined.
338 virtual void CollectGarbage() = 0;
339
340 // Executes script in the context of the current page and returns the value
341 // that the script evaluated to.
342 // DEPRECATED: Use WebLocalFrame::requestExecuteScriptAndReturnValue.
343 virtual v8::Local<v8::Value> ExecuteScriptAndReturnValue(
344 const WebScriptSource&) = 0;
345
346 // Call the function with the given receiver and arguments, bypassing
347 // canExecute().
348 virtual v8::Local<v8::Value> CallFunctionEvenIfScriptDisabled(
349 v8::Local<v8::Function>,
350 v8::Local<v8::Value>,
351 int argc,
352 v8::Local<v8::Value> argv[]) = 0;
353
300 // Returns the V8 context for associated with the main world and this 354 // Returns the V8 context for associated with the main world and this
301 // frame. There can be many V8 contexts associated with this frame, one for 355 // frame. There can be many V8 contexts associated with this frame, one for
302 // each isolated world and one for the main world. If you don't know what 356 // each isolated world and one for the main world. If you don't know what
303 // the "main world" or an "isolated world" is, then you probably shouldn't 357 // the "main world" or an "isolated world" is, then you probably shouldn't
304 // be calling this API. 358 // be calling this API.
305 virtual v8::Local<v8::Context> MainWorldScriptContext() const = 0; 359 virtual v8::Local<v8::Context> MainWorldScriptContext() const = 0;
306 360
307 // Executes script in the context of the current page and returns the value 361 // Executes script in the context of the current page and returns the value
308 // that the script evaluated to with callback. Script execution can be 362 // that the script evaluated to with callback. Script execution can be
309 // suspend. 363 // suspend.
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 // to call these on a WebLocalFrame. 695 // to call these on a WebLocalFrame.
642 bool IsWebLocalFrame() const override = 0; 696 bool IsWebLocalFrame() const override = 0;
643 WebLocalFrame* ToWebLocalFrame() override = 0; 697 WebLocalFrame* ToWebLocalFrame() override = 0;
644 bool IsWebRemoteFrame() const override = 0; 698 bool IsWebRemoteFrame() const override = 0;
645 WebRemoteFrame* ToWebRemoteFrame() override = 0; 699 WebRemoteFrame* ToWebRemoteFrame() override = 0;
646 }; 700 };
647 701
648 } // namespace blink 702 } // namespace blink
649 703
650 #endif // WebLocalFrame_h 704 #endif // WebLocalFrame_h
OLDNEW
« no previous file with comments | « third_party/WebKit/public/web/WebFrame.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698