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

Side by Side Diff: Source/web/WebViewImpl.cpp

Issue 31063004: Have Frame::loader() return a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 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
« no previous file with comments | « Source/web/WebSharedWorkerImpl.cpp ('k') | Source/web/tests/FrameLoaderClientImplTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 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 1622 matching lines...) Expand 10 before | Expand all | Expand 10 after
1633 } 1633 }
1634 1634
1635 // WebWidget ------------------------------------------------------------------ 1635 // WebWidget ------------------------------------------------------------------
1636 1636
1637 void WebViewImpl::close() 1637 void WebViewImpl::close()
1638 { 1638 {
1639 if (m_page) { 1639 if (m_page) {
1640 // Initiate shutdown for the entire frameset. This will cause a lot of 1640 // Initiate shutdown for the entire frameset. This will cause a lot of
1641 // notifications to be sent. 1641 // notifications to be sent.
1642 if (m_page->mainFrame()) 1642 if (m_page->mainFrame())
1643 m_page->mainFrame()->loader()->frameDetached(); 1643 m_page->mainFrame()->loader().frameDetached();
1644 1644
1645 m_page.clear(); 1645 m_page.clear();
1646 } 1646 }
1647 1647
1648 // Should happen after m_page.clear(). 1648 // Should happen after m_page.clear().
1649 if (m_devToolsAgent) 1649 if (m_devToolsAgent)
1650 m_devToolsAgent.clear(); 1650 m_devToolsAgent.clear();
1651 1651
1652 // Helper Plugins must be closed now since doing so accesses RenderViewImpl, 1652 // Helper Plugins must be closed now since doing so accesses RenderViewImpl,
1653 // which will be destroyed after this function returns. 1653 // which will be destroyed after this function returns.
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after
2521 void WebViewImpl::setPageEncoding(const WebString& encodingName) 2521 void WebViewImpl::setPageEncoding(const WebString& encodingName)
2522 { 2522 {
2523 if (!m_page) 2523 if (!m_page)
2524 return; 2524 return;
2525 2525
2526 // Only change override encoding, don't change default encoding. 2526 // Only change override encoding, don't change default encoding.
2527 // Note that the new encoding must be 0 if it isn't supposed to be set. 2527 // Note that the new encoding must be 0 if it isn't supposed to be set.
2528 String newEncodingName; 2528 String newEncodingName;
2529 if (!encodingName.isEmpty()) 2529 if (!encodingName.isEmpty())
2530 newEncodingName = encodingName; 2530 newEncodingName = encodingName;
2531 m_page->mainFrame()->loader()->reload(NormalReload, KURL(), newEncodingName) ; 2531 m_page->mainFrame()->loader().reload(NormalReload, KURL(), newEncodingName);
2532 } 2532 }
2533 2533
2534 bool WebViewImpl::dispatchBeforeUnloadEvent() 2534 bool WebViewImpl::dispatchBeforeUnloadEvent()
2535 { 2535 {
2536 // FIXME: This should really cause a recursive depth-first walk of all 2536 // FIXME: This should really cause a recursive depth-first walk of all
2537 // frames in the tree, calling each frame's onbeforeunload. At the moment, 2537 // frames in the tree, calling each frame's onbeforeunload. At the moment,
2538 // we're consistent with Safari 3.1, not IE/FF. 2538 // we're consistent with Safari 3.1, not IE/FF.
2539 Frame* frame = m_page->mainFrame(); 2539 Frame* frame = m_page->mainFrame();
2540 if (!frame) 2540 if (!frame)
2541 return true; 2541 return true;
2542 2542
2543 return frame->loader()->shouldClose(); 2543 return frame->loader().shouldClose();
2544 } 2544 }
2545 2545
2546 void WebViewImpl::dispatchUnloadEvent() 2546 void WebViewImpl::dispatchUnloadEvent()
2547 { 2547 {
2548 // Run unload handlers. 2548 // Run unload handlers.
2549 m_page->mainFrame()->loader()->closeURL(); 2549 m_page->mainFrame()->loader().closeURL();
2550 } 2550 }
2551 2551
2552 WebFrame* WebViewImpl::mainFrame() 2552 WebFrame* WebViewImpl::mainFrame()
2553 { 2553 {
2554 return mainFrameImpl(); 2554 return mainFrameImpl();
2555 } 2555 }
2556 2556
2557 WebFrame* WebViewImpl::findFrameByName( 2557 WebFrame* WebViewImpl::findFrameByName(
2558 const WebString& name, WebFrame* relativeToFrame) 2558 const WebString& name, WebFrame* relativeToFrame)
2559 { 2559 {
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
3045 m_savedPageScaleFactor = 0; 3045 m_savedPageScaleFactor = 0;
3046 m_savedScrollOffset = IntSize(); 3046 m_savedScrollOffset = IntSize();
3047 } 3047 }
3048 3048
3049 void WebViewImpl::resetScrollAndScaleState() 3049 void WebViewImpl::resetScrollAndScaleState()
3050 { 3050 {
3051 page()->setPageScaleFactor(1, IntPoint()); 3051 page()->setPageScaleFactor(1, IntPoint());
3052 3052
3053 // Clear out the values for the current history item. This will prevent the history item from clobbering the 3053 // Clear out the values for the current history item. This will prevent the history item from clobbering the
3054 // value determined during page scale initialization, which may be less than 1. 3054 // value determined during page scale initialization, which may be less than 1.
3055 page()->mainFrame()->loader()->history()->saveDocumentAndScrollState(); 3055 page()->mainFrame()->loader().history()->saveDocumentAndScrollState();
3056 page()->mainFrame()->loader()->history()->clearScrollPositionAndViewState(); 3056 page()->mainFrame()->loader().history()->clearScrollPositionAndViewState();
3057 m_pageScaleConstraintsSet.setNeedsReset(true); 3057 m_pageScaleConstraintsSet.setNeedsReset(true);
3058 3058
3059 // Clobber saved scales and scroll offsets. 3059 // Clobber saved scales and scroll offsets.
3060 if (FrameView* view = page()->mainFrame()->document()->view()) 3060 if (FrameView* view = page()->mainFrame()->document()->view())
3061 view->cacheCurrentScrollPosition(); 3061 view->cacheCurrentScrollPosition();
3062 resetSavedScrollAndScaleState(); 3062 resetSavedScrollAndScaleState();
3063 } 3063 }
3064 3064
3065 void WebViewImpl::setFixedLayoutSize(const WebSize& layoutSize) 3065 void WebViewImpl::setFixedLayoutSize(const WebSize& layoutSize)
3066 { 3066 {
(...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after
4116 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4116 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
4117 4117
4118 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 4118 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
4119 return false; 4119 return false;
4120 4120
4121 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4121 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4122 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4122 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4123 } 4123 }
4124 4124
4125 } // namespace WebKit 4125 } // namespace WebKit
OLDNEW
« no previous file with comments | « Source/web/WebSharedWorkerImpl.cpp ('k') | Source/web/tests/FrameLoaderClientImplTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698