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 3 // found in the LICENSE file. 4 5 #include "config.h" 6 #include "web/WebRemoteFrameImpl.h" 7 8 #include "core/frame/FrameOwner.h" 9 #include "core/frame/FrameView.h" 10 #include "core/frame/RemoteFrame.h" 11 #include "core/frame/Settings.h" 12 #include "core/page/Page.h" 13 #include "platform/heap/Handle.h" 14 #include "public/platform/WebFloatRect.h" 15 #include "public/platform/WebRect.h" 16 #include "public/web/WebDocument.h" 17 #include "public/web/WebPerformance.h" 18 #include "public/web/WebRange.h" 19 #include "web/WebLocalFrameImpl.h" 20 #include "web/WebViewImpl.h" 21 #include <v8/include/v8.h> 22 23 namespace blink { 24 25 namespace { 26 27 // Helper class to bridge communication for a local frame with a remote parent. 28 // Currently, it serves two purposes: 29 // 1. Allows the local frame's loader to retrieve sandbox flags associated with 30 // its owner element in another process. 31 // 2. Trigger a load event on its owner element once it finishes a load. 32 class RemoteBridgeFrameOwner : public NoBaseWillBeGarbageCollectedFinalized<RemoteBridgeFrameOwner>, public FrameOwner { 33 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(RemoteBridgeFrameOwner); 34 public: 35 static PassOwnPtrWillBeRawPtr<RemoteBridgeFrameOwner> create(PassRefPtrWillBeRawPtr<WebLocalFrameImpl> frame) 36 { 37 return adoptPtrWillBeNoop(new RemoteBridgeFrameOwner(frame)); 38 } 39 40 virtual bool isLocal() const OVERRIDE; 41 virtual SandboxFlags sandboxFlags() const OVERRIDE; 42 virtual void dispatchLoad() OVERRIDE; 43 44 virtual void trace(Visitor*); 45 46 private: 47 explicit RemoteBridgeFrameOwner(PassRefPtrWillBeRawPtr<WebLocalFrameImpl>); 48 49 RefPtrWillBeMember<WebLocalFrameImpl> m_frame; 50 }; 51 52 RemoteBridgeFrameOwner::RemoteBridgeFrameOwner(PassRefPtrWillBeRawPtr<WebLocalFrameImpl> frame) 53 : m_frame(frame) 54 { 55 } 56 57 void RemoteBridgeFrameOwner::trace(Visitor* visitor) 58 { 59 visitor->trace(m_frame); 60 FrameOwner::trace(visitor); 61 } 62 63 bool RemoteBridgeFrameOwner::isLocal() const 64 { 65 return false; 66 } 67 68 SandboxFlags RemoteBridgeFrameOwner::sandboxFlags() const 69 { 70 // FIXME: Implement. Most likely grab it from m_frame. 71 return 0; 72 } 73 74 void RemoteBridgeFrameOwner::dispatchLoad() 75 { 76 // FIXME: Implement. Most likely goes through m_frame->client(). 77 } 78 79 // FIXME: This is just a placeholder frame owner to supply to RemoteFrame when 80 // the parent is also a remote frame. Strictly speaking, this shouldn't be 81 // necessary, since a remote frame shouldn't ever need to communicate with a 82 // remote parent (there are no sandbox flags to retrieve in this case, nor can 83 // the RemoteFrame itself load a document). In most circumstances, the check for 84 // frame->owner() can be replaced with a check for frame->tree().parent(). Once 85 // that's done, this class can be removed. 86 class PlaceholderFrameOwner : public NoBaseWillBeGarbageCollectedFinalized<PlaceholderFrameOwner>, public FrameOwner { 87 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PlaceholderFrameOwner); 88 public: 89 virtual bool isLocal() const OVERRIDE; 90 virtual SandboxFlags sandboxFlags() const OVERRIDE; 91 virtual void dispatchLoad() OVERRIDE; 92 }; 93 94 bool PlaceholderFrameOwner::isLocal() const 95 { 96 return false; 97 } 98 99 SandboxFlags PlaceholderFrameOwner::sandboxFlags() const 100 { 101 ASSERT_NOT_REACHED(); 102 return 0; 103 } 104 105 void PlaceholderFrameOwner::dispatchLoad() 106 { 107 ASSERT_NOT_REACHED(); 108 } 109 110 } // namespace 111 112 WebRemoteFrame* WebRemoteFrame::create(WebRemoteFrameClient* client) 113 { 114 WebRemoteFrameImpl* frame = new WebRemoteFrameImpl(client); 115 #if ENABLE(OILPAN) 116 return frame; 117 #else 118 return adoptRef(frame).leakRef(); 119 #endif 120 } 121 122 WebRemoteFrameImpl::WebRemoteFrameImpl(WebRemoteFrameClient* client) 123 : m_frameClient(this) 124 , m_client(client) 125 #if ENABLE(OILPAN) 126 , m_selfKeepAlive(this) 127 #endif 128 { 129 } 130 131 WebRemoteFrameImpl::~WebRemoteFrameImpl() 132 { 133 } 134 135 void WebRemoteFrameImpl::trace(Visitor* visitor) 136 { 137 #if ENABLE(OILPAN) 138 visitor->trace(m_frame); 139 visitor->trace(m_ownersForChildren); 140 141 WebFrame::traceChildren(visitor, this); 142 #endif 143 } 144 145 bool WebRemoteFrameImpl::isWebLocalFrame() const 146 { 147 return false; 148 } 149 150 WebLocalFrame* WebRemoteFrameImpl::toWebLocalFrame() 151 { 152 ASSERT_NOT_REACHED(); 153 return 0; 154 } 155 156 bool WebRemoteFrameImpl::isWebRemoteFrame() const 157 { 158 return true; 159 } 160 161 WebRemoteFrame* WebRemoteFrameImpl::toWebRemoteFrame() 162 { 163 return this; 164 } 165 166 void WebRemoteFrameImpl::close() 167 { 168 #if ENABLE(OILPAN) 169 m_selfKeepAlive.clear(); 170 #else 171 deref(); 172 #endif 173 } 174 175 WebString WebRemoteFrameImpl::uniqueName() const 176 { 177 ASSERT_NOT_REACHED(); 178 return WebString(); 179 } 180 181 WebString WebRemoteFrameImpl::assignedName() const 182 { 183 ASSERT_NOT_REACHED(); 184 return WebString(); 185 } 186 187 void WebRemoteFrameImpl::setName(const WebString&) 188 { 189 ASSERT_NOT_REACHED(); 190 } 191 192 WebVector<WebIconURL> WebRemoteFrameImpl::iconURLs(int iconTypesMask) const 193 { 194 ASSERT_NOT_REACHED(); 195 return WebVector<WebIconURL>(); 196 } 197 198 void WebRemoteFrameImpl::setIsRemote(bool) 199 { 200 ASSERT_NOT_REACHED(); 201 } 202 203 void WebRemoteFrameImpl::setRemoteWebLayer(WebLayer* webLayer) 204 { 205 if (!frame()) 206 return; 207 208 frame()->setRemotePlatformLayer(webLayer); 209 } 210 211 void WebRemoteFrameImpl::setPermissionClient(WebPermissionClient*) 212 { 213 ASSERT_NOT_REACHED(); 214 } 215 216 void WebRemoteFrameImpl::setSharedWorkerRepositoryClient(WebSharedWorkerRepositoryClient*) 217 { 218 ASSERT_NOT_REACHED(); 219 } 220 221 void WebRemoteFrameImpl::setCanHaveScrollbars(bool) 222 { 223 ASSERT_NOT_REACHED(); 224 } 225 226 WebSize WebRemoteFrameImpl::scrollOffset() const 227 { 228 ASSERT_NOT_REACHED(); 229 return WebSize(); 230 } 231 232 void WebRemoteFrameImpl::setScrollOffset(const WebSize&) 233 { 234 ASSERT_NOT_REACHED(); 235 } 236 237 WebSize WebRemoteFrameImpl::minimumScrollOffset() const 238 { 239 ASSERT_NOT_REACHED(); 240 return WebSize(); 241 } 242 243 WebSize WebRemoteFrameImpl::maximumScrollOffset() const 244 { 245 ASSERT_NOT_REACHED(); 246 return WebSize(); 247 } 248 249 WebSize WebRemoteFrameImpl::contentsSize() const 250 { 251 ASSERT_NOT_REACHED(); 252 return WebSize(); 253 } 254 255 bool WebRemoteFrameImpl::hasVisibleContent() const 256 { 257 ASSERT_NOT_REACHED(); 258 return false; 259 } 260 261 WebRect WebRemoteFrameImpl::visibleContentRect() const 262 { 263 ASSERT_NOT_REACHED(); 264 return WebRect(); 265 } 266 267 bool WebRemoteFrameImpl::hasHorizontalScrollbar() const 268 { 269 ASSERT_NOT_REACHED(); 270 return false; 271 } 272 273 bool WebRemoteFrameImpl::hasVerticalScrollbar() const 274 { 275 ASSERT_NOT_REACHED(); 276 return false; 277 } 278 279 WebView* WebRemoteFrameImpl::view() const 280 { 281 if (!frame()) 282 return 0; 283 return WebViewImpl::fromPage(frame()->page()); 284 } 285 286 WebViewImpl* WebRemoteFrameImpl::viewImpl() const 287 { 288 if (!frame()) 289 return 0; 290 return WebViewImpl::fromPage(frame()->page()); 291 } 292 293 void WebRemoteFrameImpl::removeChild(WebFrame* frame) 294 { 295 WebFrame::removeChild(frame); 296 m_ownersForChildren.remove(frame); 297 } 298 299 WebDocument WebRemoteFrameImpl::document() const 300 { 301 return WebDocument(); 302 } 303 304 WebPerformance WebRemoteFrameImpl::performance() const 305 { 306 ASSERT_NOT_REACHED(); 307 return WebPerformance(); 308 } 309 310 bool WebRemoteFrameImpl::dispatchBeforeUnloadEvent() 311 { 312 ASSERT_NOT_REACHED(); 313 return false; 314 } 315 316 void WebRemoteFrameImpl::dispatchUnloadEvent() 317 { 318 ASSERT_NOT_REACHED(); 319 } 320 321 NPObject* WebRemoteFrameImpl::windowObject() const 322 { 323 ASSERT_NOT_REACHED(); 324 return 0; 325 } 326 327 void WebRemoteFrameImpl::bindToWindowObject(const WebString& name, NPObject*) 328 { 329 ASSERT_NOT_REACHED(); 330 } 331 332 void WebRemoteFrameImpl::bindToWindowObject(const WebString& name, NPObject*, void*) 333 { 334 ASSERT_NOT_REACHED(); 335 } 336 337 void WebRemoteFrameImpl::executeScript(const WebScriptSource&) 338 { 339 ASSERT_NOT_REACHED(); 340 } 341 342 void WebRemoteFrameImpl::executeScriptInIsolatedWorld( 343 int worldID, const WebScriptSource* sources, unsigned numSources, 344 int extensionGroup) 345 { 346 ASSERT_NOT_REACHED(); 347 } 348 349 void WebRemoteFrameImpl::setIsolatedWorldSecurityOrigin(int worldID, const WebSecurityOrigin&) 350 { 351 ASSERT_NOT_REACHED(); 352 } 353 354 void WebRemoteFrameImpl::setIsolatedWorldContentSecurityPolicy(int worldID, const WebString&) 355 { 356 ASSERT_NOT_REACHED(); 357 } 358 359 void WebRemoteFrameImpl::addMessageToConsole(const WebConsoleMessage&) 360 { 361 ASSERT_NOT_REACHED(); 362 } 363 364 void WebRemoteFrameImpl::collectGarbage() 365 { 366 ASSERT_NOT_REACHED(); 367 } 368 369 bool WebRemoteFrameImpl::checkIfRunInsecureContent(const WebURL&) const 370 { 371 ASSERT_NOT_REACHED(); 372 return false; 373 } 374 375 v8::Handle<v8::Value> WebRemoteFrameImpl::executeScriptAndReturnValue( 376 const WebScriptSource&) 377 { 378 ASSERT_NOT_REACHED(); 379 return v8::Handle<v8::Value>(); 380 } 381 382 void WebRemoteFrameImpl::executeScriptInIsolatedWorld( 383 int worldID, const WebScriptSource* sourcesIn, unsigned numSources, 384 int extensionGroup, WebVector<v8::Local<v8::Value> >* results) 385 { 386 ASSERT_NOT_REACHED(); 387 } 388 389 v8::Handle<v8::Value> WebRemoteFrameImpl::callFunctionEvenIfScriptDisabled( 390 v8::Handle<v8::Function>, 391 v8::Handle<v8::Value>, 392 int argc, 393 v8::Handle<v8::Value> argv[]) 394 { 395 ASSERT_NOT_REACHED(); 396 return v8::Handle<v8::Value>(); 397 } 398 399 v8::Local<v8::Context> WebRemoteFrameImpl::mainWorldScriptContext() const 400 { 401 ASSERT_NOT_REACHED(); 402 return v8::Local<v8::Context>(); 403 } 404 405 void WebRemoteFrameImpl::reload(bool ignoreCache) 406 { 407 ASSERT_NOT_REACHED(); 408 } 409 410 void WebRemoteFrameImpl::reloadWithOverrideURL(const WebURL& overrideUrl, bool ignoreCache) 411 { 412 ASSERT_NOT_REACHED(); 413 } 414 415 void WebRemoteFrameImpl::loadRequest(const WebURLRequest&) 416 { 417 ASSERT_NOT_REACHED(); 418 } 419 420 void WebRemoteFrameImpl::loadHistoryItem(const WebHistoryItem&, WebHistoryLoadType, WebURLRequest::CachePolicy) 421 { 422 ASSERT_NOT_REACHED(); 423 } 424 425 void WebRemoteFrameImpl::loadData( 426 const WebData&, const WebString& mimeType, const WebString& textEncoding, 427 const WebURL& baseURL, const WebURL& unreachableURL, bool replace) 428 { 429 ASSERT_NOT_REACHED(); 430 } 431 432 void WebRemoteFrameImpl::loadHTMLString( 433 const WebData& html, const WebURL& baseURL, const WebURL& unreachableURL, 434 bool replace) 435 { 436 ASSERT_NOT_REACHED(); 437 } 438 439 void WebRemoteFrameImpl::stopLoading() 440 { 441 ASSERT_NOT_REACHED(); 442 } 443 444 WebDataSource* WebRemoteFrameImpl::provisionalDataSource() const 445 { 446 ASSERT_NOT_REACHED(); 447 return 0; 448 } 449 450 WebDataSource* WebRemoteFrameImpl::dataSource() const 451 { 452 ASSERT_NOT_REACHED(); 453 return 0; 454 } 455 456 void WebRemoteFrameImpl::enableViewSourceMode(bool enable) 457 { 458 ASSERT_NOT_REACHED(); 459 } 460 461 bool WebRemoteFrameImpl::isViewSourceModeEnabled() const 462 { 463 ASSERT_NOT_REACHED(); 464 return false; 465 } 466 467 void WebRemoteFrameImpl::setReferrerForRequest(WebURLRequest&, const WebURL& referrer) 468 { 469 ASSERT_NOT_REACHED(); 470 } 471 472 void WebRemoteFrameImpl::dispatchWillSendRequest(WebURLRequest&) 473 { 474 ASSERT_NOT_REACHED(); 475 } 476 477 WebURLLoader* WebRemoteFrameImpl::createAssociatedURLLoader(const WebURLLoaderOptions&) 478 { 479 ASSERT_NOT_REACHED(); 480 return 0; 481 } 482 483 unsigned WebRemoteFrameImpl::unloadListenerCount() const 484 { 485 ASSERT_NOT_REACHED(); 486 return 0; 487 } 488 489 void WebRemoteFrameImpl::replaceSelection(const WebString&) 490 { 491 ASSERT_NOT_REACHED(); 492 } 493 494 void WebRemoteFrameImpl::insertText(const WebString&) 495 { 496 ASSERT_NOT_REACHED(); 497 } 498 499 void WebRemoteFrameImpl::setMarkedText(const WebString&, unsigned location, unsigned length) 500 { 501 ASSERT_NOT_REACHED(); 502 } 503 504 void WebRemoteFrameImpl::unmarkText() 505 { 506 ASSERT_NOT_REACHED(); 507 } 508 509 bool WebRemoteFrameImpl::hasMarkedText() const 510 { 511 ASSERT_NOT_REACHED(); 512 return false; 513 } 514 515 WebRange WebRemoteFrameImpl::markedRange() const 516 { 517 ASSERT_NOT_REACHED(); 518 return WebRange(); 519 } 520 521 bool WebRemoteFrameImpl::firstRectForCharacterRange(unsigned location, unsigned length, WebRect&) const 522 { 523 ASSERT_NOT_REACHED(); 524 return false; 525 } 526 527 size_t WebRemoteFrameImpl::characterIndexForPoint(const WebPoint&) const 528 { 529 ASSERT_NOT_REACHED(); 530 return 0; 531 } 532 533 bool WebRemoteFrameImpl::executeCommand(const WebString&, const WebNode&) 534 { 535 ASSERT_NOT_REACHED(); 536 return false; 537 } 538 539 bool WebRemoteFrameImpl::executeCommand(const WebString&, const WebString& value, const WebNode&) 540 { 541 ASSERT_NOT_REACHED(); 542 return false; 543 } 544 545 bool WebRemoteFrameImpl::isCommandEnabled(const WebString&) const 546 { 547 ASSERT_NOT_REACHED(); 548 return false; 549 } 550 551 void WebRemoteFrameImpl::enableContinuousSpellChecking(bool) 552 { 553 } 554 555 bool WebRemoteFrameImpl::isContinuousSpellCheckingEnabled() const 556 { 557 return false; 558 } 559 560 void WebRemoteFrameImpl::requestTextChecking(const WebElement&) 561 { 562 ASSERT_NOT_REACHED(); 563 } 564 565 void WebRemoteFrameImpl::replaceMisspelledRange(const WebString&) 566 { 567 ASSERT_NOT_REACHED(); 568 } 569 570 void WebRemoteFrameImpl::removeSpellingMarkers() 571 { 572 ASSERT_NOT_REACHED(); 573 } 574 575 bool WebRemoteFrameImpl::hasSelection() const 576 { 577 ASSERT_NOT_REACHED(); 578 return false; 579 } 580 581 WebRange WebRemoteFrameImpl::selectionRange() const 582 { 583 ASSERT_NOT_REACHED(); 584 return WebRange(); 585 } 586 587 WebString WebRemoteFrameImpl::selectionAsText() const 588 { 589 ASSERT_NOT_REACHED(); 590 return WebString(); 591 } 592 593 WebString WebRemoteFrameImpl::selectionAsMarkup() const 594 { 595 ASSERT_NOT_REACHED(); 596 return WebString(); 597 } 598 599 bool WebRemoteFrameImpl::selectWordAroundCaret() 600 { 601 ASSERT_NOT_REACHED(); 602 return false; 603 } 604 605 void WebRemoteFrameImpl::selectRange(const WebPoint& base, const WebPoint& extent) 606 { 607 ASSERT_NOT_REACHED(); 608 } 609 610 void WebRemoteFrameImpl::selectRange(const WebRange&) 611 { 612 ASSERT_NOT_REACHED(); 613 } 614 615 void WebRemoteFrameImpl::moveRangeSelection(const WebPoint& base, const WebPoint& extent) 616 { 617 ASSERT_NOT_REACHED(); 618 } 619 620 void WebRemoteFrameImpl::moveCaretSelection(const WebPoint&) 621 { 622 ASSERT_NOT_REACHED(); 623 } 624 625 bool WebRemoteFrameImpl::setEditableSelectionOffsets(int start, int end) 626 { 627 ASSERT_NOT_REACHED(); 628 return false; 629 } 630 631 bool WebRemoteFrameImpl::setCompositionFromExistingText(int compositionStart, int compositionEnd, const WebVector<WebCompositionUnderline>& underlines) 632 { 633 ASSERT_NOT_REACHED(); 634 return false; 635 } 636 637 void WebRemoteFrameImpl::extendSelectionAndDelete(int before, int after) 638 { 639 ASSERT_NOT_REACHED(); 640 } 641 642 void WebRemoteFrameImpl::setCaretVisible(bool) 643 { 644 ASSERT_NOT_REACHED(); 645 } 646 647 int WebRemoteFrameImpl::printBegin(const WebPrintParams&, const WebNode& constrainToNode) 648 { 649 ASSERT_NOT_REACHED(); 650 return 0; 651 } 652 653 float WebRemoteFrameImpl::printPage(int pageToPrint, WebCanvas*) 654 { 655 ASSERT_NOT_REACHED(); 656 return 0.0; 657 } 658 659 float WebRemoteFrameImpl::getPrintPageShrink(int page) 660 { 661 ASSERT_NOT_REACHED(); 662 return 0.0; 663 } 664 665 void WebRemoteFrameImpl::printEnd() 666 { 667 ASSERT_NOT_REACHED(); 668 } 669 670 bool WebRemoteFrameImpl::isPrintScalingDisabledForPlugin(const WebNode&) 671 { 672 ASSERT_NOT_REACHED(); 673 return false; 674 } 675 676 int WebRemoteFrameImpl::getPrintCopiesForPlugin(const WebNode&) 677 { 678 ASSERT_NOT_REACHED(); 679 return 1; 680 } 681 682 bool WebRemoteFrameImpl::hasCustomPageSizeStyle(int pageIndex) 683 { 684 ASSERT_NOT_REACHED(); 685 return false; 686 } 687 688 bool WebRemoteFrameImpl::isPageBoxVisible(int pageIndex) 689 { 690 ASSERT_NOT_REACHED(); 691 return false; 692 } 693 694 void WebRemoteFrameImpl::pageSizeAndMarginsInPixels( 695 int pageIndex, 696 WebSize& pageSize, 697 int& marginTop, 698 int& marginRight, 699 int& marginBottom, 700 int& marginLeft) 701 { 702 ASSERT_NOT_REACHED(); 703 } 704 705 WebString WebRemoteFrameImpl::pageProperty(const WebString& propertyName, int pageIndex) 706 { 707 ASSERT_NOT_REACHED(); 708 return WebString(); 709 } 710 711 void WebRemoteFrameImpl::printPagesWithBoundaries(WebCanvas*, const WebSize&) 712 { 713 ASSERT_NOT_REACHED(); 714 } 715 716 bool WebRemoteFrameImpl::find( 717 int identifier, const WebString& searchText, const WebFindOptions&, 718 bool wrapWithinFrame, WebRect* selectionRect) 719 { 720 ASSERT_NOT_REACHED(); 721 return false; 722 } 723 724 void WebRemoteFrameImpl::stopFinding(bool clearSelection) 725 { 726 ASSERT_NOT_REACHED(); 727 } 728 729 void WebRemoteFrameImpl::scopeStringMatches( 730 int identifier, const WebString& searchText, const WebFindOptions&, 731 bool reset) 732 { 733 ASSERT_NOT_REACHED(); 734 } 735 736 void WebRemoteFrameImpl::cancelPendingScopingEffort() 737 { 738 ASSERT_NOT_REACHED(); 739 } 740 741 void WebRemoteFrameImpl::increaseMatchCount(int count, int identifier) 742 { 743 ASSERT_NOT_REACHED(); 744 } 745 746 void WebRemoteFrameImpl::resetMatchCount() 747 { 748 ASSERT_NOT_REACHED(); 749 } 750 751 int WebRemoteFrameImpl::findMatchMarkersVersion() const 752 { 753 ASSERT_NOT_REACHED(); 754 return 0; 755 } 756 757 WebFloatRect WebRemoteFrameImpl::activeFindMatchRect() 758 { 759 ASSERT_NOT_REACHED(); 760 return WebFloatRect(); 761 } 762 763 void WebRemoteFrameImpl::findMatchRects(WebVector<WebFloatRect>&) 764 { 765 ASSERT_NOT_REACHED(); 766 } 767 768 int WebRemoteFrameImpl::selectNearestFindMatch(const WebFloatPoint&, WebRect* selectionRect) 769 { 770 ASSERT_NOT_REACHED(); 771 return 0; 772 } 773 774 void WebRemoteFrameImpl::setTickmarks(const WebVector<WebRect>&) 775 { 776 ASSERT_NOT_REACHED(); 777 } 778 779 void WebRemoteFrameImpl::dispatchMessageEventWithOriginCheck( 780 const WebSecurityOrigin& intendedTargetOrigin, 781 const WebDOMEvent&) 782 { 783 ASSERT_NOT_REACHED(); 784 } 785 786 WebString WebRemoteFrameImpl::contentAsText(size_t maxChars) const 787 { 788 ASSERT_NOT_REACHED(); 789 return WebString(); 790 } 791 792 WebString WebRemoteFrameImpl::contentAsMarkup() const 793 { 794 ASSERT_NOT_REACHED(); 795 return WebString(); 796 } 797 798 WebString WebRemoteFrameImpl::renderTreeAsText(RenderAsTextControls toShow) const 799 { 800 ASSERT_NOT_REACHED(); 801 return WebString(); 802 } 803 804 WebString WebRemoteFrameImpl::markerTextForListItem(const WebElement&) const 805 { 806 ASSERT_NOT_REACHED(); 807 return WebString(); 808 } 809 810 WebRect WebRemoteFrameImpl::selectionBoundsRect() const 811 { 812 ASSERT_NOT_REACHED(); 813 return WebRect(); 814 } 815 816 bool WebRemoteFrameImpl::selectionStartHasSpellingMarkerFor(int from, int length) const 817 { 818 ASSERT_NOT_REACHED(); 819 return false; 820 } 821 822 WebString WebRemoteFrameImpl::layerTreeAsText(bool showDebugInfo) const 823 { 824 ASSERT_NOT_REACHED(); 825 return WebString(); 826 } 827 828 WebLocalFrame* WebRemoteFrameImpl::createLocalChild(const WebString& name, WebFrameClient* client) 829 { 830 WebLocalFrameImpl* child = toWebLocalFrameImpl(WebLocalFrame::create(client)); 831 WillBeHeapHashMap<WebFrame*, OwnPtrWillBeMember<FrameOwner> >::AddResult result = 832 m_ownersForChildren.add(child, RemoteBridgeFrameOwner::create(child)); 833 appendChild(child); 834 // FIXME: currently this calls LocalFrame::init() on the created LocalFrame, which may 835 // result in the browser observing two navigations to about:blank (one from the initial 836 // frame creation, and one from swapping it into the remote process). FrameLoader might 837 // need a special initialization function for this case to avoid that duplicate navigation. 838 child->initializeCoreFrame(frame()->host(), result.storedValue->value.get(), name, nullAtom); 839 // Partially related with the above FIXME--the init() call may trigger JS dispatch. However, 840 // if the parent is remote, it should never be detached synchronously... 841 ASSERT(child->frame()); 842 return child; 843 } 844 845 void WebRemoteFrameImpl::initializeCoreFrame(FrameHost* host, FrameOwner* owner, const AtomicString& name) 846 { 847 setCoreFrame(RemoteFrame::create(&m_frameClient, host, owner)); 848 m_frame->tree().setName(name, nullAtom); 849 } 850 851 WebRemoteFrame* WebRemoteFrameImpl::createRemoteChild(const WebString& name, WebRemoteFrameClient* client) 852 { 853 WebRemoteFrameImpl* child = toWebRemoteFrameImpl(WebRemoteFrame::create(client)); 854 WillBeHeapHashMap<WebFrame*, OwnPtrWillBeMember<FrameOwner> >::AddResult result = 855 m_ownersForChildren.add(child, adoptPtrWillBeNoop(new PlaceholderFrameOwner)); 856 appendChild(child); 857 child->initializeCoreFrame(frame()->host(), result.storedValue->value.get(), name); 858 return child; 859 } 860 861 void WebRemoteFrameImpl::setCoreFrame(PassRefPtrWillBeRawPtr<RemoteFrame> frame) 862 { 863 m_frame = frame; 864 } 865 866 WebRemoteFrameImpl* WebRemoteFrameImpl::fromFrame(RemoteFrame& frame) 867 { 868 if (!frame.client()) 869 return 0; 870 return static_cast<RemoteFrameClient*>(frame.client())->webFrame(); 871 } 872 873 void WebRemoteFrameImpl::initializeFromFrame(WebLocalFrame* source) const 874 { 875 ASSERT(source); 876 WebLocalFrameImpl* localFrameImpl = toWebLocalFrameImpl(source); 877 client()->initializeChildFrame( 878 localFrameImpl->frame()->view()->frameRect(), 879 localFrameImpl->frame()->view()->visibleContentScaleFactor()); 880 } 881 882 } // namespace blink 883