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

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

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 #include "web/WebRemoteFrameImpl.h" 239 #include "web/WebRemoteFrameImpl.h"
240 #include "web/WebViewImpl.h" 240 #include "web/WebViewImpl.h"
241 #include "wtf/CurrentTime.h" 241 #include "wtf/CurrentTime.h"
242 #include "wtf/HashMap.h" 242 #include "wtf/HashMap.h"
243 #include <algorithm> 243 #include <algorithm>
244 244
245 namespace blink { 245 namespace blink {
246 246
247 static int frameCount = 0; 247 static int frameCount = 0;
248 248
249 static WillBeHeapVector<ScriptSourceCode> createSourcesVector(const WebScriptSou rce* sourcesIn, unsigned numSources) 249 static HeapVector<ScriptSourceCode> createSourcesVector(const WebScriptSource* s ourcesIn, unsigned numSources)
250 { 250 {
251 WillBeHeapVector<ScriptSourceCode> sources; 251 HeapVector<ScriptSourceCode> sources;
252 sources.append(sourcesIn, numSources); 252 sources.append(sourcesIn, numSources);
253 return sources; 253 return sources;
254 } 254 }
255 255
256 WebPluginContainerImpl* WebLocalFrameImpl::pluginContainerFromFrame(LocalFrame* frame) 256 WebPluginContainerImpl* WebLocalFrameImpl::pluginContainerFromFrame(LocalFrame* frame)
257 { 257 {
258 if (!frame) 258 if (!frame)
259 return 0; 259 return 0;
260 if (!frame->document() || !frame->document()->isPluginDocument()) 260 if (!frame->document() || !frame->document()->isPluginDocument())
261 return 0; 261 return 0;
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 DrawingRecorder lineBoundaryRecorder(context, *this, DisplayItem::Pr intedContentDestinationLocations, pageRect); 404 DrawingRecorder lineBoundaryRecorder(context, *this, DisplayItem::Pr intedContentDestinationLocations, pageRect);
405 outputLinkedDestinations(context, pageRect); 405 outputLinkedDestinations(context, pageRect);
406 } 406 }
407 407
408 return scale; 408 return scale;
409 } 409 }
410 410
411 private: 411 private:
412 void dispatchEventsForPrintingOnAllFrames() 412 void dispatchEventsForPrintingOnAllFrames()
413 { 413 {
414 WillBeHeapVector<RefPtrWillBeMember<Document>> documents; 414 HeapVector<Member<Document>> documents;
415 for (Frame* currentFrame = frame(); currentFrame; currentFrame = current Frame->tree().traverseNext(frame())) { 415 for (Frame* currentFrame = frame(); currentFrame; currentFrame = current Frame->tree().traverseNext(frame())) {
416 if (currentFrame->isLocalFrame()) 416 if (currentFrame->isLocalFrame())
417 documents.append(toLocalFrame(currentFrame)->document()); 417 documents.append(toLocalFrame(currentFrame)->document());
418 } 418 }
419 419
420 for (auto& doc : documents) 420 for (auto& doc : documents)
421 doc->dispatchEventsForPrinting(); 421 doc->dispatchEventsForPrinting();
422 } 422 }
423 423
424 // Set when printing. 424 // Set when printing.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 float spoolPage(GraphicsContext& context, int pageNumber) override 476 float spoolPage(GraphicsContext& context, int pageNumber) override
477 { 477 {
478 IntRect pageRect = m_pageRects[pageNumber]; 478 IntRect pageRect = m_pageRects[pageNumber];
479 m_plugin->printPage(pageNumber, context, pageRect); 479 m_plugin->printPage(pageNumber, context, pageRect);
480 480
481 return 1.0; 481 return 1.0;
482 } 482 }
483 483
484 private: 484 private:
485 // Set when printing. 485 // Set when printing.
486 RawPtrWillBeMember<WebPluginContainerImpl> m_plugin; 486 Member<WebPluginContainerImpl> m_plugin;
487 WebPrintParams m_printParams; 487 WebPrintParams m_printParams;
488 }; 488 };
489 489
490 static WebDataSource* DataSourceForDocLoader(DocumentLoader* loader) 490 static WebDataSource* DataSourceForDocLoader(DocumentLoader* loader)
491 { 491 {
492 return loader ? WebDataSourceImpl::fromDocumentLoader(loader) : 0; 492 return loader ? WebDataSourceImpl::fromDocumentLoader(loader) : 0;
493 } 493 }
494 494
495 // WebSuspendableTaskWrapper -------------------------------------------------- 495 // WebSuspendableTaskWrapper --------------------------------------------------
496 496
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 return frameForContext(context); 535 return frameForContext(context);
536 } 536 }
537 537
538 WebLocalFrame* WebLocalFrame::frameForContext(v8::Local<v8::Context> context) 538 WebLocalFrame* WebLocalFrame::frameForContext(v8::Local<v8::Context> context)
539 { 539 {
540 return WebLocalFrameImpl::fromFrame(toLocalFrame(toFrameIfNotDetached(contex t))); 540 return WebLocalFrameImpl::fromFrame(toLocalFrame(toFrameIfNotDetached(contex t)));
541 } 541 }
542 542
543 WebLocalFrame* WebLocalFrame::fromFrameOwnerElement(const WebElement& element) 543 WebLocalFrame* WebLocalFrame::fromFrameOwnerElement(const WebElement& element)
544 { 544 {
545 return WebLocalFrameImpl::fromFrameOwnerElement(PassRefPtrWillBeRawPtr<Eleme nt>(element).get()); 545 return WebLocalFrameImpl::fromFrameOwnerElement(RawPtr<Element>(element).get ());
546 } 546 }
547 547
548 bool WebLocalFrameImpl::isWebLocalFrame() const 548 bool WebLocalFrameImpl::isWebLocalFrame() const
549 { 549 {
550 return true; 550 return true;
551 } 551 }
552 552
553 WebLocalFrame* WebLocalFrameImpl::toWebLocalFrame() 553 WebLocalFrame* WebLocalFrameImpl::toWebLocalFrame()
554 { 554 {
555 return this; 555 return this;
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 v8::HandleScope handleScope(toIsolate(frame())); 737 v8::HandleScope handleScope(toIsolate(frame()));
738 frame()->script().executeScriptInMainWorld(ScriptSourceCode(source.code, sou rce.url, position)); 738 frame()->script().executeScriptInMainWorld(ScriptSourceCode(source.code, sou rce.url, position));
739 } 739 }
740 740
741 void WebLocalFrameImpl::executeScriptInIsolatedWorld(int worldID, const WebScrip tSource* sourcesIn, unsigned numSources, int extensionGroup) 741 void WebLocalFrameImpl::executeScriptInIsolatedWorld(int worldID, const WebScrip tSource* sourcesIn, unsigned numSources, int extensionGroup)
742 { 742 {
743 ASSERT(frame()); 743 ASSERT(frame());
744 RELEASE_ASSERT(worldID > 0); 744 RELEASE_ASSERT(worldID > 0);
745 RELEASE_ASSERT(worldID < EmbedderWorldIdLimit); 745 RELEASE_ASSERT(worldID < EmbedderWorldIdLimit);
746 746
747 WillBeHeapVector<ScriptSourceCode> sources = createSourcesVector(sourcesIn, numSources); 747 HeapVector<ScriptSourceCode> sources = createSourcesVector(sourcesIn, numSou rces);
748 v8::HandleScope handleScope(toIsolate(frame())); 748 v8::HandleScope handleScope(toIsolate(frame()));
749 frame()->script().executeScriptInIsolatedWorld(worldID, sources, extensionGr oup, 0); 749 frame()->script().executeScriptInIsolatedWorld(worldID, sources, extensionGr oup, 0);
750 } 750 }
751 751
752 void WebLocalFrameImpl::setIsolatedWorldSecurityOrigin(int worldID, const WebSec urityOrigin& securityOrigin) 752 void WebLocalFrameImpl::setIsolatedWorldSecurityOrigin(int worldID, const WebSec urityOrigin& securityOrigin)
753 { 753 {
754 ASSERT(frame()); 754 ASSERT(frame());
755 DOMWrapperWorld::setIsolatedWorldSecurityOrigin(worldID, securityOrigin.get( )); 755 DOMWrapperWorld::setIsolatedWorldSecurityOrigin(worldID, securityOrigin.get( ));
756 } 756 }
757 757
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 816
817 SuspendableScriptExecutor::createAndRun(frame(), 0, createSourcesVector(&sou rce, 1), 0, userGesture, callback); 817 SuspendableScriptExecutor::createAndRun(frame(), 0, createSourcesVector(&sou rce, 1), 0, userGesture, callback);
818 } 818 }
819 819
820 void WebLocalFrameImpl::executeScriptInIsolatedWorld(int worldID, const WebScrip tSource* sourcesIn, unsigned numSources, int extensionGroup, WebVector<v8::Local <v8::Value>>* results) 820 void WebLocalFrameImpl::executeScriptInIsolatedWorld(int worldID, const WebScrip tSource* sourcesIn, unsigned numSources, int extensionGroup, WebVector<v8::Local <v8::Value>>* results)
821 { 821 {
822 ASSERT(frame()); 822 ASSERT(frame());
823 RELEASE_ASSERT(worldID > 0); 823 RELEASE_ASSERT(worldID > 0);
824 RELEASE_ASSERT(worldID < EmbedderWorldIdLimit); 824 RELEASE_ASSERT(worldID < EmbedderWorldIdLimit);
825 825
826 WillBeHeapVector<ScriptSourceCode> sources = createSourcesVector(sourcesIn, numSources); 826 HeapVector<ScriptSourceCode> sources = createSourcesVector(sourcesIn, numSou rces);
827 827
828 if (results) { 828 if (results) {
829 Vector<v8::Local<v8::Value>> scriptResults; 829 Vector<v8::Local<v8::Value>> scriptResults;
830 frame()->script().executeScriptInIsolatedWorld(worldID, sources, extensi onGroup, &scriptResults); 830 frame()->script().executeScriptInIsolatedWorld(worldID, sources, extensi onGroup, &scriptResults);
831 WebVector<v8::Local<v8::Value>> v8Results(scriptResults.size()); 831 WebVector<v8::Local<v8::Value>> v8Results(scriptResults.size());
832 for (unsigned i = 0; i < scriptResults.size(); i++) 832 for (unsigned i = 0; i < scriptResults.size(); i++)
833 v8Results[i] = v8::Local<v8::Value>::New(toIsolate(frame()), scriptR esults[i]); 833 v8Results[i] = v8::Local<v8::Value>::New(toIsolate(frame()), scriptR esults[i]);
834 results->swap(v8Results); 834 results->swap(v8Results);
835 } else { 835 } else {
836 v8::HandleScope handleScope(toIsolate(frame())); 836 v8::HandleScope handleScope(toIsolate(frame()));
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
1178 } 1178 }
1179 1179
1180 void WebLocalFrameImpl::selectRange(const WebPoint& baseInViewport, const WebPoi nt& extentInViewport) 1180 void WebLocalFrameImpl::selectRange(const WebPoint& baseInViewport, const WebPoi nt& extentInViewport)
1181 { 1181 {
1182 moveRangeSelection(baseInViewport, extentInViewport); 1182 moveRangeSelection(baseInViewport, extentInViewport);
1183 } 1183 }
1184 1184
1185 void WebLocalFrameImpl::selectRange(const WebRange& webRange) 1185 void WebLocalFrameImpl::selectRange(const WebRange& webRange)
1186 { 1186 {
1187 TRACE_EVENT0("blink", "WebLocalFrameImpl::selectRange"); 1187 TRACE_EVENT0("blink", "WebLocalFrameImpl::selectRange");
1188 if (RefPtrWillBeRawPtr<Range> range = static_cast<PassRefPtrWillBeRawPtr<Ran ge>>(webRange)) 1188 if (RawPtr<Range> range = static_cast<RawPtr<Range>>(webRange))
1189 frame()->selection().setSelectedRange(range.get(), VP_DEFAULT_AFFINITY, SelectionDirectionalMode::NonDirectional, NotUserTriggered); 1189 frame()->selection().setSelectedRange(range.get(), VP_DEFAULT_AFFINITY, SelectionDirectionalMode::NonDirectional, NotUserTriggered);
1190 } 1190 }
1191 1191
1192 void WebLocalFrameImpl::moveRangeSelectionExtent(const WebPoint& point) 1192 void WebLocalFrameImpl::moveRangeSelectionExtent(const WebPoint& point)
1193 { 1193 {
1194 TRACE_EVENT0("blink", "WebLocalFrameImpl::moveRangeSelectionExtent"); 1194 TRACE_EVENT0("blink", "WebLocalFrameImpl::moveRangeSelectionExtent");
1195 frame()->selection().moveRangeSelectionExtent(frame()->view()->viewportToCon tents(point)); 1195 frame()->selection().moveRangeSelectionExtent(frame()->view()->viewportToCon tents(point));
1196 } 1196 }
1197 1197
1198 void WebLocalFrameImpl::moveRangeSelection(const WebPoint& baseInViewport, const WebPoint& extentInViewport, WebFrame::TextGranularity granularity) 1198 void WebLocalFrameImpl::moveRangeSelection(const WebPoint& baseInViewport, const WebPoint& extentInViewport, WebFrame::TextGranularity granularity)
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1276 if (constrainToNode.isNull()) { 1276 if (constrainToNode.isNull()) {
1277 // If this is a plugin document, check if the plugin supports its own 1277 // If this is a plugin document, check if the plugin supports its own
1278 // printing. If it does, we will delegate all printing to that. 1278 // printing. If it does, we will delegate all printing to that.
1279 pluginContainer = pluginContainerFromFrame(frame()); 1279 pluginContainer = pluginContainerFromFrame(frame());
1280 } else { 1280 } else {
1281 // We only support printing plugin nodes for now. 1281 // We only support printing plugin nodes for now.
1282 pluginContainer = toWebPluginContainerImpl(constrainToNode.pluginContain er()); 1282 pluginContainer = toWebPluginContainerImpl(constrainToNode.pluginContain er());
1283 } 1283 }
1284 1284
1285 if (pluginContainer && pluginContainer->supportsPaginatedPrint()) 1285 if (pluginContainer && pluginContainer->supportsPaginatedPrint())
1286 m_printContext = adoptPtrWillBeNoop(new ChromePluginPrintContext(frame() , pluginContainer, printParams)); 1286 m_printContext = new ChromePluginPrintContext(frame(), pluginContainer, printParams);
1287 else 1287 else
1288 m_printContext = adoptPtrWillBeNoop(new ChromePrintContext(frame())); 1288 m_printContext = new ChromePrintContext(frame());
1289 1289
1290 FloatRect rect(0, 0, static_cast<float>(printParams.printContentArea.width), static_cast<float>(printParams.printContentArea.height)); 1290 FloatRect rect(0, 0, static_cast<float>(printParams.printContentArea.width), static_cast<float>(printParams.printContentArea.height));
1291 m_printContext->begin(rect.width(), rect.height()); 1291 m_printContext->begin(rect.width(), rect.height());
1292 float pageHeight; 1292 float pageHeight;
1293 // We ignore the overlays calculation for now since they are generated in th e 1293 // We ignore the overlays calculation for now since they are generated in th e
1294 // browser. pageHeight is actually an output parameter. 1294 // browser. pageHeight is actually an output parameter.
1295 m_printContext->computePageRects(rect, 0, 0, 1.0, pageHeight); 1295 m_printContext->computePageRects(rect, 0, 0, 1.0, pageHeight);
1296 1296
1297 return static_cast<int>(m_printContext->pageCount()); 1297 return static_cast<int>(m_printContext->pageCount());
1298 } 1298 }
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1427 frame->setOpener(opener); 1427 frame->setOpener(opener);
1428 #if ENABLE(OILPAN) 1428 #if ENABLE(OILPAN)
1429 return frame; 1429 return frame;
1430 #else 1430 #else
1431 return adoptRef(frame).leakRef(); 1431 return adoptRef(frame).leakRef();
1432 #endif 1432 #endif
1433 } 1433 }
1434 1434
1435 WebLocalFrameImpl* WebLocalFrameImpl::createProvisional(WebFrameClient* client, WebRemoteFrame* oldWebFrame, WebSandboxFlags flags, const WebFrameOwnerPropertie s& frameOwnerProperties) 1435 WebLocalFrameImpl* WebLocalFrameImpl::createProvisional(WebFrameClient* client, WebRemoteFrame* oldWebFrame, WebSandboxFlags flags, const WebFrameOwnerPropertie s& frameOwnerProperties)
1436 { 1436 {
1437 RefPtrWillBeRawPtr<WebLocalFrameImpl> webFrame = adoptRefWillBeNoop(new WebL ocalFrameImpl(oldWebFrame, client)); 1437 RawPtr<WebLocalFrameImpl> webFrame = new WebLocalFrameImpl(oldWebFrame, clie nt);
1438 Frame* oldFrame = oldWebFrame->toImplBase()->frame(); 1438 Frame* oldFrame = oldWebFrame->toImplBase()->frame();
1439 webFrame->setParent(oldWebFrame->parent()); 1439 webFrame->setParent(oldWebFrame->parent());
1440 webFrame->setOpener(oldWebFrame->opener()); 1440 webFrame->setOpener(oldWebFrame->opener());
1441 // Note: this *always* temporarily sets a frame owner, even for main frames! 1441 // Note: this *always* temporarily sets a frame owner, even for main frames!
1442 // When a core Frame is created with no owner, it attempts to set itself as 1442 // When a core Frame is created with no owner, it attempts to set itself as
1443 // the main frame of the Page. However, this is a provisional frame, and may 1443 // the main frame of the Page. However, this is a provisional frame, and may
1444 // disappear, so Page::m_mainFrame can't be updated just yet. 1444 // disappear, so Page::m_mainFrame can't be updated just yet.
1445 OwnPtrWillBeRawPtr<FrameOwner> tempOwner = DummyFrameOwner::create(); 1445 RawPtr<FrameOwner> tempOwner = DummyFrameOwner::create();
1446 // TODO(dcheng): This block is very similar to initializeCoreFrame. Try to r euse it here. 1446 // TODO(dcheng): This block is very similar to initializeCoreFrame. Try to r euse it here.
1447 RefPtrWillBeRawPtr<LocalFrame> frame = LocalFrame::create(webFrame->m_frameL oaderClientImpl.get(), oldFrame->host(), tempOwner.get()); 1447 RawPtr<LocalFrame> frame = LocalFrame::create(webFrame->m_frameLoaderClientI mpl.get(), oldFrame->host(), tempOwner.get());
1448 // Set the name and unique name directly, bypassing any of the normal logic 1448 // Set the name and unique name directly, bypassing any of the normal logic
1449 // to calculate unique name. 1449 // to calculate unique name.
1450 frame->tree().setPrecalculatedName(toWebRemoteFrameImpl(oldWebFrame)->frame( )->tree().name(), toWebRemoteFrameImpl(oldWebFrame)->frame()->tree().uniqueName( )); 1450 frame->tree().setPrecalculatedName(toWebRemoteFrameImpl(oldWebFrame)->frame( )->tree().name(), toWebRemoteFrameImpl(oldWebFrame)->frame()->tree().uniqueName( ));
1451 webFrame->setCoreFrame(frame); 1451 webFrame->setCoreFrame(frame);
1452 1452
1453 frame->setOwner(oldFrame->owner()); 1453 frame->setOwner(oldFrame->owner());
1454 1454
1455 if (frame->owner() && frame->owner()->isRemote()) { 1455 if (frame->owner() && frame->owner()->isRemote()) {
1456 toRemoteFrameOwner(frame->owner())->setSandboxFlags(static_cast<SandboxF lags>(flags)); 1456 toRemoteFrameOwner(frame->owner())->setSandboxFlags(static_cast<SandboxF lags>(flags));
1457 // Since a remote frame doesn't get the notifications about frame owner 1457 // Since a remote frame doesn't get the notifications about frame owner
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1514 visitor->trace(m_devToolsAgent); 1514 visitor->trace(m_devToolsAgent);
1515 visitor->trace(m_textFinder); 1515 visitor->trace(m_textFinder);
1516 visitor->trace(m_printContext); 1516 visitor->trace(m_printContext);
1517 visitor->trace(m_geolocationClientProxy); 1517 visitor->trace(m_geolocationClientProxy);
1518 visitor->template registerWeakMembers<WebFrame, &WebFrame::clearWeakFrames>( this); 1518 visitor->template registerWeakMembers<WebFrame, &WebFrame::clearWeakFrames>( this);
1519 WebFrame::traceFrames(visitor, this); 1519 WebFrame::traceFrames(visitor, this);
1520 WebFrameImplBase::trace(visitor); 1520 WebFrameImplBase::trace(visitor);
1521 } 1521 }
1522 #endif 1522 #endif
1523 1523
1524 void WebLocalFrameImpl::setCoreFrame(PassRefPtrWillBeRawPtr<LocalFrame> frame) 1524 void WebLocalFrameImpl::setCoreFrame(RawPtr<LocalFrame> frame)
1525 { 1525 {
1526 m_frame = frame; 1526 m_frame = frame;
1527 1527
1528 // FIXME: we shouldn't add overhead to every frame by registering these obje cts when they're not used. 1528 // FIXME: we shouldn't add overhead to every frame by registering these obje cts when they're not used.
1529 if (!m_frame) 1529 if (!m_frame)
1530 return; 1530 return;
1531 1531
1532 if (m_client) 1532 if (m_client)
1533 providePushControllerTo(*m_frame, m_client->pushClient()); 1533 providePushControllerTo(*m_frame, m_client->pushClient());
1534 1534
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1570 void WebLocalFrameImpl::initializeCoreFrame(FrameHost* host, FrameOwner* owner, const AtomicString& name, const AtomicString& uniqueName) 1570 void WebLocalFrameImpl::initializeCoreFrame(FrameHost* host, FrameOwner* owner, const AtomicString& name, const AtomicString& uniqueName)
1571 { 1571 {
1572 setCoreFrame(LocalFrame::create(m_frameLoaderClientImpl.get(), host, owner)) ; 1572 setCoreFrame(LocalFrame::create(m_frameLoaderClientImpl.get(), host, owner)) ;
1573 frame()->tree().setPrecalculatedName(name, uniqueName); 1573 frame()->tree().setPrecalculatedName(name, uniqueName);
1574 // We must call init() after m_frame is assigned because it is referenced 1574 // We must call init() after m_frame is assigned because it is referenced
1575 // during init(). Note that this may dispatch JS events; the frame may be 1575 // during init(). Note that this may dispatch JS events; the frame may be
1576 // detached after init() returns. 1576 // detached after init() returns.
1577 frame()->init(); 1577 frame()->init();
1578 } 1578 }
1579 1579
1580 PassRefPtrWillBeRawPtr<LocalFrame> WebLocalFrameImpl::createChildFrame(const Fra meLoadRequest& request, 1580 RawPtr<LocalFrame> WebLocalFrameImpl::createChildFrame(const FrameLoadRequest& r equest,
1581 const AtomicString& name, HTMLFrameOwnerElement* ownerElement) 1581 const AtomicString& name, HTMLFrameOwnerElement* ownerElement)
1582 { 1582 {
1583 ASSERT(m_client); 1583 ASSERT(m_client);
1584 TRACE_EVENT0("blink", "WebLocalFrameImpl::createChildframe"); 1584 TRACE_EVENT0("blink", "WebLocalFrameImpl::createChildframe");
1585 WebTreeScopeType scope = frame()->document() == ownerElement->treeScope() 1585 WebTreeScopeType scope = frame()->document() == ownerElement->treeScope()
1586 ? WebTreeScopeType::Document 1586 ? WebTreeScopeType::Document
1587 : WebTreeScopeType::Shadow; 1587 : WebTreeScopeType::Shadow;
1588 WebFrameOwnerProperties ownerProperties(ownerElement->scrollingMode(), owner Element->marginWidth(), ownerElement->marginHeight()); 1588 WebFrameOwnerProperties ownerProperties(ownerElement->scrollingMode(), owner Element->marginWidth(), ownerElement->marginHeight());
1589 // FIXME: Using subResourceAttributeName as fallback is not a perfect 1589 // FIXME: Using subResourceAttributeName as fallback is not a perfect
1590 // solution. subResourceAttributeName returns just one attribute name. The 1590 // solution. subResourceAttributeName returns just one attribute name. The
1591 // element might not have the attribute, and there might be other attributes 1591 // element might not have the attribute, and there might be other attributes
1592 // which can identify the element. 1592 // which can identify the element.
1593 AtomicString uniqueName = frame()->tree().calculateUniqueNameForNewChildFram e( 1593 AtomicString uniqueName = frame()->tree().calculateUniqueNameForNewChildFram e(
1594 name, ownerElement->getAttribute(ownerElement->subResourceAttributeName( ))); 1594 name, ownerElement->getAttribute(ownerElement->subResourceAttributeName( )));
1595 RefPtrWillBeRawPtr<WebLocalFrameImpl> webframeChild = toWebLocalFrameImpl(m_ client->createChildFrame(this, scope, name, uniqueName, static_cast<WebSandboxFl ags>(ownerElement->getSandboxFlags()), ownerProperties)); 1595 RawPtr<WebLocalFrameImpl> webframeChild = toWebLocalFrameImpl(m_client->crea teChildFrame(this, scope, name, uniqueName, static_cast<WebSandboxFlags>(ownerEl ement->getSandboxFlags()), ownerProperties));
1596 if (!webframeChild) 1596 if (!webframeChild)
1597 return nullptr; 1597 return nullptr;
1598 1598
1599 webframeChild->initializeCoreFrame(frame()->host(), ownerElement, name, uniq ueName); 1599 webframeChild->initializeCoreFrame(frame()->host(), ownerElement, name, uniq ueName);
1600 // Initializing the core frame may cause the new child to be detached, since 1600 // Initializing the core frame may cause the new child to be detached, since
1601 // it may dispatch a load event in the parent. 1601 // it may dispatch a load event in the parent.
1602 if (!webframeChild->parent()) 1602 if (!webframeChild->parent())
1603 return nullptr; 1603 return nullptr;
1604 1604
1605 // If we're moving in the back/forward list, we might want to replace the co ntent 1605 // If we're moving in the back/forward list, we might want to replace the co ntent
1606 // of this child frame with whatever was there at that point. 1606 // of this child frame with whatever was there at that point.
1607 RefPtrWillBeRawPtr<HistoryItem> childItem = nullptr; 1607 RawPtr<HistoryItem> childItem = nullptr;
1608 if (isBackForwardLoadType(frame()->loader().loadType()) && !frame()->documen t()->loadEventFinished()) 1608 if (isBackForwardLoadType(frame()->loader().loadType()) && !frame()->documen t()->loadEventFinished())
1609 childItem = PassRefPtrWillBeRawPtr<HistoryItem>(webframeChild->client()- >historyItemForNewChildFrame()); 1609 childItem = RawPtr<HistoryItem>(webframeChild->client()->historyItemForN ewChildFrame());
1610 1610
1611 FrameLoadRequest newRequest = request; 1611 FrameLoadRequest newRequest = request;
1612 FrameLoadType loadType = FrameLoadTypeStandard; 1612 FrameLoadType loadType = FrameLoadTypeStandard;
1613 if (childItem) { 1613 if (childItem) {
1614 newRequest = FrameLoadRequest(request.originDocument(), 1614 newRequest = FrameLoadRequest(request.originDocument(),
1615 FrameLoader::resourceRequestFromHistoryItem(childItem.get(), UseProt ocolCachePolicy)); 1615 FrameLoader::resourceRequestFromHistoryItem(childItem.get(), UseProt ocolCachePolicy));
1616 loadType = FrameLoadTypeInitialHistoryLoad; 1616 loadType = FrameLoadTypeInitialHistoryLoad;
1617 } 1617 }
1618 webframeChild->frame()->loader().load(newRequest, loadType, childItem.get()) ; 1618 webframeChild->frame()->loader().load(newRequest, loadType, childItem.get()) ;
1619 1619
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1810 // Unfortunately, we cannot just use that method since it is private, and 1810 // Unfortunately, we cannot just use that method since it is private, and
1811 // it also doesn't quite behave as we require it to for bookmarklets. The 1811 // it also doesn't quite behave as we require it to for bookmarklets. The
1812 // key difference is that we need to suppress loading the string result 1812 // key difference is that we need to suppress loading the string result
1813 // from evaluating the JS URL if executing the JS URL resulted in a 1813 // from evaluating the JS URL if executing the JS URL resulted in a
1814 // location change. We also allow a JS URL to be loaded even if scripts on 1814 // location change. We also allow a JS URL to be loaded even if scripts on
1815 // the page are otherwise disabled. 1815 // the page are otherwise disabled.
1816 1816
1817 if (!frame()->document() || !frame()->page()) 1817 if (!frame()->document() || !frame()->page())
1818 return; 1818 return;
1819 1819
1820 RefPtrWillBeRawPtr<Document> ownerDocument(frame()->document()); 1820 RawPtr<Document> ownerDocument(frame()->document());
1821 1821
1822 // Protect privileged pages against bookmarklets and other javascript manipu lations. 1822 // Protect privileged pages against bookmarklets and other javascript manipu lations.
1823 if (SchemeRegistry::shouldTreatURLSchemeAsNotAllowingJavascriptURLs(frame()- >document()->url().protocol())) 1823 if (SchemeRegistry::shouldTreatURLSchemeAsNotAllowingJavascriptURLs(frame()- >document()->url().protocol()))
1824 return; 1824 return;
1825 1825
1826 String script = decodeURLEscapeSequences(url.getString().substring(strlen("j avascript:"))); 1826 String script = decodeURLEscapeSequences(url.getString().substring(strlen("j avascript:")));
1827 UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture); 1827 UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture);
1828 v8::HandleScope handleScope(toIsolate(frame())); 1828 v8::HandleScope handleScope(toIsolate(frame()));
1829 v8::Local<v8::Value> result = frame()->script().executeScriptInMainWorldAndR eturnValue(ScriptSourceCode(script)); 1829 v8::Local<v8::Value> result = frame()->script().executeScriptInMainWorldAndR eturnValue(ScriptSourceCode(script));
1830 if (result.IsEmpty() || !result->IsString()) 1830 if (result.IsEmpty() || !result->IsString())
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1907 { 1907 {
1908 ASSERT(frame()); 1908 ASSERT(frame());
1909 Element* anchor = contextNode.constUnwrap<Node>()->enclosingLinkEventParentO rSelf(); 1909 Element* anchor = contextNode.constUnwrap<Node>()->enclosingLinkEventParentO rSelf();
1910 if (isHTMLAnchorElement(anchor)) 1910 if (isHTMLAnchorElement(anchor))
1911 toHTMLAnchorElement(anchor)->sendPings(destinationURL); 1911 toHTMLAnchorElement(anchor)->sendPings(destinationURL);
1912 } 1912 }
1913 1913
1914 WebURLRequest WebLocalFrameImpl::requestFromHistoryItem(const WebHistoryItem& it em, 1914 WebURLRequest WebLocalFrameImpl::requestFromHistoryItem(const WebHistoryItem& it em,
1915 WebURLRequest::CachePolicy cachePolicy) const 1915 WebURLRequest::CachePolicy cachePolicy) const
1916 { 1916 {
1917 RefPtrWillBeRawPtr<HistoryItem> historyItem = PassRefPtrWillBeRawPtr<History Item>(item); 1917 RawPtr<HistoryItem> historyItem = RawPtr<HistoryItem>(item);
1918 ResourceRequest request = FrameLoader::resourceRequestFromHistoryItem( 1918 ResourceRequest request = FrameLoader::resourceRequestFromHistoryItem(
1919 historyItem.get(), static_cast<ResourceRequestCachePolicy>(cachePolicy)) ; 1919 historyItem.get(), static_cast<ResourceRequestCachePolicy>(cachePolicy)) ;
1920 return WrappedResourceRequest(request); 1920 return WrappedResourceRequest(request);
1921 } 1921 }
1922 1922
1923 WebURLRequest WebLocalFrameImpl::requestForReload(WebFrameLoadType loadType, 1923 WebURLRequest WebLocalFrameImpl::requestForReload(WebFrameLoadType loadType,
1924 const WebURL& overrideUrl) const 1924 const WebURL& overrideUrl) const
1925 { 1925 {
1926 ASSERT(frame()); 1926 ASSERT(frame());
1927 ResourceRequest request = frame()->loader().resourceRequestForReload( 1927 ResourceRequest request = frame()->loader().resourceRequestForReload(
(...skipping 10 matching lines...) Expand all
1938 1938
1939 if (resourceRequest.url().protocolIs("javascript") 1939 if (resourceRequest.url().protocolIs("javascript")
1940 && webFrameLoadType == WebFrameLoadType::Standard) { 1940 && webFrameLoadType == WebFrameLoadType::Standard) {
1941 loadJavaScriptURL(resourceRequest.url()); 1941 loadJavaScriptURL(resourceRequest.url());
1942 return; 1942 return;
1943 } 1943 }
1944 1944
1945 FrameLoadRequest frameRequest = FrameLoadRequest(nullptr, resourceRequest); 1945 FrameLoadRequest frameRequest = FrameLoadRequest(nullptr, resourceRequest);
1946 if (isClientRedirect) 1946 if (isClientRedirect)
1947 frameRequest.setClientRedirect(ClientRedirect); 1947 frameRequest.setClientRedirect(ClientRedirect);
1948 RefPtrWillBeRawPtr<HistoryItem> historyItem = PassRefPtrWillBeRawPtr<History Item>(item); 1948 RawPtr<HistoryItem> historyItem = RawPtr<HistoryItem>(item);
1949 frame()->loader().load( 1949 frame()->loader().load(
1950 frameRequest, static_cast<FrameLoadType>(webFrameLoadType), historyItem. get(), 1950 frameRequest, static_cast<FrameLoadType>(webFrameLoadType), historyItem. get(),
1951 static_cast<HistoryLoadType>(webHistoryLoadType)); 1951 static_cast<HistoryLoadType>(webHistoryLoadType));
1952 } 1952 }
1953 1953
1954 void WebLocalFrameImpl::loadData(const WebData& data, const WebString& mimeType, 1954 void WebLocalFrameImpl::loadData(const WebData& data, const WebString& mimeType,
1955 const WebString& textEncoding, const WebURL& baseURL, const WebURL& unreacha bleURL, bool replace, 1955 const WebString& textEncoding, const WebURL& baseURL, const WebURL& unreacha bleURL, bool replace,
1956 WebFrameLoadType webFrameLoadType, const WebHistoryItem& item, 1956 WebFrameLoadType webFrameLoadType, const WebHistoryItem& item,
1957 WebHistoryLoadType webHistoryLoadType, bool isClientRedirect) 1957 WebHistoryLoadType webHistoryLoadType, bool isClientRedirect)
1958 { 1958 {
(...skipping 10 matching lines...) Expand all
1969 request = frame()->loader().provisionalDocumentLoader()->originalRequest (); 1969 request = frame()->loader().provisionalDocumentLoader()->originalRequest ();
1970 request.setURL(baseURL); 1970 request.setURL(baseURL);
1971 request.setCheckForBrowserSideNavigation(false); 1971 request.setCheckForBrowserSideNavigation(false);
1972 1972
1973 FrameLoadRequest frameRequest(0, request, SubstituteData(data, mimeType, tex tEncoding, unreachableURL)); 1973 FrameLoadRequest frameRequest(0, request, SubstituteData(data, mimeType, tex tEncoding, unreachableURL));
1974 ASSERT(frameRequest.substituteData().isValid()); 1974 ASSERT(frameRequest.substituteData().isValid());
1975 frameRequest.setReplacesCurrentItem(replace); 1975 frameRequest.setReplacesCurrentItem(replace);
1976 if (isClientRedirect) 1976 if (isClientRedirect)
1977 frameRequest.setClientRedirect(ClientRedirect); 1977 frameRequest.setClientRedirect(ClientRedirect);
1978 1978
1979 RefPtrWillBeRawPtr<HistoryItem> historyItem = PassRefPtrWillBeRawPtr<History Item>(item); 1979 RawPtr<HistoryItem> historyItem = RawPtr<HistoryItem>(item);
1980 frame()->loader().load( 1980 frame()->loader().load(
1981 frameRequest, static_cast<FrameLoadType>(webFrameLoadType), historyItem. get(), 1981 frameRequest, static_cast<FrameLoadType>(webFrameLoadType), historyItem. get(),
1982 static_cast<HistoryLoadType>(webHistoryLoadType)); 1982 static_cast<HistoryLoadType>(webHistoryLoadType));
1983 } 1983 }
1984 1984
1985 bool WebLocalFrameImpl::isLoading() const 1985 bool WebLocalFrameImpl::isLoading() const
1986 { 1986 {
1987 if (!frame() || !frame()->document()) 1987 if (!frame() || !frame()->document())
1988 return false; 1988 return false;
1989 return frame()->loader().stateMachine()->isDisplayingInitialEmptyDocument() || frame()->loader().provisionalDocumentLoader() || !frame()->document()->loadEv entFinished(); 1989 return frame()->loader().stateMachine()->isDisplayingInitialEmptyDocument() || frame()->loader().provisionalDocumentLoader() || !frame()->document()->loadEv entFinished();
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
2189 return WebSandboxFlags::None; 2189 return WebSandboxFlags::None;
2190 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags( )); 2190 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags( ));
2191 } 2191 }
2192 2192
2193 void WebLocalFrameImpl::forceSandboxFlags(WebSandboxFlags flags) 2193 void WebLocalFrameImpl::forceSandboxFlags(WebSandboxFlags flags)
2194 { 2194 {
2195 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags)); 2195 frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags));
2196 } 2196 }
2197 2197
2198 } // namespace blink 2198 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebLocalFrameImpl.h ('k') | third_party/WebKit/Source/web/WebMetaElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698