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

Side by Side Diff: chrome/browser/ui/views/device_chooser_content_view.cc

Issue 2627483003: Centering turn on Bluetooth message on the chooser (Closed)
Patch Set: added comment Created 3 years, 11 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/cocoa/device_chooser_content_view_cocoa.mm ('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 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 return gfx::Size(kChooserWidth, kChooserHeight); 99 return gfx::Size(kChooserWidth, kChooserHeight);
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 // Set the adapter off message in the center of the chooser.
110 // The adapter off message will only be shown when the adapter is off,
111 // and in that case, the system won't be able to scan for devices, so
112 // the throbber won't be shown at the same time.
109 turn_adapter_off_help_->SetPosition( 113 turn_adapter_off_help_->SetPosition(
110 gfx::Point(kAdapterOffHelpLinkPadding, kAdapterOffHelpLinkPadding)); 114 gfx::Point((rect.width() - turn_adapter_off_help_->width()) / 2,
115 (rect.height() - turn_adapter_off_help_->height()) / 2));
111 turn_adapter_off_help_->SizeToFit(rect.width() - 116 turn_adapter_off_help_->SizeToFit(rect.width() -
112 2 * kAdapterOffHelpLinkPadding); 117 2 * kAdapterOffHelpLinkPadding);
113 views::View::Layout(); 118 views::View::Layout();
114 } 119 }
115 120
116 int DeviceChooserContentView::RowCount() { 121 int DeviceChooserContentView::RowCount() {
117 // When there are no devices, the table contains a message saying there 122 // 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. 123 // are no devices, so the number of rows is always at least 1.
119 return std::max(base::checked_cast<int>(chooser_controller_->NumOptions()), 124 return std::max(base::checked_cast<int>(chooser_controller_->NumOptions()),
120 1); 125 1);
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 } 324 }
320 325
321 void DeviceChooserContentView::SetGetHelpAndReScanLink() { 326 void DeviceChooserContentView::SetGetHelpAndReScanLink() {
322 DCHECK(footnote_link_); 327 DCHECK(footnote_link_);
323 footnote_link_->SetText(help_and_re_scan_text_); 328 footnote_link_->SetText(help_and_re_scan_text_);
324 footnote_link_->AddStyleRange( 329 footnote_link_->AddStyleRange(
325 help_text_range_, views::StyledLabel::RangeStyleInfo::CreateForLink()); 330 help_text_range_, views::StyledLabel::RangeStyleInfo::CreateForLink());
326 footnote_link_->AddStyleRange( 331 footnote_link_->AddStyleRange(
327 re_scan_text_range_, views::StyledLabel::RangeStyleInfo::CreateForLink()); 332 re_scan_text_range_, views::StyledLabel::RangeStyleInfo::CreateForLink());
328 } 333 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/device_chooser_content_view_cocoa.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698