Chromium Code Reviews| 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/grit/generated_resources.h" | 9 #include "chrome/grit/generated_resources.h" |
| 10 #include "ui/base/l10n/l10n_util.h" | 10 #include "ui/base/l10n/l10n_util.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 100 } | 100 } |
| 101 | 101 |
| 102 void DeviceChooserContentView::Layout() { | 102 void DeviceChooserContentView::Layout() { |
| 103 gfx::Rect rect(GetContentsBounds()); | 103 gfx::Rect rect(GetContentsBounds()); |
| 104 table_parent_->SetBoundsRect(rect); | 104 table_parent_->SetBoundsRect(rect); |
| 105 // Set the throbber in the center of the chooser. | 105 // Set the throbber in the center of the chooser. |
| 106 throbber_->SetBounds((rect.width() - kThrobberDiameter) / 2, | 106 throbber_->SetBounds((rect.width() - kThrobberDiameter) / 2, |
| 107 (rect.height() - kThrobberDiameter) / 2, | 107 (rect.height() - kThrobberDiameter) / 2, |
| 108 kThrobberDiameter, kThrobberDiameter); | 108 kThrobberDiameter, kThrobberDiameter); |
| 109 turn_adapter_off_help_->SetPosition( | 109 turn_adapter_off_help_->SetPosition( |
| 110 gfx::Point(kAdapterOffHelpLinkPadding, kAdapterOffHelpLinkPadding)); | 110 gfx::Point((rect.width() - turn_adapter_off_help_->width()) / 2, |
| 111 (rect.height() - turn_adapter_off_help_->height()) / 2)); | |
|
sky
2017/01/10 23:48:31
Might this be on top of the throbber?
juncai
2017/01/11 00:12:50
No. The adapter off message will only be shown whe
sky
2017/01/11 00:36:14
Ok, thanks. Could you add a comment here to that e
juncai
2017/01/11 18:13:43
Done.
| |
| 111 turn_adapter_off_help_->SizeToFit(rect.width() - | 112 turn_adapter_off_help_->SizeToFit(rect.width() - |
| 112 2 * kAdapterOffHelpLinkPadding); | 113 2 * kAdapterOffHelpLinkPadding); |
| 113 views::View::Layout(); | 114 views::View::Layout(); |
| 114 } | 115 } |
| 115 | 116 |
| 116 int DeviceChooserContentView::RowCount() { | 117 int DeviceChooserContentView::RowCount() { |
| 117 // When there are no devices, the table contains a message saying there | 118 // When there are no devices, the table contains a message saying there |
| 118 // are no devices, so the number of rows is always at least 1. | 119 // are no devices, so the number of rows is always at least 1. |
| 119 return std::max(base::checked_cast<int>(chooser_controller_->NumOptions()), | 120 return std::max(base::checked_cast<int>(chooser_controller_->NumOptions()), |
| 120 1); | 121 1); |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 319 } | 320 } |
| 320 | 321 |
| 321 void DeviceChooserContentView::SetGetHelpAndReScanLink() { | 322 void DeviceChooserContentView::SetGetHelpAndReScanLink() { |
| 322 DCHECK(footnote_link_); | 323 DCHECK(footnote_link_); |
| 323 footnote_link_->SetText(help_and_re_scan_text_); | 324 footnote_link_->SetText(help_and_re_scan_text_); |
| 324 footnote_link_->AddStyleRange( | 325 footnote_link_->AddStyleRange( |
| 325 help_text_range_, views::StyledLabel::RangeStyleInfo::CreateForLink()); | 326 help_text_range_, views::StyledLabel::RangeStyleInfo::CreateForLink()); |
| 326 footnote_link_->AddStyleRange( | 327 footnote_link_->AddStyleRange( |
| 327 re_scan_text_range_, views::StyledLabel::RangeStyleInfo::CreateForLink()); | 328 re_scan_text_range_, views::StyledLabel::RangeStyleInfo::CreateForLink()); |
| 328 } | 329 } |
| OLD | NEW |