| 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/grit/generated_resources.h" | 10 #include "chrome/grit/generated_resources.h" |
| 10 #include "ui/base/l10n/l10n_util.h" | 11 #include "ui/base/l10n/l10n_util.h" |
| 11 #include "ui/base/resource/resource_bundle.h" | 12 #include "ui/base/resource/resource_bundle.h" |
| 12 #include "ui/gfx/color_palette.h" | 13 #include "ui/gfx/color_palette.h" |
| 13 #include "ui/gfx/geometry/point.h" | 14 #include "ui/gfx/geometry/point.h" |
| 14 #include "ui/gfx/geometry/rect.h" | 15 #include "ui/gfx/geometry/rect.h" |
| 15 #include "ui/gfx/image/image_skia.h" | 16 #include "ui/gfx/image/image_skia.h" |
| 16 #include "ui/gfx/paint_vector_icon.h" | 17 #include "ui/gfx/paint_vector_icon.h" |
| 17 #include "ui/gfx/vector_icons_public.h" | |
| 18 #include "ui/resources/grit/ui_resources.h" | 18 #include "ui/resources/grit/ui_resources.h" |
| 19 #include "ui/views/controls/styled_label.h" | 19 #include "ui/views/controls/styled_label.h" |
| 20 #include "ui/views/controls/table/table_view.h" | 20 #include "ui/views/controls/table/table_view.h" |
| 21 #include "ui/views/controls/throbber.h" | 21 #include "ui/views/controls/throbber.h" |
| 22 #include "ui/views/widget/widget.h" | 22 #include "ui/views/widget/widget.h" |
| 23 | 23 |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| 26 const int kChooserWidth = 370; | 26 const int kChooserWidth = 370; |
| 27 | 27 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 | 149 |
| 150 size_t num_options = chooser_controller_->NumOptions(); | 150 size_t num_options = chooser_controller_->NumOptions(); |
| 151 if (num_options == 0) { | 151 if (num_options == 0) { |
| 152 DCHECK_EQ(0, row); | 152 DCHECK_EQ(0, row); |
| 153 return gfx::ImageSkia(); | 153 return gfx::ImageSkia(); |
| 154 } | 154 } |
| 155 | 155 |
| 156 DCHECK_GE(row, 0); | 156 DCHECK_GE(row, 0); |
| 157 DCHECK_LT(row, base::checked_cast<int>(num_options)); | 157 DCHECK_LT(row, base::checked_cast<int>(num_options)); |
| 158 | 158 |
| 159 if (chooser_controller_->IsConnected(row)) { | 159 if (chooser_controller_->IsConnected(row)) |
| 160 return gfx::CreateVectorIcon(gfx::VectorIconId::BLUETOOTH_CONNECTED, | 160 return gfx::CreateVectorIcon(kBluetoothConnectedIcon, gfx::kChromeIconGrey); |
| 161 gfx::kChromeIconGrey); | |
| 162 } | |
| 163 | 161 |
| 164 int level = chooser_controller_->GetSignalStrengthLevel(row); | 162 int level = chooser_controller_->GetSignalStrengthLevel(row); |
| 165 | 163 |
| 166 if (level == -1) | 164 if (level == -1) |
| 167 return gfx::ImageSkia(); | 165 return gfx::ImageSkia(); |
| 168 | 166 |
| 169 DCHECK_GE(level, 0); | 167 DCHECK_GE(level, 0); |
| 170 DCHECK_LT(level, static_cast<int>(arraysize(kSignalStrengthLevelImageIds))); | 168 DCHECK_LT(level, static_cast<int>(arraysize(kSignalStrengthLevelImageIds))); |
| 171 | 169 |
| 172 return *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 170 return *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 } | 322 } |
| 325 | 323 |
| 326 void DeviceChooserContentView::SetGetHelpAndReScanLink() { | 324 void DeviceChooserContentView::SetGetHelpAndReScanLink() { |
| 327 DCHECK(footnote_link_); | 325 DCHECK(footnote_link_); |
| 328 footnote_link_->SetText(help_and_re_scan_text_); | 326 footnote_link_->SetText(help_and_re_scan_text_); |
| 329 footnote_link_->AddStyleRange( | 327 footnote_link_->AddStyleRange( |
| 330 help_text_range_, views::StyledLabel::RangeStyleInfo::CreateForLink()); | 328 help_text_range_, views::StyledLabel::RangeStyleInfo::CreateForLink()); |
| 331 footnote_link_->AddStyleRange( | 329 footnote_link_->AddStyleRange( |
| 332 re_scan_text_range_, views::StyledLabel::RangeStyleInfo::CreateForLink()); | 330 re_scan_text_range_, views::StyledLabel::RangeStyleInfo::CreateForLink()); |
| 333 } | 331 } |
| OLD | NEW |