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

Side by Side Diff: third_party/WebKit/public/web/WebFrame.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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 class WebRemoteFrame; 57 class WebRemoteFrame;
58 class WebSecurityOrigin; 58 class WebSecurityOrigin;
59 class WebString; 59 class WebString;
60 class WebURL; 60 class WebURL;
61 class WebURLRequest; 61 class WebURLRequest;
62 class WebView; 62 class WebView;
63 enum class WebSandboxFlags; 63 enum class WebSandboxFlags;
64 struct WebFrameOwnerProperties; 64 struct WebFrameOwnerProperties;
65 struct WebPrintParams; 65 struct WebPrintParams;
66 struct WebRect; 66 struct WebRect;
67 struct WebScriptSource;
68 struct WebSize; 67 struct WebSize;
69 68
70 template <typename T>
71 class WebVector;
72
73 // Frames may be rendered in process ('local') or out of process ('remote'). 69 // Frames may be rendered in process ('local') or out of process ('remote').
74 // A remote frame is always cross-site; a local frame may be either same-site or 70 // A remote frame is always cross-site; a local frame may be either same-site or
75 // cross-site. 71 // cross-site.
76 // WebFrame is the base class for both WebLocalFrame and WebRemoteFrame and 72 // WebFrame is the base class for both WebLocalFrame and WebRemoteFrame and
77 // contains methods that are valid on both local and remote frames, such as 73 // contains methods that are valid on both local and remote frames, such as
78 // getting a frame's parent or its opener. 74 // getting a frame's parent or its opener.
79 class BLINK_EXPORT WebFrame { 75 class BLINK_EXPORT WebFrame {
80 public: 76 public:
81 // FIXME: We already have blink::TextGranularity. For now we support only 77 // FIXME: We already have blink::TextGranularity. For now we support only
82 // a part of blink::TextGranularity. 78 // a part of blink::TextGranularity.
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 // Closing ------------------------------------------------------------- 204 // Closing -------------------------------------------------------------
209 205
210 // Runs unload handlers for this frame. 206 // Runs unload handlers for this frame.
211 virtual void DispatchUnloadEvent() = 0; 207 virtual void DispatchUnloadEvent() = 0;
212 208
213 // Scripting ---------------------------------------------------------- 209 // Scripting ----------------------------------------------------------
214 210
215 // Returns the global proxy object. 211 // Returns the global proxy object.
216 virtual v8::Local<v8::Object> GlobalProxy() const = 0; 212 virtual v8::Local<v8::Object> GlobalProxy() const = 0;
217 213
218 // Executes JavaScript in a new world associated with the web frame.
219 // The script gets its own global scope and its own prototypes for
220 // intrinsic JavaScript objects (String, Array, and so-on). It also
221 // gets its own wrappers for all DOM nodes and DOM constructors.
222 //
223 // worldID must be > 0 (as 0 represents the main world).
224 // worldID must be < EmbedderWorldIdLimit, high number used internally.
225 virtual void ExecuteScriptInIsolatedWorld(int world_id,
226 const WebScriptSource* sources,
227 unsigned num_sources) = 0;
228
229 // Associates an isolated world (see above for description) with a security
230 // origin. XMLHttpRequest instances used in that world will be considered
231 // to come from that origin, not the frame's.
232 virtual void SetIsolatedWorldSecurityOrigin(int world_id,
233 const WebSecurityOrigin&) = 0;
234
235 // Associates a content security policy with an isolated world. This policy
236 // should be used when evaluating script in the isolated world, and should
237 // also replace a protected resource's CSP when evaluating resources
238 // injected into the DOM.
239 //
240 // FIXME: Setting this simply bypasses the protected resource's CSP. It
241 // doesn't yet restrict the isolated world to the provided policy.
242 virtual void SetIsolatedWorldContentSecurityPolicy(int world_id,
243 const WebString&) = 0;
244
245 // Calls window.gc() if it is defined.
246 virtual void CollectGarbage() = 0;
247
248 // Executes script in the context of the current page and returns the value
249 // that the script evaluated to.
250 // DEPRECATED: Use WebLocalFrame::requestExecuteScriptAndReturnValue.
251 virtual v8::Local<v8::Value> ExecuteScriptAndReturnValue(
252 const WebScriptSource&) = 0;
253
254 // worldID must be > 0 (as 0 represents the main world).
255 // worldID must be < EmbedderWorldIdLimit, high number used internally.
256 // DEPRECATED: Use WebLocalFrame::requestExecuteScriptInIsolatedWorld.
257 virtual void ExecuteScriptInIsolatedWorld(
258 int world_id,
259 const WebScriptSource* sources_in,
260 unsigned num_sources,
261 WebVector<v8::Local<v8::Value>>* results) = 0;
262
263 // Call the function with the given receiver and arguments, bypassing
264 // canExecute().
265 virtual v8::Local<v8::Value> CallFunctionEvenIfScriptDisabled(
266 v8::Local<v8::Function>,
267 v8::Local<v8::Value>,
268 int argc,
269 v8::Local<v8::Value> argv[]) = 0;
270
271 // Returns true if the WebFrame currently executing JavaScript has access 214 // Returns true if the WebFrame currently executing JavaScript has access
272 // to the given WebFrame, or false otherwise. 215 // to the given WebFrame, or false otherwise.
273 static bool ScriptCanAccess(WebFrame*); 216 static bool ScriptCanAccess(WebFrame*);
274 217
275 // Navigation ---------------------------------------------------------- 218 // Navigation ----------------------------------------------------------
276 // TODO(clamy): Remove the reload, reloadWithOverrideURL, and loadRequest 219 // TODO(clamy): Remove the reload, reloadWithOverrideURL, and loadRequest
277 // functions once RenderFrame only calls WebLoadFrame::load. 220 // functions once RenderFrame only calls WebLoadFrame::load.
278 221
279 // Reload the current document. 222 // Reload the current document.
280 // Note: reload() and reloadWithOverrideURL() will be deprecated. 223 // Note: reload() and reloadWithOverrideURL() will be deprecated.
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 WebFrame* first_child_; 358 WebFrame* first_child_;
416 WebFrame* last_child_; 359 WebFrame* last_child_;
417 360
418 WebFrame* opener_; 361 WebFrame* opener_;
419 std::unique_ptr<OpenedFrameTracker> opened_frame_tracker_; 362 std::unique_ptr<OpenedFrameTracker> opened_frame_tracker_;
420 }; 363 };
421 364
422 } // namespace blink 365 } // namespace blink
423 366
424 #endif 367 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/tests/WebViewTest.cpp ('k') | third_party/WebKit/public/web/WebLocalFrame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698