| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/constrained_window.h" | 7 #include "chrome/browser/ui/constrained_window.h" |
| 8 #include "content/browser/tab_contents/tab_contents.h" | 8 #include "content/browser/tab_contents/tab_contents.h" |
| 9 #include "content/public/browser/notification_source.h" | 9 #include "content/public/browser/notification_source.h" |
| 10 #include "content/public/browser/notification_types.h" | 10 #include "content/public/browser/notification_types.h" |
| 11 #include "grit/generated_resources.h" | 11 #include "grit/generated_resources.h" |
| 12 #include "ui/base/l10n/l10n_util.h" | 12 #include "ui/base/l10n/l10n_util.h" |
| 13 | 13 |
| 14 using content::WebContents; | 14 using content::WebContents; |
| 15 | 15 |
| 16 TabModalConfirmDialogDelegate::TabModalConfirmDialogDelegate( | 16 TabModalConfirmDialogDelegate::TabModalConfirmDialogDelegate( |
| 17 WebContents* web_contents) | 17 WebContents* web_contents) |
| 18 : window_(NULL), | 18 : window_(NULL), |
| 19 closing_(false) { | 19 closing_(false) { |
| 20 NavigationController* controller = &web_contents->GetController(); | 20 content::NavigationController* controller = &web_contents->GetController(); |
| 21 registrar_.Add(this, content::NOTIFICATION_LOAD_START, | 21 registrar_.Add(this, content::NOTIFICATION_LOAD_START, |
| 22 content::Source<content::NavigationController>(controller)); | 22 content::Source<content::NavigationController>(controller)); |
| 23 registrar_.Add(this, content::NOTIFICATION_TAB_CLOSING, | 23 registrar_.Add(this, content::NOTIFICATION_TAB_CLOSING, |
| 24 content::Source<content::NavigationController>(controller)); | 24 content::Source<content::NavigationController>(controller)); |
| 25 } | 25 } |
| 26 | 26 |
| 27 TabModalConfirmDialogDelegate::~TabModalConfirmDialogDelegate() { | 27 TabModalConfirmDialogDelegate::~TabModalConfirmDialogDelegate() { |
| 28 // If we end up here, the constrained window has been closed, so make sure we | 28 // If we end up here, the constrained window has been closed, so make sure we |
| 29 // don't close it again. | 29 // don't close it again. |
| 30 window_ = NULL; | 30 window_ = NULL; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 86 |
| 87 void TabModalConfirmDialogDelegate::OnCanceled() { | 87 void TabModalConfirmDialogDelegate::OnCanceled() { |
| 88 } | 88 } |
| 89 | 89 |
| 90 void TabModalConfirmDialogDelegate::CloseDialog() { | 90 void TabModalConfirmDialogDelegate::CloseDialog() { |
| 91 // Make sure we won't do anything when |Cancel()| is called again. | 91 // Make sure we won't do anything when |Cancel()| is called again. |
| 92 closing_ = true; | 92 closing_ = true; |
| 93 if (window_) | 93 if (window_) |
| 94 window_->CloseConstrainedWindow(); | 94 window_->CloseConstrainedWindow(); |
| 95 } | 95 } |
| OLD | NEW |