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

Side by Side Diff: chrome/browser/ui/tab_modal_confirm_dialog_delegate.cc

Issue 12276010: Factor out uses of the WebContentsModalDialog interface from platform-independent code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove incorrect override Created 7 years, 10 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h" 5 #include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h"
6 6
7 #include "chrome/browser/ui/web_contents_modal_dialog.h"
8 #include "chrome/common/chrome_notification_types.h" 7 #include "chrome/common/chrome_notification_types.h"
9 #include "content/public/browser/navigation_controller.h" 8 #include "content/public/browser/navigation_controller.h"
10 #include "content/public/browser/notification_source.h" 9 #include "content/public/browser/notification_source.h"
11 #include "content/public/browser/web_contents.h" 10 #include "content/public/browser/web_contents.h"
12 #include "grit/generated_resources.h" 11 #include "grit/generated_resources.h"
13 #include "ui/base/l10n/l10n_util.h" 12 #include "ui/base/l10n/l10n_util.h"
14 13
15 using content::NavigationController; 14 using content::NavigationController;
16 using content::WebContents; 15 using content::WebContents;
17 16
18 TabModalConfirmDialogDelegate::TabModalConfirmDialogDelegate( 17 TabModalConfirmDialogDelegate::TabModalConfirmDialogDelegate(
19 WebContents* web_contents) 18 WebContents* web_contents)
20 : window_(NULL), 19 : close_delegate_(NULL),
21 closing_(false) { 20 closing_(false) {
22 NavigationController* controller = &web_contents->GetController(); 21 NavigationController* controller = &web_contents->GetController();
23 registrar_.Add(this, content::NOTIFICATION_LOAD_START, 22 registrar_.Add(this, content::NOTIFICATION_LOAD_START,
24 content::Source<NavigationController>(controller)); 23 content::Source<NavigationController>(controller));
25 registrar_.Add(this, chrome::NOTIFICATION_TAB_CLOSING, 24 registrar_.Add(this, chrome::NOTIFICATION_TAB_CLOSING,
26 content::Source<NavigationController>(controller)); 25 content::Source<NavigationController>(controller));
27 } 26 }
28 27
29 TabModalConfirmDialogDelegate::~TabModalConfirmDialogDelegate() { 28 TabModalConfirmDialogDelegate::~TabModalConfirmDialogDelegate() {
30 // If we end up here, the constrained window has been closed, so make sure we 29 // If we end up here, the window has been closed, so make sure we don't close
31 // don't close it again. 30 // it again.
32 window_ = NULL; 31 close_delegate_ = NULL;
33 // Make sure everything is cleaned up. 32 // Make sure everything is cleaned up.
34 Cancel(); 33 Cancel();
35 } 34 }
36 35
37 void TabModalConfirmDialogDelegate::Cancel() { 36 void TabModalConfirmDialogDelegate::Cancel() {
38 if (closing_) 37 if (closing_)
39 return; 38 return;
40 // Make sure we won't do anything when |Cancel()| or |Accept()| is called 39 // Make sure we won't do anything when |Cancel()| or |Accept()| is called
41 // again. 40 // again.
42 closing_ = true; 41 closing_ = true;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 return NULL; 88 return NULL;
90 } 89 }
91 90
92 void TabModalConfirmDialogDelegate::OnAccepted() { 91 void TabModalConfirmDialogDelegate::OnAccepted() {
93 } 92 }
94 93
95 void TabModalConfirmDialogDelegate::OnCanceled() { 94 void TabModalConfirmDialogDelegate::OnCanceled() {
96 } 95 }
97 96
98 void TabModalConfirmDialogDelegate::CloseDialog() { 97 void TabModalConfirmDialogDelegate::CloseDialog() {
99 if (window_) 98 if (close_delegate_)
100 window_->CloseWebContentsModalDialog(); 99 close_delegate_->CloseDialog();
101 } 100 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698