Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/common/system/chromeos/bluetooth/tray_bluetooth.h" | 5 #include "ash/common/system/chromeos/bluetooth/tray_bluetooth.h" |
| 6 | 6 |
| 7 #include "ash/common/material_design/material_design_controller.h" | 7 #include "ash/common/material_design/material_design_controller.h" |
| 8 #include "ash/common/session/session_state_delegate.h" | 8 #include "ash/common/session/session_state_delegate.h" |
| 9 #include "ash/common/system/tray/fixed_sized_scroll_view.h" | 9 #include "ash/common/system/tray/fixed_sized_scroll_view.h" |
| 10 #include "ash/common/system/tray/hover_highlight_view.h" | 10 #include "ash/common/system/tray/hover_highlight_view.h" |
| 11 #include "ash/common/system/tray/system_tray.h" | 11 #include "ash/common/system/tray/system_tray.h" |
| 12 #include "ash/common/system/tray/system_tray_delegate.h" | 12 #include "ash/common/system/tray/system_tray_delegate.h" |
| 13 #include "ash/common/system/tray/system_tray_notifier.h" | 13 #include "ash/common/system/tray/system_tray_notifier.h" |
| 14 #include "ash/common/system/tray/throbber_view.h" | 14 #include "ash/common/system/tray/throbber_view.h" |
| 15 #include "ash/common/system/tray/tray_constants.h" | 15 #include "ash/common/system/tray/tray_constants.h" |
| 16 #include "ash/common/system/tray/tray_details_view.h" | 16 #include "ash/common/system/tray/tray_details_view.h" |
| 17 #include "ash/common/system/tray/tray_item_more.h" | 17 #include "ash/common/system/tray/tray_item_more.h" |
| 18 #include "ash/common/system/tray/tray_popup_header_button.h" | 18 #include "ash/common/system/tray/tray_popup_header_button.h" |
| 19 #include "ash/common/system/tray/tray_popup_item_style.h" | 19 #include "ash/common/system/tray/tray_popup_item_style.h" |
| 20 #include "ash/common/system/tray/tray_popup_utils.h" | 20 #include "ash/common/system/tray/tray_popup_utils.h" |
| 21 #include "ash/common/system/tray/tri_view.h" | |
| 21 #include "ash/common/wm_shell.h" | 22 #include "ash/common/wm_shell.h" |
| 22 #include "ash/resources/vector_icons/vector_icons.h" | 23 #include "ash/resources/vector_icons/vector_icons.h" |
| 23 #include "device/bluetooth/bluetooth_common.h" | 24 #include "device/bluetooth/bluetooth_common.h" |
| 24 #include "grit/ash_resources.h" | 25 #include "grit/ash_resources.h" |
| 25 #include "grit/ash_strings.h" | 26 #include "grit/ash_strings.h" |
| 26 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
| 27 #include "ui/base/resource/resource_bundle.h" | 28 #include "ui/base/resource/resource_bundle.h" |
| 28 #include "ui/gfx/color_palette.h" | 29 #include "ui/gfx/color_palette.h" |
| 29 #include "ui/gfx/image/image.h" | 30 #include "ui/gfx/image/image.h" |
| 30 #include "ui/gfx/paint_vector_icon.h" | 31 #include "ui/gfx/paint_vector_icon.h" |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 475 delegate->ToggleBluetooth(); | 476 delegate->ToggleBluetooth(); |
| 476 else | 477 else |
| 477 NOTREACHED(); | 478 NOTREACHED(); |
| 478 } | 479 } |
| 479 | 480 |
| 480 void CreateExtraTitleRowButtons() override { | 481 void CreateExtraTitleRowButtons() override { |
| 481 if (login_ == LoginStatus::LOCKED) | 482 if (login_ == LoginStatus::LOCKED) |
| 482 return; | 483 return; |
| 483 | 484 |
| 484 if (UseMd()) { | 485 if (UseMd()) { |
| 485 toggle_ = title_row()->AddToggleButton(this); | 486 DCHECK(tri_view()); |
|
bruthig
2016/11/14 04:39:11
nit: I think convention says not to add the DCHECK
tdanderson
2016/11/14 19:24:58
Done, here and changed similarly for the other ove
| |
| 486 settings_ = title_row()->AddSettingsButton(this, login_); | 487 tri_view()->SetContainerVisible(TriView::Container::END, true); |
| 488 | |
| 489 // TODO(tdanderson): Move common toggle-creation logic to TrayPopupUtils. | |
| 490 // See crbug.com/614453. | |
| 491 toggle_ = new views::ToggleButton(this); | |
| 492 toggle_->SetFocusForPlatform(); | |
| 493 toggle_->SetAccessibleName( | |
| 494 ui::ResourceBundle::GetSharedInstance().GetLocalizedString( | |
| 495 IDS_ASH_STATUS_TRAY_BLUETOOTH)); | |
| 496 tri_view()->AddView(TriView::Container::END, toggle_); | |
| 497 | |
| 498 settings_ = CreateSettingsButton(login_); | |
| 499 tri_view()->AddView(TriView::Container::END, settings_); | |
| 487 return; | 500 return; |
| 488 } | 501 } |
| 489 | 502 |
| 490 throbber_ = new ThrobberView; | 503 throbber_ = new ThrobberView; |
| 491 throbber_->SetTooltipText( | 504 throbber_->SetTooltipText( |
| 492 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_BLUETOOTH_DISCOVERING)); | 505 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_BLUETOOTH_DISCOVERING)); |
| 493 title_row()->AddViewToRowNonMd(throbber_, false); | 506 title_row()->AddViewToRowNonMd(throbber_, false); |
| 494 | 507 |
| 495 // Do not allow toggling bluetooth in the lock screen. | 508 // Do not allow toggling bluetooth in the lock screen. |
| 496 SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate(); | 509 SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate(); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 615 detailed_->Update(); | 628 detailed_->Update(); |
| 616 } | 629 } |
| 617 | 630 |
| 618 void TrayBluetooth::OnBluetoothDiscoveringChanged() { | 631 void TrayBluetooth::OnBluetoothDiscoveringChanged() { |
| 619 if (!detailed_) | 632 if (!detailed_) |
| 620 return; | 633 return; |
| 621 detailed_->Update(); | 634 detailed_->Update(); |
| 622 } | 635 } |
| 623 | 636 |
| 624 } // namespace ash | 637 } // namespace ash |
| OLD | NEW |