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

Side by Side Diff: chrome/browser/ui/views/confirm_message_box_dialog.cc

Issue 6257006: Move a bunch of random other files to src/ui/base... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 11 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) 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/views/confirm_message_box_dialog.h" 5 #include "chrome/browser/ui/views/confirm_message_box_dialog.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/message_box_flags.h"
9 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
10 #include "grit/generated_resources.h" 9 #include "grit/generated_resources.h"
11 #include "grit/locale_settings.h" 10 #include "grit/locale_settings.h"
11 #include "ui/base/message_box_flags.h"
12 #include "views/standard_layout.h" 12 #include "views/standard_layout.h"
13 #include "views/widget/widget.h" 13 #include "views/widget/widget.h"
14 #include "views/window/window.h" 14 #include "views/window/window.h"
15 15
16 // static 16 // static
17 void ConfirmMessageBoxDialog::Run(gfx::NativeWindow parent, 17 void ConfirmMessageBoxDialog::Run(gfx::NativeWindow parent,
18 ConfirmMessageBoxObserver* observer, 18 ConfirmMessageBoxObserver* observer,
19 const std::wstring& message_text, 19 const std::wstring& message_text,
20 const std::wstring& window_title) { 20 const std::wstring& window_title) {
21 DCHECK(observer); 21 DCHECK(observer);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 IDS_CONFIRM_MESSAGEBOX_YES_BUTTON_LABEL))), 58 IDS_CONFIRM_MESSAGEBOX_YES_BUTTON_LABEL))),
59 reject_label_(UTF16ToWide(l10n_util::GetStringUTF16( 59 reject_label_(UTF16ToWide(l10n_util::GetStringUTF16(
60 IDS_CONFIRM_MESSAGEBOX_NO_BUTTON_LABEL))) { 60 IDS_CONFIRM_MESSAGEBOX_NO_BUTTON_LABEL))) {
61 message_label_ = new views::Label(message_text); 61 message_label_ = new views::Label(message_text);
62 message_label_->SetMultiLine(true); 62 message_label_->SetMultiLine(true);
63 message_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 63 message_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
64 AddChildView(message_label_); 64 AddChildView(message_label_);
65 } 65 }
66 66
67 int ConfirmMessageBoxDialog::GetDialogButtons() const { 67 int ConfirmMessageBoxDialog::GetDialogButtons() const {
68 return MessageBoxFlags::DIALOGBUTTON_OK | 68 return ui::MessageBoxFlags::DIALOGBUTTON_OK |
69 MessageBoxFlags::DIALOGBUTTON_CANCEL; 69 ui::MessageBoxFlags::DIALOGBUTTON_CANCEL;
70 } 70 }
71 71
72 std::wstring ConfirmMessageBoxDialog::GetWindowTitle() const { 72 std::wstring ConfirmMessageBoxDialog::GetWindowTitle() const {
73 return window_title_; 73 return window_title_;
74 } 74 }
75 75
76 std::wstring ConfirmMessageBoxDialog::GetDialogButtonLabel( 76 std::wstring ConfirmMessageBoxDialog::GetDialogButtonLabel(
77 MessageBoxFlags::DialogButton button) const { 77 ui::MessageBoxFlags::DialogButton button) const {
78 if (button == MessageBoxFlags::DIALOGBUTTON_OK) { 78 if (button == ui::MessageBoxFlags::DIALOGBUTTON_OK) {
79 return confirm_label_; 79 return confirm_label_;
80 } 80 }
81 if (button == MessageBoxFlags::DIALOGBUTTON_CANCEL) 81 if (button == ui::MessageBoxFlags::DIALOGBUTTON_CANCEL)
82 return reject_label_; 82 return reject_label_;
83 return DialogDelegate::GetDialogButtonLabel(button); 83 return DialogDelegate::GetDialogButtonLabel(button);
84 } 84 }
85 85
86 bool ConfirmMessageBoxDialog::Accept() { 86 bool ConfirmMessageBoxDialog::Accept() {
87 observer_->OnConfirmMessageAccept(); 87 observer_->OnConfirmMessageAccept();
88 return true; // Dialog may now be closed. 88 return true; // Dialog may now be closed.
89 } 89 }
90 90
91 bool ConfirmMessageBoxDialog::Cancel() { 91 bool ConfirmMessageBoxDialog::Cancel() {
92 observer_->OnConfirmMessageCancel(); 92 observer_->OnConfirmMessageCancel();
93 return true; // Dialog may now be closed. 93 return true; // Dialog may now be closed.
94 } 94 }
95 95
96 void ConfirmMessageBoxDialog::Layout() { 96 void ConfirmMessageBoxDialog::Layout() {
97 gfx::Size sz = message_label_->GetPreferredSize(); 97 gfx::Size sz = message_label_->GetPreferredSize();
98 message_label_->SetBounds(kPanelHorizMargin, kPanelVertMargin, 98 message_label_->SetBounds(kPanelHorizMargin, kPanelVertMargin,
99 width() - 2 * kPanelHorizMargin, 99 width() - 2 * kPanelHorizMargin,
100 sz.height()); 100 sz.height());
101 } 101 }
102 102
103 gfx::Size ConfirmMessageBoxDialog::GetPreferredSize() { 103 gfx::Size ConfirmMessageBoxDialog::GetPreferredSize() {
104 return preferred_size_; 104 return preferred_size_;
105 } 105 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/bookmark_bar_view.cc ('k') | chrome/browser/ui/views/default_search_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698