Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: chrome/browser/ui/views/webshare/webshare_target_picker_view.cc

Issue 2758323002: Broke out layout metric information from ViewsDelegate to LayoutProvider (Closed)
Patch Set: Final feedback addressed Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/layout_delegate.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"
11 #include "ui/base/l10n/l10n_util.h" 11 #include "ui/base/l10n/l10n_util.h"
12 #include "ui/base/models/table_model.h" 12 #include "ui/base/models/table_model.h"
13 #include "ui/gfx/native_widget_types.h" 13 #include "ui/gfx/native_widget_types.h"
14 #include "ui/views/controls/label.h" 14 #include "ui/views/controls/label.h"
15 #include "ui/views/controls/table/table_view.h" 15 #include "ui/views/controls/table/table_view.h"
16 #include "ui/views/layout/box_layout.h" 16 #include "ui/views/layout/box_layout.h"
17 #include "ui/views/layout/layout_constants.h" 17 #include "ui/views/layout/layout_constants.h"
18 #include "ui/views/window/dialog_client_view.h" 18 #include "ui/views/window/dialog_client_view.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 const base::Callback<void(base::Optional<std::string>)>& close_callback) 79 const base::Callback<void(base::Optional<std::string>)>& 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_(close_callback) { 82 close_callback_(close_callback) {
83 const int panel_margin = LayoutDelegate::Get()->GetMetric( 83 const int panel_margin = ChromeLayoutProvider::Get()->GetDistanceMetric(
84 LayoutDelegate::Metric::PANEL_CONTENT_MARGIN); 84 DISTANCE_PANEL_CONTENT_MARGIN);
85 views::BoxLayout* layout = 85 views::BoxLayout* layout =
86 new views::BoxLayout(views::BoxLayout::kVertical, panel_margin, 86 new views::BoxLayout(views::BoxLayout::kVertical, panel_margin,
87 panel_margin, views::kRelatedControlVerticalSpacing); 87 panel_margin, views::kRelatedControlVerticalSpacing);
88 SetLayoutManager(layout); 88 SetLayoutManager(layout);
89 89
90 views::Label* overview_label = new views::Label( 90 views::Label* overview_label = new views::Label(
91 l10n_util::GetStringUTF16(IDS_WEBSHARE_TARGET_PICKER_LABEL)); 91 l10n_util::GetStringUTF16(IDS_WEBSHARE_TARGET_PICKER_LABEL));
92 AddChildView(overview_label); 92 AddChildView(overview_label);
93 93
94 std::vector<ui::TableColumn> table_columns{ui::TableColumn()}; 94 std::vector<ui::TableColumn> table_columns{ui::TableColumn()};
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 return true; 160 return true;
161 } 161 }
162 162
163 void WebShareTargetPickerView::OnSelectionChanged() { 163 void WebShareTargetPickerView::OnSelectionChanged() {
164 GetDialogClientView()->UpdateDialogButtons(); 164 GetDialogClientView()->UpdateDialogButtons();
165 } 165 }
166 166
167 void WebShareTargetPickerView::OnDoubleClick() { 167 void WebShareTargetPickerView::OnDoubleClick() {
168 GetDialogClientView()->AcceptWindow(); 168 GetDialogClientView()->AcceptWindow();
169 } 169 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698