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

Side by Side Diff: third_party/WebKit/Source/web/WebFrame.cpp

Issue 2878623002: Introduce WebRemoteFrameBase to break dependencies on WebRemoteFrameImpl. (Closed)
Patch Set: Fix windows linker errors. Created 3 years, 7 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 #include "public/web/WebFrame.h" 5 #include "public/web/WebFrame.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include "bindings/core/v8/WindowProxyManager.h" 8 #include "bindings/core/v8/WindowProxyManager.h"
9 #include "core/HTMLNames.h" 9 #include "core/HTMLNames.h"
10 #include "core/dom/IncrementLoadEventDelayCount.h" 10 #include "core/dom/IncrementLoadEventDelayCount.h"
11 #include "core/frame/FrameView.h" 11 #include "core/frame/FrameView.h"
12 #include "core/frame/LocalFrame.h" 12 #include "core/frame/LocalFrame.h"
13 #include "core/frame/RemoteFrame.h" 13 #include "core/frame/RemoteFrame.h"
14 #include "core/frame/WebLocalFrameBase.h" 14 #include "core/frame/WebLocalFrameBase.h"
15 #include "core/frame/WebRemoteFrameBase.h"
15 #include "core/html/HTMLFrameElementBase.h" 16 #include "core/html/HTMLFrameElementBase.h"
16 #include "core/html/HTMLFrameOwnerElement.h" 17 #include "core/html/HTMLFrameOwnerElement.h"
17 #include "core/page/Page.h" 18 #include "core/page/Page.h"
18 #include "platform/UserGestureIndicator.h" 19 #include "platform/UserGestureIndicator.h"
19 #include "platform/heap/Handle.h" 20 #include "platform/heap/Handle.h"
20 #include "platform/instrumentation/tracing/TraceEvent.h" 21 #include "platform/instrumentation/tracing/TraceEvent.h"
21 #include "public/web/WebElement.h" 22 #include "public/web/WebElement.h"
22 #include "public/web/WebFrameOwnerProperties.h" 23 #include "public/web/WebFrameOwnerProperties.h"
23 #include "public/web/WebSandboxFlags.h" 24 #include "public/web/WebSandboxFlags.h"
24 #include "web/OpenedFrameTracker.h" 25 #include "web/OpenedFrameTracker.h"
25 #include "web/RemoteFrameOwner.h" 26 #include "web/RemoteFrameOwner.h"
26 #include "web/WebRemoteFrameImpl.h"
27 27
28 namespace blink { 28 namespace blink {
29 29
30 bool WebFrame::Swap(WebFrame* frame) { 30 bool WebFrame::Swap(WebFrame* frame) {
31 using std::swap; 31 using std::swap;
32 Frame* old_frame = ToCoreFrame(*this); 32 Frame* old_frame = ToCoreFrame(*this);
33 if (!old_frame->IsAttached()) 33 if (!old_frame->IsAttached())
34 return false; 34 return false;
35 35
36 // Unload the current Document in this frame: this calls unload handlers, 36 // Unload the current Document in this frame: this calls unload handlers,
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 if (owner->IsLocal()) 108 if (owner->IsLocal())
109 ToHTMLFrameOwnerElement(owner)->SetWidget(local_frame.View()); 109 ToHTMLFrameOwnerElement(owner)->SetWidget(local_frame.View());
110 } else { 110 } else {
111 local_frame.GetPage()->SetMainFrame(&local_frame); 111 local_frame.GetPage()->SetMainFrame(&local_frame);
112 // This trace event is needed to detect the main frame of the 112 // This trace event is needed to detect the main frame of the
113 // renderer in telemetry metrics. See crbug.com/692112#c11. 113 // renderer in telemetry metrics. See crbug.com/692112#c11.
114 TRACE_EVENT_INSTANT1("loading", "markAsMainFrame", 114 TRACE_EVENT_INSTANT1("loading", "markAsMainFrame",
115 TRACE_EVENT_SCOPE_THREAD, "frame", &local_frame); 115 TRACE_EVENT_SCOPE_THREAD, "frame", &local_frame);
116 } 116 }
117 } else { 117 } else {
118 ToWebRemoteFrameImpl(frame)->InitializeCoreFrame(*page, owner, name); 118 ToWebRemoteFrameBase(frame)->InitializeCoreFrame(*page, owner, name);
119 } 119 }
120 120
121 if (parent_ && old_frame->HasReceivedUserGesture()) 121 if (parent_ && old_frame->HasReceivedUserGesture())
122 ToCoreFrame(*frame)->SetDocumentHasReceivedUserGesture(); 122 ToCoreFrame(*frame)->SetDocumentHasReceivedUserGesture();
123 123
124 ToCoreFrame(*frame)->GetWindowProxyManager()->SetGlobalProxies( 124 ToCoreFrame(*frame)->GetWindowProxyManager()->SetGlobalProxies(
125 global_proxies); 125 global_proxies);
126 126
127 parent_ = nullptr; 127 parent_ = nullptr;
128 128
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 return frame->IsLoading(); 286 return frame->IsLoading();
287 return false; 287 return false;
288 } 288 }
289 289
290 WebFrame* WebFrame::FromFrame(Frame* frame) { 290 WebFrame* WebFrame::FromFrame(Frame* frame) {
291 if (!frame) 291 if (!frame)
292 return 0; 292 return 0;
293 293
294 if (frame->IsLocalFrame()) 294 if (frame->IsLocalFrame())
295 return WebLocalFrameBase::FromFrame(ToLocalFrame(*frame)); 295 return WebLocalFrameBase::FromFrame(ToLocalFrame(*frame));
296 return WebRemoteFrameImpl::FromFrame(ToRemoteFrame(*frame)); 296 return WebRemoteFrameBase::FromFrame(ToRemoteFrame(*frame));
297 } 297 }
298 298
299 WebFrame::WebFrame(WebTreeScopeType scope) 299 WebFrame::WebFrame(WebTreeScopeType scope)
300 : scope_(scope), 300 : scope_(scope),
301 parent_(0), 301 parent_(0),
302 previous_sibling_(0), 302 previous_sibling_(0),
303 next_sibling_(0), 303 next_sibling_(0),
304 first_child_(0), 304 first_child_(0),
305 last_child_(0), 305 last_child_(0),
306 opener_(0), 306 opener_(0),
307 opened_frame_tracker_(new OpenedFrameTracker) {} 307 opened_frame_tracker_(new OpenedFrameTracker) {}
308 308
309 WebFrame::~WebFrame() { 309 WebFrame::~WebFrame() {
310 opened_frame_tracker_.reset(0); 310 opened_frame_tracker_.reset(0);
311 } 311 }
312 312
313 void WebFrame::TraceFrame(Visitor* visitor, WebFrame* frame) { 313 void WebFrame::TraceFrame(Visitor* visitor, WebFrame* frame) {
314 if (!frame) 314 if (!frame)
315 return; 315 return;
316 316
317 if (frame->IsWebLocalFrame()) 317 if (frame->IsWebLocalFrame())
318 visitor->Trace(ToWebLocalFrameBase(frame)); 318 visitor->Trace(ToWebLocalFrameBase(frame));
319 else 319 else
320 visitor->Trace(ToWebRemoteFrameImpl(frame)); 320 visitor->Trace(ToWebRemoteFrameBase(frame));
321 } 321 }
322 322
323 void WebFrame::TraceFrames(Visitor* visitor, WebFrame* frame) { 323 void WebFrame::TraceFrames(Visitor* visitor, WebFrame* frame) {
324 DCHECK(frame); 324 DCHECK(frame);
325 TraceFrame(visitor, frame->parent_); 325 TraceFrame(visitor, frame->parent_);
326 for (WebFrame* child = frame->FirstChild(); child; 326 for (WebFrame* child = frame->FirstChild(); child;
327 child = child->NextSibling()) 327 child = child->NextSibling())
328 TraceFrame(visitor, child); 328 TraceFrame(visitor, child);
329 } 329 }
330 330
331 void WebFrame::Close() { 331 void WebFrame::Close() {
332 opened_frame_tracker_->Dispose(); 332 opened_frame_tracker_->Dispose();
333 } 333 }
334 334
335 void WebFrame::InitializeCoreFrame(WebFrame& frame, Page& page) { 335 void WebFrame::InitializeCoreFrame(WebFrame& frame, Page& page) {
336 if (frame.IsWebLocalFrame()) 336 if (frame.IsWebLocalFrame())
337 ToWebLocalFrameBase(frame).InitializeCoreFrame(page, 0, g_null_atom); 337 ToWebLocalFrameBase(frame).InitializeCoreFrame(page, 0, g_null_atom);
338 else if (frame.IsWebRemoteFrame()) 338 else if (frame.IsWebRemoteFrame())
339 ToWebRemoteFrameImpl(frame).InitializeCoreFrame(page, 0, g_null_atom); 339 ToWebRemoteFrameBase(frame).InitializeCoreFrame(page, 0, g_null_atom);
340 else 340 else
341 NOTREACHED(); 341 NOTREACHED();
342 } 342 }
343 343
344 Frame* WebFrame::ToCoreFrame(const WebFrame& frame) { 344 Frame* WebFrame::ToCoreFrame(const WebFrame& frame) {
345 if (frame.IsWebLocalFrame()) 345 if (frame.IsWebLocalFrame())
346 return ToWebLocalFrameBase(frame).GetFrame(); 346 return ToWebLocalFrameBase(frame).GetFrame();
347 if (frame.IsWebRemoteFrame()) 347 if (frame.IsWebRemoteFrame())
348 return ToWebRemoteFrameImpl(frame).GetFrame(); 348 return ToWebRemoteFrameBase(frame).GetFrame();
349 NOTREACHED(); 349 NOTREACHED();
350 return nullptr; 350 return nullptr;
351 } 351 }
352 352
353 } // namespace blink 353 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698