| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "chrome/browser/ui/views/webshare/webshare_target_picker_view.h" | 5 #include "chrome/browser/ui/views/webshare/webshare_target_picker_view.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" | 8 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" |
| 9 #include "chrome/grit/generated_resources.h" | 9 #include "chrome/grit/generated_resources.h" |
| 10 #include "components/constrained_window/constrained_window_views.h" | 10 #include "components/constrained_window/constrained_window_views.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 } | 73 } |
| 74 | 74 |
| 75 } // namespace chrome | 75 } // namespace chrome |
| 76 | 76 |
| 77 WebShareTargetPickerView::WebShareTargetPickerView( | 77 WebShareTargetPickerView::WebShareTargetPickerView( |
| 78 const std::vector<std::pair<base::string16, GURL>>& targets, | 78 const std::vector<std::pair<base::string16, GURL>>& targets, |
| 79 chrome::WebShareTargetPickerCallback close_callback) | 79 chrome::WebShareTargetPickerCallback close_callback) |
| 80 : targets_(targets), | 80 : targets_(targets), |
| 81 table_model_(base::MakeUnique<TargetPickerTableModel>(&targets_)), | 81 table_model_(base::MakeUnique<TargetPickerTableModel>(&targets_)), |
| 82 close_callback_(std::move(close_callback)) { | 82 close_callback_(std::move(close_callback)) { |
| 83 const int panel_margin = ChromeLayoutProvider::Get()->GetDistanceMetric( | 83 const ChromeLayoutProvider* provider = ChromeLayoutProvider::Get(); |
| 84 DISTANCE_PANEL_CONTENT_MARGIN); | 84 views::BoxLayout* layout = new views::BoxLayout( |
| 85 views::BoxLayout* layout = | 85 views::BoxLayout::kVertical, |
| 86 new views::BoxLayout(views::BoxLayout::kVertical, panel_margin, | 86 provider->GetDistanceMetric( |
| 87 panel_margin, views::kRelatedControlVerticalSpacing); | 87 views::DISTANCE_BUBBLE_CONTENTS_HORIZONTAL_MARGIN), |
| 88 provider->GetDistanceMetric( |
| 89 views::DISTANCE_BUBBLE_CONTENTS_VERTICAL_MARGIN), |
| 90 provider->GetDistanceMetric(views::DISTANCE_RELATED_CONTROL_VERTICAL)); |
| 88 SetLayoutManager(layout); | 91 SetLayoutManager(layout); |
| 89 | 92 |
| 90 views::Label* overview_label = new views::Label( | 93 views::Label* overview_label = new views::Label( |
| 91 l10n_util::GetStringUTF16(IDS_WEBSHARE_TARGET_PICKER_LABEL)); | 94 l10n_util::GetStringUTF16(IDS_WEBSHARE_TARGET_PICKER_LABEL)); |
| 92 AddChildView(overview_label); | 95 AddChildView(overview_label); |
| 93 | 96 |
| 94 std::vector<ui::TableColumn> table_columns{ui::TableColumn()}; | 97 std::vector<ui::TableColumn> table_columns{ui::TableColumn()}; |
| 95 table_ = new views::TableView(table_model_.get(), table_columns, | 98 table_ = new views::TableView(table_model_.get(), table_columns, |
| 96 views::TEXT_ONLY, true); | 99 views::TEXT_ONLY, true); |
| 97 // Select the first row. | 100 // Select the first row. |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 return true; | 164 return true; |
| 162 } | 165 } |
| 163 | 166 |
| 164 void WebShareTargetPickerView::OnSelectionChanged() { | 167 void WebShareTargetPickerView::OnSelectionChanged() { |
| 165 GetDialogClientView()->UpdateDialogButtons(); | 168 GetDialogClientView()->UpdateDialogButtons(); |
| 166 } | 169 } |
| 167 | 170 |
| 168 void WebShareTargetPickerView::OnDoubleClick() { | 171 void WebShareTargetPickerView::OnDoubleClick() { |
| 169 GetDialogClientView()->AcceptWindow(); | 172 GetDialogClientView()->AcceptWindow(); |
| 170 } | 173 } |
| OLD | NEW |