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

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

Issue 2713803002: Views/Harmony: Use LayoutDelegate::GetMetric for views::kPanelVertMargin. (Closed)
Patch Set: Fix many crashes. Created 3 years, 10 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/layout_delegate.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
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 views::BoxLayout* layout = new views::BoxLayout( 83 const int panel_margin = LayoutDelegate::Get()->GetMetric(
84 views::BoxLayout::kVertical, 84 LayoutDelegate::Metric::PANEL_CONTENT_MARGIN);
85 LayoutDelegate::Get()->GetMetric( 85 views::BoxLayout* layout =
86 LayoutDelegate::Metric::PANEL_CONTENT_MARGIN), 86 new views::BoxLayout(views::BoxLayout::kVertical, panel_margin,
87 views::kPanelVertMargin, views::kRelatedControlVerticalSpacing); 87 panel_margin, views::kRelatedControlVerticalSpacing);
tapted 2017/02/27 03:24:51 Could we have a BoxLayout* LayoutDelegate::Creat
Peter Kasting 2017/02/28 02:21:39 https://bugs.chromium.org/p/chromium/issues/detail
Patti Lor 2017/03/03 08:24:39 Did a quick grep for places creating new BoxLayout
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()};
95 table_ = new views::TableView(table_model_.get(), table_columns, 95 table_ = new views::TableView(table_model_.get(), table_columns,
96 views::TEXT_ONLY, true); 96 views::TEXT_ONLY, true);
97 // Select the first row. 97 // Select the first row.
(...skipping 62 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