| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2007 Google Inc. All Rights Reserved. | 2 * Copyright 2007 Google Inc. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Portions Copyright (C) 2006 Apple Computer, Inc. All rights reserved. | 4 * Portions Copyright (C) 2006 Apple Computer, Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * ***** BEGIN LICENSE BLOCK ***** | 6 * ***** BEGIN LICENSE BLOCK ***** |
| 7 * | 7 * |
| 8 * Redistribution and use in source and binary forms, with or without | 8 * Redistribution and use in source and binary forms, with or without |
| 9 * modification, are permitted provided that the following conditions | 9 * modification, are permitted provided that the following conditions |
| 10 * are met: | 10 * are met: |
| (...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 // frames in the tree, calling each frame's onbeforeunload. At the moment, | 900 // frames in the tree, calling each frame's onbeforeunload. At the moment, |
| 901 // we're consistent with Safari 3.1, not IE/FF. | 901 // we're consistent with Safari 3.1, not IE/FF. |
| 902 Frame* frame = page_->focusController()->focusedOrMainFrame(); | 902 Frame* frame = page_->focusController()->focusedOrMainFrame(); |
| 903 if (!frame) | 903 if (!frame) |
| 904 return true; | 904 return true; |
| 905 | 905 |
| 906 return frame->shouldClose(); | 906 return frame->shouldClose(); |
| 907 } | 907 } |
| 908 | 908 |
| 909 void WebViewImpl::Close() { | 909 void WebViewImpl::Close() { |
| 910 // Do this first to prevent reentrant notifications from being sent to the | |
| 911 // initiator of the close. | |
| 912 delegate_ = NULL; | |
| 913 | |
| 914 if (page_.get()) { | 910 if (page_.get()) { |
| 915 // Initiate shutdown for the entire frameset. This will cause a lot of | 911 // Initiate shutdown for the entire frameset. This will cause a lot of |
| 916 // notifications to be sent. | 912 // notifications to be sent. |
| 917 if (page_->mainFrame()) | 913 if (page_->mainFrame()) |
| 918 page_->mainFrame()->loader()->frameDetached(); | 914 page_->mainFrame()->loader()->frameDetached(); |
| 919 page_.reset(); | 915 page_.reset(); |
| 920 } | 916 } |
| 921 | 917 |
| 922 // Should happen after page_.reset(). | 918 // Should happen after page_.reset(). |
| 923 if (devtools_agent_.get()) | 919 if (devtools_agent_.get()) |
| 924 devtools_agent_.reset(NULL); | 920 devtools_agent_.reset(NULL); |
| 925 | 921 |
| 922 // Do this first to prevent reentrant notifications from being sent to the |
| 923 // initiator of the close. |
| 924 delegate_ = NULL; |
| 925 |
| 926 Release(); // Balances AddRef from WebView::Create | 926 Release(); // Balances AddRef from WebView::Create |
| 927 } | 927 } |
| 928 | 928 |
| 929 WebViewDelegate* WebViewImpl::GetDelegate() { | 929 WebViewDelegate* WebViewImpl::GetDelegate() { |
| 930 return delegate_; | 930 return delegate_; |
| 931 } | 931 } |
| 932 | 932 |
| 933 void WebViewImpl::SetDelegate(WebViewDelegate* delegate) { | 933 void WebViewImpl::SetDelegate(WebViewDelegate* delegate) { |
| 934 delegate_ = delegate; | 934 delegate_ = delegate; |
| 935 } | 935 } |
| (...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1941 | 1941 |
| 1942 return document->focusedNode(); | 1942 return document->focusedNode(); |
| 1943 } | 1943 } |
| 1944 | 1944 |
| 1945 HitTestResult WebViewImpl::HitTestResultForWindowPos(const IntPoint& pos) { | 1945 HitTestResult WebViewImpl::HitTestResultForWindowPos(const IntPoint& pos) { |
| 1946 IntPoint doc_point( | 1946 IntPoint doc_point( |
| 1947 page_->mainFrame()->view()->windowToContents(pos)); | 1947 page_->mainFrame()->view()->windowToContents(pos)); |
| 1948 return page_->mainFrame()->eventHandler()-> | 1948 return page_->mainFrame()->eventHandler()-> |
| 1949 hitTestResultAtPoint(doc_point, false); | 1949 hitTestResultAtPoint(doc_point, false); |
| 1950 } | 1950 } |
| OLD | NEW |