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

Side by Side Diff: Source/core/page/Page.cpp

Issue 338993003: Cleanup various WebView/WebFrame APIs to properly handle remote frames. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove unneeded header. Created 6 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All R ights Reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All R ights Reserved.
3 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 3 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 , m_animator(this) 117 , m_animator(this)
118 , m_autoscrollController(AutoscrollController::create(*this)) 118 , m_autoscrollController(AutoscrollController::create(*this))
119 , m_chrome(Chrome::create(this, pageClients.chromeClient)) 119 , m_chrome(Chrome::create(this, pageClients.chromeClient))
120 , m_dragCaretController(DragCaretController::create()) 120 , m_dragCaretController(DragCaretController::create())
121 , m_dragController(DragController::create(this, pageClients.dragClient)) 121 , m_dragController(DragController::create(this, pageClients.dragClient))
122 , m_focusController(FocusController::create(this)) 122 , m_focusController(FocusController::create(this))
123 , m_contextMenuController(ContextMenuController::create(this, pageClients.co ntextMenuClient)) 123 , m_contextMenuController(ContextMenuController::create(this, pageClients.co ntextMenuClient))
124 , m_inspectorController(InspectorController::create(this, pageClients.inspec torClient)) 124 , m_inspectorController(InspectorController::create(this, pageClients.inspec torClient))
125 , m_pointerLockController(PointerLockController::create(this)) 125 , m_pointerLockController(PointerLockController::create(this))
126 , m_undoStack(UndoStack::create()) 126 , m_undoStack(UndoStack::create())
127 , m_mainFrame(0)
127 , m_backForwardClient(pageClients.backForwardClient) 128 , m_backForwardClient(pageClients.backForwardClient)
128 , m_editorClient(pageClients.editorClient) 129 , m_editorClient(pageClients.editorClient)
129 , m_spellCheckerClient(pageClients.spellCheckerClient) 130 , m_spellCheckerClient(pageClients.spellCheckerClient)
130 , m_storageClient(pageClients.storageClient) 131 , m_storageClient(pageClients.storageClient)
131 , m_subframeCount(0) 132 , m_subframeCount(0)
132 , m_openedByDOM(false) 133 , m_openedByDOM(false)
133 , m_tabKeyCyclesThroughElements(true) 134 , m_tabKeyCyclesThroughElements(true)
134 , m_defersLoading(false) 135 , m_defersLoading(false)
135 , m_deviceScaleFactor(1) 136 , m_deviceScaleFactor(1)
136 , m_timerAlignmentInterval(DOMTimer::visiblePageAlignmentInterval()) 137 , m_timerAlignmentInterval(DOMTimer::visiblePageAlignmentInterval())
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 Vector<IntRect> rects; 191 Vector<IntRect> rects;
191 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator( )) 192 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator( ))
192 rects = scrollingCoordinator->computeShouldHandleScrollGestureOnMainThre adRegion(frame, IntPoint()).rects(); 193 rects = scrollingCoordinator->computeShouldHandleScrollGestureOnMainThre adRegion(frame, IntPoint()).rects();
193 194
194 Vector<FloatQuad> quads(rects.size()); 195 Vector<FloatQuad> quads(rects.size());
195 for (size_t i = 0; i < rects.size(); ++i) 196 for (size_t i = 0; i < rects.size(); ++i)
196 quads[i] = FloatRect(rects[i]); 197 quads[i] = FloatRect(rects[i]);
197 return ClientRectList::create(quads); 198 return ClientRectList::create(quads);
198 } 199 }
199 200
200 void Page::setMainFrame(PassRefPtr<Frame> mainFrame) 201 void Page::setMainFrame(Frame* mainFrame)
201 { 202 {
202 ASSERT(!m_mainFrame); // Should only be called during initialization 203 ASSERT(!m_mainFrame); // Should only be called during initialization
203 m_mainFrame = mainFrame; 204 m_mainFrame = mainFrame;
204 } 205 }
205 206
206 void Page::documentDetached(Document* document) 207 void Page::documentDetached(Document* document)
207 { 208 {
208 m_multisamplingChangedObservers.clear(); 209 m_multisamplingChangedObservers.clear();
209 m_pointerLockController->documentDetached(document); 210 m_pointerLockController->documentDetached(document);
210 m_contextMenuController->documentDetached(document); 211 m_contextMenuController->documentDetached(document);
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 deprecatedLocalMainFrame()->deviceOrPageScaleFactorChanged(); 376 deprecatedLocalMainFrame()->deviceOrPageScaleFactorChanged();
376 m_chrome->client().deviceOrPageScaleFactorChanged(); 377 m_chrome->client().deviceOrPageScaleFactorChanged();
377 } 378 }
378 } 379 }
379 380
380 void Page::allVisitedStateChanged() 381 void Page::allVisitedStateChanged()
381 { 382 {
382 HashSet<Page*>::iterator pagesEnd = ordinaryPages().end(); 383 HashSet<Page*>::iterator pagesEnd = ordinaryPages().end();
383 for (HashSet<Page*>::iterator it = ordinaryPages().begin(); it != pagesEnd; ++it) { 384 for (HashSet<Page*>::iterator it = ordinaryPages().begin(); it != pagesEnd; ++it) {
384 Page* page = *it; 385 Page* page = *it;
385 for (Frame* frame = page->m_mainFrame.get(); frame; frame = frame->tree( ).traverseNext()) { 386 for (Frame* frame = page->m_mainFrame; frame; frame = frame->tree().trav erseNext()) {
386 if (frame->isLocalFrame()) 387 if (frame->isLocalFrame())
387 toLocalFrame(frame)->document()->visitedLinkState().invalidateSt yleForAllLinks(); 388 toLocalFrame(frame)->document()->visitedLinkState().invalidateSt yleForAllLinks();
388 } 389 }
389 } 390 }
390 } 391 }
391 392
392 void Page::visitedStateChanged(LinkHash linkHash) 393 void Page::visitedStateChanged(LinkHash linkHash)
393 { 394 {
394 HashSet<Page*>::iterator pagesEnd = ordinaryPages().end(); 395 HashSet<Page*>::iterator pagesEnd = ordinaryPages().end();
395 for (HashSet<Page*>::iterator it = ordinaryPages().begin(); it != pagesEnd; ++it) { 396 for (HashSet<Page*>::iterator it = ordinaryPages().begin(); it != pagesEnd; ++it) {
396 Page* page = *it; 397 Page* page = *it;
397 for (Frame* frame = page->m_mainFrame.get(); frame; frame = frame->tree( ).traverseNext()) { 398 for (Frame* frame = page->m_mainFrame; frame; frame = frame->tree().trav erseNext()) {
398 if (frame->isLocalFrame()) 399 if (frame->isLocalFrame())
399 toLocalFrame(frame)->document()->visitedLinkState().invalidateSt yleForLink(linkHash); 400 toLocalFrame(frame)->document()->visitedLinkState().invalidateSt yleForLink(linkHash);
400 } 401 }
401 } 402 }
402 } 403 }
403 404
404 StorageNamespace* Page::sessionStorage(bool optionalCreate) 405 StorageNamespace* Page::sessionStorage(bool optionalCreate)
405 { 406 {
406 if (!m_sessionStorage && optionalCreate) 407 if (!m_sessionStorage && optionalCreate)
407 m_sessionStorage = m_storageClient->createSessionStorageNamespace(); 408 m_sessionStorage = m_storageClient->createSessionStorageNamespace();
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 visitor->trace(m_pointerLockController); 597 visitor->trace(m_pointerLockController);
597 visitor->trace(m_undoStack); 598 visitor->trace(m_undoStack);
598 visitor->trace(m_validationMessageClient); 599 visitor->trace(m_validationMessageClient);
599 visitor->trace(m_multisamplingChangedObservers); 600 visitor->trace(m_multisamplingChangedObservers);
600 visitor->trace(m_frameHost); 601 visitor->trace(m_frameHost);
601 WillBeHeapSupplementable<Page>::trace(visitor); 602 WillBeHeapSupplementable<Page>::trace(visitor);
602 } 603 }
603 604
604 void Page::willBeDestroyed() 605 void Page::willBeDestroyed()
605 { 606 {
606 if (m_mainFrame && m_mainFrame->isLocalFrame()) 607 RefPtr<Frame> mainFrame = m_mainFrame;
607 deprecatedLocalMainFrame()->loader().frameDetached(); 608
609 if (mainFrame->isLocalFrame())
610 toLocalFrame(mainFrame.get())->loader().frameDetached();
608 611
609 // Disable all agents prior to resetting the frame view. 612 // Disable all agents prior to resetting the frame view.
610 m_inspectorController->willBeDestroyed(); 613 m_inspectorController->willBeDestroyed();
611 614
612 if (m_mainFrame->isLocalFrame()) { 615 if (mainFrame->isLocalFrame()) {
613 toLocalFrame(m_mainFrame.get())->setView(nullptr); 616 toLocalFrame(mainFrame.get())->setView(nullptr);
614 } else { 617 } else {
615 ASSERT(m_mainFrame->isRemoteFrame()); 618 ASSERT(m_mainFrame->isRemoteFrame());
616 toRemoteFrame(m_mainFrame.get())->setView(nullptr); 619 toRemoteFrame(mainFrame.get())->setView(nullptr);
617 } 620 }
618 621
619 allPages().remove(this); 622 allPages().remove(this);
620 if (ordinaryPages().contains(this)) 623 if (ordinaryPages().contains(this))
621 ordinaryPages().remove(this); 624 ordinaryPages().remove(this);
622 625
623 if (m_scrollingCoordinator) 626 if (m_scrollingCoordinator)
624 m_scrollingCoordinator->willBeDestroyed(); 627 m_scrollingCoordinator->willBeDestroyed();
625 628
626 #ifndef NDEBUG 629 #ifndef NDEBUG
627 pageCounter.decrement(); 630 pageCounter.decrement();
628 #endif 631 #endif
629 632
630 m_chrome->willBeDestroyed(); 633 m_chrome->willBeDestroyed();
631 m_mainFrame.clear(); 634 m_mainFrame = 0;
632 if (m_validationMessageClient) 635 if (m_validationMessageClient)
633 m_validationMessageClient->willBeDestroyed(); 636 m_validationMessageClient->willBeDestroyed();
634 WillBeHeapSupplementable<Page>::willBeDestroyed(); 637 WillBeHeapSupplementable<Page>::willBeDestroyed();
635 } 638 }
636 639
637 Page::PageClients::PageClients() 640 Page::PageClients::PageClients()
638 : chromeClient(0) 641 : chromeClient(0)
639 , contextMenuClient(0) 642 , contextMenuClient(0)
640 , editorClient(0) 643 , editorClient(0)
641 , dragClient(0) 644 , dragClient(0)
642 , inspectorClient(0) 645 , inspectorClient(0)
643 , backForwardClient(0) 646 , backForwardClient(0)
644 , spellCheckerClient(0) 647 , spellCheckerClient(0)
645 , storageClient(0) 648 , storageClient(0)
646 { 649 {
647 } 650 }
648 651
649 Page::PageClients::~PageClients() 652 Page::PageClients::~PageClients()
650 { 653 {
651 } 654 }
652 655
653 } // namespace WebCore 656 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698