Chromium Code Reviews| 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 22 matching lines...) Expand all Loading... | |
| 33 TabContents* tab_contents) | 33 TabContents* tab_contents) |
| 34 : delegate_(delegate), | 34 : delegate_(delegate), |
| 35 message_box_view_(new views::MessageBoxView( | 35 message_box_view_(new views::MessageBoxView( |
| 36 views::MessageBoxView::InitParams(delegate->GetMessage()))) { | 36 views::MessageBoxView::InitParams(delegate->GetMessage()))) { |
| 37 delegate_->set_window(new ConstrainedWindowViews(tab_contents, this)); | 37 delegate_->set_window(new ConstrainedWindowViews(tab_contents, this)); |
| 38 } | 38 } |
| 39 | 39 |
| 40 TabModalConfirmDialogViews::~TabModalConfirmDialogViews() { | 40 TabModalConfirmDialogViews::~TabModalConfirmDialogViews() { |
| 41 } | 41 } |
| 42 | 42 |
| 43 void TabModalConfirmDialogViews::AcceptTabModalDialog() { | |
| 44 GetDialogClientView()->AcceptWindow(); | |
| 45 } | |
| 46 | |
| 47 void TabModalConfirmDialogViews::CancelTabModalDialog() { | |
| 48 GetDialogClientView()->CancelWindow(); | |
| 49 } | |
| 50 | |
| 43 ////////////////////////////////////////////////////////////////////////////// | 51 ////////////////////////////////////////////////////////////////////////////// |
| 44 // TabModalConfirmDialogViews, views::DialogDelegate implementation: | 52 // TabModalConfirmDialogViews, views::DialogDelegate implementation: |
| 45 | 53 |
| 46 string16 TabModalConfirmDialogViews::GetWindowTitle() const { | 54 string16 TabModalConfirmDialogViews::GetWindowTitle() const { |
| 47 return delegate_->GetTitle(); | 55 return delegate_->GetTitle(); |
| 48 } | 56 } |
| 49 | 57 |
| 50 string16 TabModalConfirmDialogViews::GetDialogButtonLabel( | 58 string16 TabModalConfirmDialogViews::GetDialogButtonLabel( |
| 51 ui::DialogButton button) const { | 59 ui::DialogButton button) const { |
| 52 if (button == ui::DIALOG_BUTTON_OK) | 60 if (button == ui::DIALOG_BUTTON_OK) |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 77 return message_box_view_->GetWidget(); | 85 return message_box_view_->GetWidget(); |
| 78 } | 86 } |
| 79 | 87 |
| 80 const views::Widget* TabModalConfirmDialogViews::GetWidget() const { | 88 const views::Widget* TabModalConfirmDialogViews::GetWidget() const { |
| 81 return message_box_view_->GetWidget(); | 89 return message_box_view_->GetWidget(); |
| 82 } | 90 } |
| 83 | 91 |
| 84 void TabModalConfirmDialogViews::DeleteDelegate() { | 92 void TabModalConfirmDialogViews::DeleteDelegate() { |
| 85 delete this; | 93 delete this; |
| 86 } | 94 } |
| 95 | |
| 96 // static | |
| 97 TabModalConfirmDialog* TabModalConfirmDialog::Create( | |
|
Peter Kasting
2012/09/25 00:39:20
Nit: Put this atop the .cc file
tfarina
2012/09/25 02:03:38
Done.
| |
| 98 TabModalConfirmDialogDelegate* delegate, | |
| 99 TabContents* tab_contents) { | |
| 100 return new TabModalConfirmDialogViews(delegate, tab_contents); | |
| 101 } | |
| OLD | NEW |