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

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

Issue 1926943002: Introduce new flag to control usage of MD in secondary (not top-chrome) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: improve docs Created 4 years, 7 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
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 "build/build_config.h" 9 #include "build/build_config.h"
10 #include "ui/base/material_design/material_design_controller.h"
10 #include "ui/events/keycodes/keyboard_codes.h" 11 #include "ui/events/keycodes/keyboard_codes.h"
11 #include "ui/views/background.h" 12 #include "ui/views/background.h"
12 #include "ui/views/controls/button/blue_button.h" 13 #include "ui/views/controls/button/blue_button.h"
13 #include "ui/views/controls/button/label_button.h" 14 #include "ui/views/controls/button/label_button.h"
15 #include "ui/views/controls/button/md_text_button.h"
14 #include "ui/views/layout/layout_constants.h" 16 #include "ui/views/layout/layout_constants.h"
15 #include "ui/views/widget/widget.h" 17 #include "ui/views/widget/widget.h"
16 #include "ui/views/window/dialog_delegate.h" 18 #include "ui/views/window/dialog_delegate.h"
17 19
18 namespace views { 20 namespace views {
19 21
20 namespace { 22 namespace {
21 23
22 // The group used by the buttons. This name is chosen voluntarily big not to 24 // The group used by the buttons. This name is chosen voluntarily big not to
23 // conflict with other groups that could be in the dialog content. 25 // conflict with other groups that could be in the dialog content.
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 303
302 //////////////////////////////////////////////////////////////////////////////// 304 ////////////////////////////////////////////////////////////////////////////////
303 // DialogClientView, private: 305 // DialogClientView, private:
304 306
305 LabelButton* DialogClientView::CreateDialogButton(ui::DialogButton type) { 307 LabelButton* DialogClientView::CreateDialogButton(ui::DialogButton type) {
306 const base::string16 title = GetDialogDelegate()->GetDialogButtonLabel(type); 308 const base::string16 title = GetDialogDelegate()->GetDialogButtonLabel(type);
307 LabelButton* button = NULL; 309 LabelButton* button = NULL;
308 if (GetDialogDelegate()->UseNewStyleForThisDialog() && 310 if (GetDialogDelegate()->UseNewStyleForThisDialog() &&
309 GetDialogDelegate()->GetDefaultDialogButton() == type && 311 GetDialogDelegate()->GetDefaultDialogButton() == type &&
310 GetDialogDelegate()->ShouldDefaultButtonBeBlue()) { 312 GetDialogDelegate()->ShouldDefaultButtonBeBlue()) {
311 button = new BlueButton(this, title); 313 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) {
314 MdTextButton* md_button = MdTextButton::CreateMdButton(this, title);
315 md_button->SetCallToAction(MdTextButton::STRONG_CALL_TO_ACTION);
316 button = md_button;
317 } else {
318 button = new BlueButton(this, title);
319 }
312 } else { 320 } else {
313 button = new LabelButton(this, title); 321 button = MdTextButton::CreateSecondaryUiButton(this, title);
314 button->SetStyle(Button::STYLE_BUTTON);
315 } 322 }
316 button->SetFocusBehavior(FocusBehavior::ALWAYS); 323 button->SetFocusBehavior(FocusBehavior::ALWAYS);
317 324
318 const int kDialogMinButtonWidth = 75; 325 const int kDialogMinButtonWidth = 75;
319 button->SetMinSize(gfx::Size(kDialogMinButtonWidth, 0)); 326 button->SetMinSize(gfx::Size(kDialogMinButtonWidth, 0));
320 button->SetGroup(kButtonGroup); 327 button->SetGroup(kButtonGroup);
321 return button; 328 return button;
322 } 329 }
323 330
324 int DialogClientView::GetButtonsAndExtraViewRowHeight() const { 331 int DialogClientView::GetButtonsAndExtraViewRowHeight() const {
(...skipping 28 matching lines...) Expand all
353 std::remove(child_views.begin(), child_views.end(), nullptr), 360 std::remove(child_views.begin(), child_views.end(), nullptr),
354 child_views.end()); 361 child_views.end());
355 362
356 // Setup focus by reordering views. It is not safe to use SetNextFocusableView 363 // Setup focus by reordering views. It is not safe to use SetNextFocusableView
357 // since child views may be added externally to this view. 364 // since child views may be added externally to this view.
358 for (size_t i = 0; i < child_views.size(); i++) 365 for (size_t i = 0; i < child_views.size(); i++)
359 ReorderChildView(child_views[i], i); 366 ReorderChildView(child_views[i], i);
360 } 367 }
361 368
362 } // namespace views 369 } // namespace views
OLDNEW
« ui/views/controls/button/label_button.h ('K') | « ui/views/controls/button/md_text_button.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698