Chromium Code Reviews| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 70 | 70 |
| 71 DISALLOW_COPY_AND_ASSIGN(ButtonRowContainer); | 71 DISALLOW_COPY_AND_ASSIGN(ButtonRowContainer); |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 /////////////////////////////////////////////////////////////////////////////// | 74 /////////////////////////////////////////////////////////////////////////////// |
| 75 // DialogClientView, public: | 75 // DialogClientView, public: |
| 76 | 76 |
| 77 DialogClientView::DialogClientView(Widget* owner, View* contents_view) | 77 DialogClientView::DialogClientView(Widget* owner, View* contents_view) |
| 78 : ClientView(owner, contents_view), | 78 : ClientView(owner, contents_view), |
| 79 button_row_insets_( | 79 button_row_insets_( |
| 80 LayoutProvider::Get()->GetInsetsMetric(INSETS_DIALOG_BUTTON)) { | 80 LayoutProvider::Get()->GetInsetsMetric(INSETS_DIALOG_BUTTON_ROW)) { |
| 81 // Doing this now ensures this accelerator will have lower priority than | 81 // Doing this now ensures this accelerator will have lower priority than |
| 82 // one set by the contents view. | 82 // one set by the contents view. |
| 83 AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE)); | 83 AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE)); |
| 84 button_row_container_ = new ButtonRowContainer(this); | 84 button_row_container_ = new ButtonRowContainer(this); |
| 85 AddChildView(button_row_container_); | 85 AddChildView(button_row_container_); |
| 86 } | 86 } |
| 87 | 87 |
| 88 DialogClientView::~DialogClientView() {} | 88 DialogClientView::~DialogClientView() {} |
| 89 | 89 |
| 90 void DialogClientView::AcceptWindow() { | 90 void DialogClientView::AcceptWindow() { |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 334 if (extra_view_ && !views[0]) | 334 if (extra_view_ && !views[0]) |
| 335 AddChildView(extra_view_); | 335 AddChildView(extra_view_); |
| 336 | 336 |
| 337 if (std::count(views.begin(), views.end(), nullptr) == kNumButtons) | 337 if (std::count(views.begin(), views.end(), nullptr) == kNumButtons) |
| 338 return; | 338 return; |
| 339 | 339 |
| 340 gfx::Insets insets = button_row_insets_; | 340 gfx::Insets insets = button_row_insets_; |
| 341 LayoutProvider* const layout_provider = LayoutProvider::Get(); | 341 LayoutProvider* const layout_provider = LayoutProvider::Get(); |
| 342 // Support dialogs that clear |button_row_insets_| to do their own layout. | 342 // Support dialogs that clear |button_row_insets_| to do their own layout. |
| 343 // They expect GetDialogRelatedControlVerticalSpacing() in this case. | 343 // They expect GetDialogRelatedControlVerticalSpacing() in this case. |
| 344 // TODO(tapted): Remove this under Harmony. | 344 // TODO(tapted): Remove this under Harmony. |
|
Peter Kasting
2017/05/18 00:00:07
Nit: Remove TODO?
Bret
2017/05/18 00:50:06
Done.
| |
| 345 if (insets.top() == 0) { | 345 if (insets.top() == 0 && |
| 346 !ui::MaterialDesignController::IsSecondaryUiMaterial()) { | |
| 346 const int top = | 347 const int top = |
| 347 layout_provider->GetDistanceMetric(DISTANCE_RELATED_CONTROL_VERTICAL); | 348 layout_provider->GetDistanceMetric(DISTANCE_RELATED_CONTROL_VERTICAL); |
| 348 insets.Set(top, insets.left(), insets.bottom(), insets.right()); | 349 insets.Set(top, insets.left(), insets.bottom(), insets.right()); |
| 349 } | 350 } |
| 350 | 351 |
| 351 // The |resize_percent| constants. There's only one stretchy column (padding | 352 // The |resize_percent| constants. There's only one stretchy column (padding |
| 352 // to the left of ok/cancel buttons). | 353 // to the left of ok/cancel buttons). |
| 353 constexpr float kFixed = 0.f; | 354 constexpr float kFixed = 0.f; |
| 354 constexpr float kStretchy = 1.f; | 355 constexpr float kStretchy = 1.f; |
| 355 | 356 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 421 | 422 |
| 422 if (extra_view_) | 423 if (extra_view_) |
| 423 return; | 424 return; |
| 424 | 425 |
| 425 extra_view_ = GetDialogDelegate()->CreateExtraView(); | 426 extra_view_ = GetDialogDelegate()->CreateExtraView(); |
| 426 if (extra_view_) | 427 if (extra_view_) |
| 427 extra_view_->SetGroup(kButtonGroup); | 428 extra_view_->SetGroup(kButtonGroup); |
| 428 } | 429 } |
| 429 | 430 |
| 430 } // namespace views | 431 } // namespace views |
| OLD | NEW |