summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/importing_progress_view.cc
diff options
context:
space:
mode:
authorfinnur@google.com <finnur@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-27 04:15:38 +0000
committerfinnur@google.com <finnur@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-27 04:15:38 +0000
commitbae6bacdb21be60714c634fcb4559fc82d513232 (patch)
treea9dc2a248a9c41b25573dabba8c914a08b81ddfb /chrome/browser/views/importing_progress_view.cc
parent5a52f16a208389a6f8d285cd63333f6bfe17997d (diff)
downloadchromium_src-bae6bacdb21be60714c634fcb4559fc82d513232.zip
chromium_src-bae6bacdb21be60714c634fcb4559fc82d513232.tar.gz
chromium_src-bae6bacdb21be60714c634fcb4559fc82d513232.tar.bz2
No code change. Just adding some comments explaining why we need to keep track of whether or not we are importing when Cancel is called. It was non-obvious and it wasn't until I had attempted to remove it that the reason became clear (Cancel is called again when ImportEnded calls Window::Close and we must return true in this case).
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1426 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/importing_progress_view.cc')
-rw-r--r--chrome/browser/views/importing_progress_view.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/chrome/browser/views/importing_progress_view.cc b/chrome/browser/views/importing_progress_view.cc
index db4ad1f..0d55d0e 100644
--- a/chrome/browser/views/importing_progress_view.cc
+++ b/chrome/browser/views/importing_progress_view.cc
@@ -185,12 +185,16 @@ std::wstring ImportingProgressView::GetWindowTitle() const {
}
bool ImportingProgressView::Cancel() {
+ // When the user cancels the import, we need to tell the coordinator to stop
+ // importing and return false so that the window lives long enough to receive
+ // ImportEnded, which will close the window. Closing the window results in
+ // another call to this function and at that point we must return true to
+ // allow the window to close.
if (!importing_)
- return true;
+ return true; // We have received ImportEnded, so we can close.
+ // Cancel the import and wait for further instructions.
coordinator_->Cancel();
- // Return false because the window needs to live long enough to receive
- // ImportEnded, which will close the window.
return false;
}