| OLD | NEW |
| 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/views/tab_modal_confirm_dialog_views.h" | 5 #include "chrome/browser/ui/views/tab_modal_confirm_dialog_views.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/ui/browser_dialogs.h" | 8 #include "chrome/browser/ui/browser_dialogs.h" |
| 9 #include "chrome/browser/ui/browser_list.h" | 9 #include "chrome/browser/ui/browser_list.h" |
| 10 #include "chrome/browser/ui/browser_window.h" | 10 #include "chrome/browser/ui/browser_window.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 } | 25 } |
| 26 | 26 |
| 27 ////////////////////////////////////////////////////////////////////////////// | 27 ////////////////////////////////////////////////////////////////////////////// |
| 28 // TabModalConfirmDialogViews, constructor & destructor: | 28 // TabModalConfirmDialogViews, constructor & destructor: |
| 29 | 29 |
| 30 TabModalConfirmDialogViews::TabModalConfirmDialogViews( | 30 TabModalConfirmDialogViews::TabModalConfirmDialogViews( |
| 31 TabModalConfirmDialogDelegate* delegate, | 31 TabModalConfirmDialogDelegate* delegate, |
| 32 content::WebContents* web_contents) | 32 content::WebContents* web_contents) |
| 33 : delegate_(delegate), | 33 : delegate_(delegate), |
| 34 message_box_view_(new views::MessageBoxView( | 34 message_box_view_(new views::MessageBoxView( |
| 35 views::MessageBoxView::InitParams(delegate->GetMessage()))) { | 35 views::MessageBoxView::InitParams(delegate->GetMessage()))), |
| 36 delegate_->set_window(ConstrainedWindowViews::Create(web_contents, this)); | 36 dialog_(NULL) { |
| 37 dialog_ = ConstrainedWindowViews::Create(web_contents, this); |
| 38 delegate_->set_close_delegate(this); |
| 37 } | 39 } |
| 38 | 40 |
| 39 TabModalConfirmDialogViews::~TabModalConfirmDialogViews() { | 41 TabModalConfirmDialogViews::~TabModalConfirmDialogViews() { |
| 40 } | 42 } |
| 41 | 43 |
| 42 void TabModalConfirmDialogViews::AcceptTabModalDialog() { | 44 void TabModalConfirmDialogViews::AcceptTabModalDialog() { |
| 43 GetDialogClientView()->AcceptWindow(); | 45 GetDialogClientView()->AcceptWindow(); |
| 44 } | 46 } |
| 45 | 47 |
| 46 void TabModalConfirmDialogViews::CancelTabModalDialog() { | 48 void TabModalConfirmDialogViews::CancelTabModalDialog() { |
| 47 GetDialogClientView()->CancelWindow(); | 49 GetDialogClientView()->CancelWindow(); |
| 48 } | 50 } |
| 49 | 51 |
| 52 void TabModalConfirmDialogViews::CloseDialog() { |
| 53 dialog_->CloseWebContentsModalDialog(); |
| 54 } |
| 55 |
| 50 ////////////////////////////////////////////////////////////////////////////// | 56 ////////////////////////////////////////////////////////////////////////////// |
| 51 // TabModalConfirmDialogViews, views::DialogDelegate implementation: | 57 // TabModalConfirmDialogViews, views::DialogDelegate implementation: |
| 52 | 58 |
| 53 string16 TabModalConfirmDialogViews::GetWindowTitle() const { | 59 string16 TabModalConfirmDialogViews::GetWindowTitle() const { |
| 54 return delegate_->GetTitle(); | 60 return delegate_->GetTitle(); |
| 55 } | 61 } |
| 56 | 62 |
| 57 string16 TabModalConfirmDialogViews::GetDialogButtonLabel( | 63 string16 TabModalConfirmDialogViews::GetDialogButtonLabel( |
| 58 ui::DialogButton button) const { | 64 ui::DialogButton button) const { |
| 59 if (button == ui::DIALOG_BUTTON_OK) | 65 if (button == ui::DIALOG_BUTTON_OK) |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 delete this; | 98 delete this; |
| 93 } | 99 } |
| 94 | 100 |
| 95 ui::ModalType TabModalConfirmDialogViews::GetModalType() const { | 101 ui::ModalType TabModalConfirmDialogViews::GetModalType() const { |
| 96 #if defined(USE_ASH) | 102 #if defined(USE_ASH) |
| 97 return ui::MODAL_TYPE_CHILD; | 103 return ui::MODAL_TYPE_CHILD; |
| 98 #else | 104 #else |
| 99 return views::WidgetDelegate::GetModalType(); | 105 return views::WidgetDelegate::GetModalType(); |
| 100 #endif | 106 #endif |
| 101 } | 107 } |
| OLD | NEW |