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

Side by Side Diff: chrome/browser/ui/views/device_chooser_content_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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/device_chooser_content_view.h" 5 #include "chrome/browser/ui/views/device_chooser_content_view.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/numerics/safe_conversions.h" 8 #include "base/numerics/safe_conversions.h"
9 #include "chrome/app/vector_icons/vector_icons.h" 9 #include "chrome/app/vector_icons/vector_icons.h"
10 #include "chrome/browser/ui/views/harmony/layout_delegate.h" 10 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h"
11 #include "chrome/grit/generated_resources.h" 11 #include "chrome/grit/generated_resources.h"
12 #include "ui/base/l10n/l10n_util.h" 12 #include "ui/base/l10n/l10n_util.h"
13 #include "ui/base/resource/resource_bundle.h" 13 #include "ui/base/resource/resource_bundle.h"
14 #include "ui/gfx/color_palette.h" 14 #include "ui/gfx/color_palette.h"
15 #include "ui/gfx/geometry/point.h" 15 #include "ui/gfx/geometry/point.h"
16 #include "ui/gfx/geometry/rect.h" 16 #include "ui/gfx/geometry/rect.h"
17 #include "ui/gfx/image/image_skia.h" 17 #include "ui/gfx/image/image_skia.h"
18 #include "ui/gfx/paint_vector_icon.h" 18 #include "ui/gfx/paint_vector_icon.h"
19 #include "ui/resources/grit/ui_resources.h" 19 #include "ui/resources/grit/ui_resources.h"
20 #include "ui/views/controls/styled_label.h" 20 #include "ui/views/controls/styled_label.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 gfx::Point((rect.width() - turn_adapter_off_help_->width()) / 2, 107 gfx::Point((rect.width() - turn_adapter_off_help_->width()) / 2,
108 (rect.height() - turn_adapter_off_help_->height()) / 2)); 108 (rect.height() - turn_adapter_off_help_->height()) / 2));
109 turn_adapter_off_help_->SizeToFit(rect.width() - 109 turn_adapter_off_help_->SizeToFit(rect.width() -
110 2 * kAdapterOffHelpLinkPadding); 110 2 * kAdapterOffHelpLinkPadding);
111 views::View::Layout(); 111 views::View::Layout();
112 } 112 }
113 113
114 gfx::Size DeviceChooserContentView::GetPreferredSize() const { 114 gfx::Size DeviceChooserContentView::GetPreferredSize() const {
115 constexpr int kHeight = 320; 115 constexpr int kHeight = 320;
116 constexpr int kDefaultWidth = 402; 116 constexpr int kDefaultWidth = 402;
117 int width = LayoutDelegate::Get()->GetDialogPreferredWidth( 117 int width =
118 LayoutDelegate::DialogWidth::MEDIUM); 118 ChromeLayoutProvider::Get()->GetDialogPreferredWidth(DialogWidth::MEDIUM);
119 if (!width) 119 if (!width)
120 width = kDefaultWidth; 120 width = kDefaultWidth;
121 return gfx::Size(width, kHeight); 121 return gfx::Size(width, kHeight);
122 } 122 }
123 123
124 int DeviceChooserContentView::RowCount() { 124 int DeviceChooserContentView::RowCount() {
125 // When there are no devices, the table contains a message saying there 125 // When there are no devices, the table contains a message saying there
126 // are no devices, so the number of rows is always at least 1. 126 // are no devices, so the number of rows is always at least 1.
127 return std::max(base::checked_cast<int>(chooser_controller_->NumOptions()), 127 return std::max(base::checked_cast<int>(chooser_controller_->NumOptions()),
128 1); 128 1);
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 } 325 }
326 326
327 void DeviceChooserContentView::SetGetHelpAndReScanLink() { 327 void DeviceChooserContentView::SetGetHelpAndReScanLink() {
328 DCHECK(footnote_link_); 328 DCHECK(footnote_link_);
329 footnote_link_->SetText(help_and_re_scan_text_); 329 footnote_link_->SetText(help_and_re_scan_text_);
330 footnote_link_->AddStyleRange( 330 footnote_link_->AddStyleRange(
331 help_text_range_, views::StyledLabel::RangeStyleInfo::CreateForLink()); 331 help_text_range_, views::StyledLabel::RangeStyleInfo::CreateForLink());
332 footnote_link_->AddStyleRange( 332 footnote_link_->AddStyleRange(
333 re_scan_text_range_, views::StyledLabel::RangeStyleInfo::CreateForLink()); 333 re_scan_text_range_, views::StyledLabel::RangeStyleInfo::CreateForLink());
334 } 334 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698