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

Side by Side Diff: ui/views/window/dialog_client_view.cc

Issue 12304038: Restore 'Chrome Style' buttons for --enable-new-dialog-style dialogs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ui/views/window/dialog_client_view.h" 5 #include "ui/views/window/dialog_client_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ui/base/keycodes/keyboard_codes.h" 9 #include "ui/base/keycodes/keyboard_codes.h"
10 #include "ui/views/controls/button/chrome_style.h"
10 #include "ui/views/controls/button/text_button.h" 11 #include "ui/views/controls/button/text_button.h"
11 #include "ui/views/layout/layout_constants.h" 12 #include "ui/views/layout/layout_constants.h"
12 #include "ui/views/widget/widget.h" 13 #include "ui/views/widget/widget.h"
13 #include "ui/views/window/dialog_delegate.h" 14 #include "ui/views/window/dialog_delegate.h"
14 15
15 namespace views { 16 namespace views {
16 17
17 namespace { 18 namespace {
18 19
19 // The group used by the buttons. This name is chosen voluntarily big not to 20 // The group used by the buttons. This name is chosen voluntarily big not to
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 UpdateDialogButtons(); 283 UpdateDialogButtons();
283 284
284 // Use the escape key to close the window if there are no dialog buttons. 285 // Use the escape key to close the window if there are no dialog buttons.
285 if (!has_dialog_buttons()) 286 if (!has_dialog_buttons())
286 AddAccelerator(escape); 287 AddAccelerator(escape);
287 } 288 }
288 289
289 TextButton* DialogClientView::CreateDialogButton(ui::DialogButton type) { 290 TextButton* DialogClientView::CreateDialogButton(ui::DialogButton type) {
290 const string16 title = GetDialogDelegate()->GetDialogButtonLabel(type); 291 const string16 title = GetDialogDelegate()->GetDialogButtonLabel(type);
291 TextButton* button = NULL; 292 TextButton* button = NULL;
292 if (DialogDelegate::UseNewStyle()) 293 if (DialogDelegate::UseNewStyle()) {
293 button = new TextButton(this, title); 294 button = new TextButton(this, title);
294 else 295 ApplyChromeStyle(button);
296 } else {
295 button = new NativeTextButton(this, title); 297 button = new NativeTextButton(this, title);
298 }
296 const int kDialogMinButtonWidth = 75; 299 const int kDialogMinButtonWidth = 75;
297 button->set_min_width(kDialogMinButtonWidth); 300 button->set_min_width(kDialogMinButtonWidth);
298 button->SetGroup(kButtonGroup); 301 button->SetGroup(kButtonGroup);
299 if (type == GetDialogDelegate()->GetDefaultDialogButton()) { 302 if (type == GetDialogDelegate()->GetDefaultDialogButton()) {
300 default_button_ = button; 303 default_button_ = button;
301 button->SetIsDefault(true); 304 button->SetIsDefault(true);
302 } 305 }
303 return button; 306 return button;
304 } 307 }
305 308
(...skipping 26 matching lines...) Expand all
332 DialogDelegate* DialogClientView::GetDialogDelegate() const { 335 DialogDelegate* DialogClientView::GetDialogDelegate() const {
333 return GetWidget()->widget_delegate()->AsDialogDelegate(); 336 return GetWidget()->widget_delegate()->AsDialogDelegate();
334 } 337 }
335 338
336 void DialogClientView::Close() { 339 void DialogClientView::Close() {
337 GetWidget()->Close(); 340 GetWidget()->Close();
338 GetDialogDelegate()->OnClose(); 341 GetDialogDelegate()->OnClose();
339 } 342 }
340 343
341 } // namespace views 344 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698