| 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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 PlatformStyle::kDialogDefaultButtonCanBeCancel); | 334 PlatformStyle::kDialogDefaultButtonCanBeCancel); |
| 335 | 335 |
| 336 // The default button is always blue in Harmony. | 336 // The default button is always blue in Harmony. |
| 337 if (is_default && (ui::MaterialDesignController::IsSecondaryUiMaterial() || | 337 if (is_default && (ui::MaterialDesignController::IsSecondaryUiMaterial() || |
| 338 GetDialogDelegate()->ShouldDefaultButtonBeBlue())) { | 338 GetDialogDelegate()->ShouldDefaultButtonBeBlue())) { |
| 339 button = MdTextButton::CreateSecondaryUiBlueButton(this, title); | 339 button = MdTextButton::CreateSecondaryUiBlueButton(this, title); |
| 340 } else { | 340 } else { |
| 341 button = MdTextButton::CreateSecondaryUiButton(this, title); | 341 button = MdTextButton::CreateSecondaryUiButton(this, title); |
| 342 } | 342 } |
| 343 | 343 |
| 344 // TODO(bsep): Setting the minimum size is redundant with MdTextButton, so | |
| 345 // this can be deleted when harmony is always on. | |
| 346 const int minimum_width = | 344 const int minimum_width = |
| 347 ViewsDelegate::GetInstance()->GetDialogButtonMinimumWidth(); | 345 ViewsDelegate::GetInstance()->GetDialogButtonMinimumWidth(); |
| 348 button->SetMinSize(gfx::Size(minimum_width, 0)); | 346 button->SetMinSize(gfx::Size(minimum_width, 0)); |
| 349 | 347 |
| 350 button->SetGroup(kButtonGroup); | 348 button->SetGroup(kButtonGroup); |
| 351 return button; | 349 return button; |
| 352 } | 350 } |
| 353 | 351 |
| 354 int DialogClientView::GetButtonHeight() const { | 352 int DialogClientView::GetButtonHeight() const { |
| 355 return std::max( | 353 return std::max( |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 std::remove(child_views.begin(), child_views.end(), nullptr), | 398 std::remove(child_views.begin(), child_views.end(), nullptr), |
| 401 child_views.end()); | 399 child_views.end()); |
| 402 | 400 |
| 403 // Setup focus by reordering views. It is not safe to use SetNextFocusableView | 401 // Setup focus by reordering views. It is not safe to use SetNextFocusableView |
| 404 // since child views may be added externally to this view. | 402 // since child views may be added externally to this view. |
| 405 for (size_t i = 0; i < child_views.size(); i++) | 403 for (size_t i = 0; i < child_views.size(); i++) |
| 406 ReorderChildView(child_views[i], i); | 404 ReorderChildView(child_views[i], i); |
| 407 } | 405 } |
| 408 | 406 |
| 409 } // namespace views | 407 } // namespace views |
| OLD | NEW |