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

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

Issue 217543005: Move dispatchBeforeUnloadEvent to WebFrame, part 1/3. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 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) 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 2410 matching lines...) Expand 10 before | Expand all | Expand 10 after
2421 // Only change override encoding, don't change default encoding. 2421 // Only change override encoding, don't change default encoding.
2422 // Note that the new encoding must be 0 if it isn't supposed to be set. 2422 // Note that the new encoding must be 0 if it isn't supposed to be set.
2423 AtomicString newEncodingName; 2423 AtomicString newEncodingName;
2424 if (!encodingName.isEmpty()) 2424 if (!encodingName.isEmpty())
2425 newEncodingName = encodingName; 2425 newEncodingName = encodingName;
2426 m_page->mainFrame()->loader().reload(NormalReload, KURL(), newEncodingName); 2426 m_page->mainFrame()->loader().reload(NormalReload, KURL(), newEncodingName);
2427 } 2427 }
2428 2428
2429 bool WebViewImpl::dispatchBeforeUnloadEvent() 2429 bool WebViewImpl::dispatchBeforeUnloadEvent()
2430 { 2430 {
2431 // FIXME: This should really cause a recursive depth-first walk of all 2431 WebFrame* frame = mainFrame();
2432 // frames in the tree, calling each frame's onbeforeunload. At the moment,
2433 // we're consistent with Safari 3.1, not IE/FF.
2434 LocalFrame* frame = m_page->mainFrame();
2435 if (!frame) 2432 if (!frame)
2436 return true; 2433 return true;
2437 2434
2438 return frame->loader().shouldClose(); 2435 return frame->dispatchBeforeUnloadEvent();
2439 } 2436 }
2440 2437
2441 void WebViewImpl::dispatchUnloadEvent() 2438 void WebViewImpl::dispatchUnloadEvent()
2442 { 2439 {
2443 // Run unload handlers. 2440 // Run unload handlers.
2444 m_page->mainFrame()->loader().closeURL(); 2441 m_page->mainFrame()->loader().closeURL();
2445 } 2442 }
2446 2443
2447 WebFrame* WebViewImpl::mainFrame() 2444 WebFrame* WebViewImpl::mainFrame()
2448 { 2445 {
(...skipping 1554 matching lines...) Expand 10 before | Expand all | Expand 10 after
4003 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4000 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
4004 4001
4005 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 4002 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
4006 return false; 4003 return false;
4007 4004
4008 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4005 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4009 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4006 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4010 } 4007 }
4011 4008
4012 } // namespace blink 4009 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698