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

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

Issue 2700083002: Views/Harmony: Use LayoutDelegate::GetMetric() for views::kPanelHorizMargin. (Closed)
Patch Set: Review comments. 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
« no previous file with comments | « chrome/browser/ui/views/extensions/media_gallery_checkbox_view.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/grit/generated_resources.h" 9 #include "chrome/grit/generated_resources.h"
9 #include "components/constrained_window/constrained_window_views.h" 10 #include "components/constrained_window/constrained_window_views.h"
10 #include "ui/base/l10n/l10n_util.h" 11 #include "ui/base/l10n/l10n_util.h"
11 #include "ui/base/models/table_model.h" 12 #include "ui/base/models/table_model.h"
12 #include "ui/gfx/native_widget_types.h" 13 #include "ui/gfx/native_widget_types.h"
13 #include "ui/views/controls/label.h" 14 #include "ui/views/controls/label.h"
14 #include "ui/views/controls/table/table_view.h" 15 #include "ui/views/controls/table/table_view.h"
15 #include "ui/views/layout/box_layout.h" 16 #include "ui/views/layout/box_layout.h"
16 #include "ui/views/layout/layout_constants.h" 17 #include "ui/views/layout/layout_constants.h"
17 #include "ui/views/window/dialog_client_view.h" 18 #include "ui/views/window/dialog_client_view.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 74
74 } // namespace chrome 75 } // namespace chrome
75 76
76 WebShareTargetPickerView::WebShareTargetPickerView( 77 WebShareTargetPickerView::WebShareTargetPickerView(
77 const std::vector<std::pair<base::string16, GURL>>& targets, 78 const std::vector<std::pair<base::string16, GURL>>& targets,
78 const base::Callback<void(base::Optional<std::string>)>& close_callback) 79 const base::Callback<void(base::Optional<std::string>)>& close_callback)
79 : targets_(targets), 80 : targets_(targets),
80 table_model_(base::MakeUnique<TargetPickerTableModel>(&targets_)), 81 table_model_(base::MakeUnique<TargetPickerTableModel>(&targets_)),
81 close_callback_(close_callback) { 82 close_callback_(close_callback) {
82 views::BoxLayout* layout = new views::BoxLayout( 83 views::BoxLayout* layout = new views::BoxLayout(
83 views::BoxLayout::kVertical, views::kPanelHorizMargin, 84 views::BoxLayout::kVertical,
85 LayoutDelegate::Get()->GetMetric(
86 LayoutDelegate::Metric::PANEL_CONTENT_MARGIN),
84 views::kPanelVertMargin, views::kRelatedControlVerticalSpacing); 87 views::kPanelVertMargin, views::kRelatedControlVerticalSpacing);
85 SetLayoutManager(layout); 88 SetLayoutManager(layout);
86 89
87 views::Label* overview_label = new views::Label( 90 views::Label* overview_label = new views::Label(
88 l10n_util::GetStringUTF16(IDS_WEBSHARE_TARGET_PICKER_LABEL)); 91 l10n_util::GetStringUTF16(IDS_WEBSHARE_TARGET_PICKER_LABEL));
89 AddChildView(overview_label); 92 AddChildView(overview_label);
90 93
91 std::vector<ui::TableColumn> table_columns{ui::TableColumn()}; 94 std::vector<ui::TableColumn> table_columns{ui::TableColumn()};
92 table_ = new views::TableView(table_model_.get(), table_columns, 95 table_ = new views::TableView(table_model_.get(), table_columns,
93 views::TEXT_ONLY, true); 96 views::TEXT_ONLY, true);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 return true; 160 return true;
158 } 161 }
159 162
160 void WebShareTargetPickerView::OnSelectionChanged() { 163 void WebShareTargetPickerView::OnSelectionChanged() {
161 GetDialogClientView()->UpdateDialogButtons(); 164 GetDialogClientView()->UpdateDialogButtons();
162 } 165 }
163 166
164 void WebShareTargetPickerView::OnDoubleClick() { 167 void WebShareTargetPickerView::OnDoubleClick() {
165 GetDialogClientView()->AcceptWindow(); 168 GetDialogClientView()->AcceptWindow();
166 } 169 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/extensions/media_gallery_checkbox_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698