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

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

Issue 8438037: Change 'Add Page' to show a simple input dialog with --use-more-webui. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix build break Created 9 years, 1 month 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
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/input_window_dialog.h" 5 #include "chrome/browser/ui/input_window_dialog.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/task.h" 9 #include "base/task.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 string16 ContentView::GetDialogButtonLabel(ui::DialogButton button) const { 126 string16 ContentView::GetDialogButtonLabel(ui::DialogButton button) const {
127 if (button == ui::DIALOG_BUTTON_OK) { 127 if (button == ui::DIALOG_BUTTON_OK) {
128 return l10n_util::GetStringUTF16( 128 return l10n_util::GetStringUTF16(
129 delegate_->type() == InputWindowDialog::BUTTON_TYPE_ADD ? IDS_ADD 129 delegate_->type() == InputWindowDialog::BUTTON_TYPE_ADD ? IDS_ADD
130 : IDS_SAVE); 130 : IDS_SAVE);
131 } 131 }
132 return string16(); 132 return string16();
133 } 133 }
134 134
135 bool ContentView::IsDialogButtonEnabled(ui::DialogButton button) const { 135 bool ContentView::IsDialogButtonEnabled(ui::DialogButton button) const {
136 if (button == ui::DIALOG_BUTTON_OK && 136 if (button == ui::DIALOG_BUTTON_OK) {
137 !delegate_->delegate()->IsValid(text_field_->text())) { 137 InputWindowDialog::InputTexts texts;
138 return false; 138 texts.push_back(text_field_->text());
139 if (!delegate_->delegate()->IsValid(texts)) {
140 return false;
141 }
139 } 142 }
140 return true; 143 return true;
141 } 144 }
142 145
143 bool ContentView::Accept() { 146 bool ContentView::Accept() {
144 delegate_->delegate()->InputAccepted(text_field_->text()); 147 InputWindowDialog::InputTexts texts;
148 texts.push_back(text_field_->text());
149 delegate_->delegate()->InputAccepted(texts);
145 return true; 150 return true;
146 } 151 }
147 152
148 bool ContentView::Cancel() { 153 bool ContentView::Cancel() {
149 delegate_->delegate()->InputCanceled(); 154 delegate_->delegate()->InputCanceled();
150 return true; 155 return true;
151 } 156 }
152 157
153 void ContentView::DeleteDelegate() { 158 void ContentView::DeleteDelegate() {
154 delete delegate_; 159 delete delegate_;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 249
245 void InputWindowDialogWin::Show() { 250 void InputWindowDialogWin::Show() {
246 window_->Show(); 251 window_->Show();
247 } 252 }
248 253
249 void InputWindowDialogWin::Close() { 254 void InputWindowDialogWin::Close() {
250 window_->Close(); 255 window_->Close();
251 } 256 }
252 257
253 // static 258 // static
254 InputWindowDialog* InputWindowDialog::Create(gfx::NativeWindow parent, 259 InputWindowDialog* InputWindowDialog::Create(
255 const string16& window_title, 260 gfx::NativeWindow parent,
256 const string16& label, 261 const string16& window_title,
257 const string16& contents, 262 const LabelContentsPairs& label_contents_pairs,
258 Delegate* delegate, 263 Delegate* delegate,
259 ButtonType type) { 264 ButtonType type) {
260 return new InputWindowDialogWin(parent, window_title, label, contents, 265 DCHECK_EQ(1U, label_contents_pairs.size());
flackr 2011/11/07 15:19:15 Can you use InputWindowDialogWebUI here too on --u
mazda 2011/11/08 11:24:24 Done.
261 delegate, type); 266 return new InputWindowDialogWin(parent,
267 window_title,
268 label_contents_pairs[0].first,
269 label_contents_pairs[0].second,
270 delegate,
271 type);
262 } 272 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698