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 "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/base/material_design/material_design_controller.h" |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 void DialogClientView::ChildVisibilityChanged(View* child) { | 307 void DialogClientView::ChildVisibilityChanged(View* child) { |
308 ChildPreferredSizeChanged(child); | 308 ChildPreferredSizeChanged(child); |
309 } | 309 } |
310 | 310 |
311 //////////////////////////////////////////////////////////////////////////////// | 311 //////////////////////////////////////////////////////////////////////////////// |
312 // DialogClientView, private: | 312 // DialogClientView, private: |
313 | 313 |
314 LabelButton* DialogClientView::CreateDialogButton(ui::DialogButton type) { | 314 LabelButton* DialogClientView::CreateDialogButton(ui::DialogButton type) { |
315 const base::string16 title = GetDialogDelegate()->GetDialogButtonLabel(type); | 315 const base::string16 title = GetDialogDelegate()->GetDialogButtonLabel(type); |
316 LabelButton* button = nullptr; | 316 LabelButton* button = nullptr; |
| 317 // The default button is always blue in Harmony. |
317 if (GetDialogDelegate()->GetDefaultDialogButton() == type && | 318 if (GetDialogDelegate()->GetDefaultDialogButton() == type && |
318 GetDialogDelegate()->ShouldDefaultButtonBeBlue()) { | 319 (ui::MaterialDesignController::IsSecondaryUiMaterial() || |
319 return MdTextButton::CreateSecondaryUiBlueButton(this, title); | 320 GetDialogDelegate()->ShouldDefaultButtonBeBlue())) { |
| 321 button = MdTextButton::CreateSecondaryUiBlueButton(this, title); |
320 } else { | 322 } else { |
321 button = MdTextButton::CreateSecondaryUiButton(this, title); | 323 button = MdTextButton::CreateSecondaryUiButton(this, title); |
322 } | 324 } |
323 | 325 |
324 const int kDialogMinButtonWidth = 75; | 326 const int kDialogMinButtonWidth = 75; |
325 button->SetMinSize(gfx::Size(kDialogMinButtonWidth, 0)); | 327 button->SetMinSize(gfx::Size(kDialogMinButtonWidth, 0)); |
326 button->SetGroup(kButtonGroup); | 328 button->SetGroup(kButtonGroup); |
327 return button; | 329 return button; |
328 } | 330 } |
329 | 331 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 std::remove(child_views.begin(), child_views.end(), nullptr), | 366 std::remove(child_views.begin(), child_views.end(), nullptr), |
365 child_views.end()); | 367 child_views.end()); |
366 | 368 |
367 // Setup focus by reordering views. It is not safe to use SetNextFocusableView | 369 // Setup focus by reordering views. It is not safe to use SetNextFocusableView |
368 // since child views may be added externally to this view. | 370 // since child views may be added externally to this view. |
369 for (size_t i = 0; i < child_views.size(); i++) | 371 for (size_t i = 0; i < child_views.size(); i++) |
370 ReorderChildView(child_views[i], i); | 372 ReorderChildView(child_views[i], i); |
371 } | 373 } |
372 | 374 |
373 } // namespace views | 375 } // namespace views |
OLD | NEW |