| OLD | NEW |
| 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/chrome_layout_provider.h" | 10 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 // the throbber won't be shown at the same time. | 105 // the throbber won't be shown at the same time. |
| 106 turn_adapter_off_help_->SetPosition( | 106 turn_adapter_off_help_->SetPosition( |
| 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 return gfx::Size(402, 320); |
| 116 constexpr int kDefaultWidth = 402; | |
| 117 int width = | |
| 118 ChromeLayoutProvider::Get()->GetDialogPreferredWidth(DialogWidth::MEDIUM); | |
| 119 if (!width) | |
| 120 width = kDefaultWidth; | |
| 121 return gfx::Size(width, kHeight); | |
| 122 } | 116 } |
| 123 | 117 |
| 124 int DeviceChooserContentView::RowCount() { | 118 int DeviceChooserContentView::RowCount() { |
| 125 // When there are no devices, the table contains a message saying there | 119 // 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. | 120 // are no devices, so the number of rows is always at least 1. |
| 127 return std::max(base::checked_cast<int>(chooser_controller_->NumOptions()), | 121 return std::max(base::checked_cast<int>(chooser_controller_->NumOptions()), |
| 128 1); | 122 1); |
| 129 } | 123 } |
| 130 | 124 |
| 131 base::string16 DeviceChooserContentView::GetText(int row, int column_id) { | 125 base::string16 DeviceChooserContentView::GetText(int row, int column_id) { |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 } | 319 } |
| 326 | 320 |
| 327 void DeviceChooserContentView::SetGetHelpAndReScanLink() { | 321 void DeviceChooserContentView::SetGetHelpAndReScanLink() { |
| 328 DCHECK(footnote_link_); | 322 DCHECK(footnote_link_); |
| 329 footnote_link_->SetText(help_and_re_scan_text_); | 323 footnote_link_->SetText(help_and_re_scan_text_); |
| 330 footnote_link_->AddStyleRange( | 324 footnote_link_->AddStyleRange( |
| 331 help_text_range_, views::StyledLabel::RangeStyleInfo::CreateForLink()); | 325 help_text_range_, views::StyledLabel::RangeStyleInfo::CreateForLink()); |
| 332 footnote_link_->AddStyleRange( | 326 footnote_link_->AddStyleRange( |
| 333 re_scan_text_range_, views::StyledLabel::RangeStyleInfo::CreateForLink()); | 327 re_scan_text_range_, views::StyledLabel::RangeStyleInfo::CreateForLink()); |
| 334 } | 328 } |
| OLD | NEW |