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