| 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/system/chromeos/tray_display.h" | 5 #include "ash/system/chromeos/tray_display.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "ash/common/system/tray/fixed_sized_image_view.h" | 11 #include "ash/common/system/tray/fixed_sized_image_view.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/tray_constants.h" | 13 #include "ash/common/system/tray/tray_constants.h" |
| 14 #include "ash/common/wm_shell.h" |
| 14 #include "ash/display/display_manager.h" | 15 #include "ash/display/display_manager.h" |
| 15 #include "ash/display/screen_orientation_controller_chromeos.h" | 16 #include "ash/display/screen_orientation_controller_chromeos.h" |
| 16 #include "ash/display/window_tree_host_manager.h" | 17 #include "ash/display/window_tree_host_manager.h" |
| 17 #include "ash/shell.h" | 18 #include "ash/shell.h" |
| 18 #include "ash/system/chromeos/devicetype_utils.h" | 19 #include "ash/system/chromeos/devicetype_utils.h" |
| 19 #include "ash/system/system_notifier.h" | 20 #include "ash/system/system_notifier.h" |
| 20 #include "ash/system/tray/actionable_view.h" | 21 #include "ash/system/tray/actionable_view.h" |
| 21 #include "ash/system/tray/system_tray.h" | 22 #include "ash/system/tray/system_tray.h" |
| 22 #include "ash/system/tray/tray_notification_view.h" | 23 #include "ash/system/tray/tray_notification_view.h" |
| 23 #include "base/bind.h" | 24 #include "base/bind.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 continue; | 111 continue; |
| 111 lines.push_back(GetDisplayInfoLine(id)); | 112 lines.push_back(GetDisplayInfoLine(id)); |
| 112 } | 113 } |
| 113 | 114 |
| 114 return base::JoinString(lines, base::ASCIIToUTF16("\n")); | 115 return base::JoinString(lines, base::ASCIIToUTF16("\n")); |
| 115 } | 116 } |
| 116 | 117 |
| 117 void OpenSettings() { | 118 void OpenSettings() { |
| 118 // switch is intentionally introduced without default, to cause an error when | 119 // switch is intentionally introduced without default, to cause an error when |
| 119 // a new type of login status is introduced. | 120 // a new type of login status is introduced. |
| 120 switch (Shell::GetInstance()->system_tray_delegate()->GetUserLoginStatus()) { | 121 switch (WmShell::Get()->system_tray_delegate()->GetUserLoginStatus()) { |
| 121 case LoginStatus::NOT_LOGGED_IN: | 122 case LoginStatus::NOT_LOGGED_IN: |
| 122 case LoginStatus::LOCKED: | 123 case LoginStatus::LOCKED: |
| 123 return; | 124 return; |
| 124 | 125 |
| 125 case LoginStatus::USER: | 126 case LoginStatus::USER: |
| 126 case LoginStatus::OWNER: | 127 case LoginStatus::OWNER: |
| 127 case LoginStatus::GUEST: | 128 case LoginStatus::GUEST: |
| 128 case LoginStatus::PUBLIC: | 129 case LoginStatus::PUBLIC: |
| 129 case LoginStatus::SUPERVISED: | 130 case LoginStatus::SUPERVISED: |
| 130 case LoginStatus::KIOSK_APP: | 131 case LoginStatus::KIOSK_APP: |
| 131 ash::SystemTrayDelegate* delegate = | 132 SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate(); |
| 132 Shell::GetInstance()->system_tray_delegate(); | |
| 133 if (delegate->ShouldShowSettings()) | 133 if (delegate->ShouldShowSettings()) |
| 134 delegate->ShowDisplaySettings(); | 134 delegate->ShowDisplaySettings(); |
| 135 } | 135 } |
| 136 } | 136 } |
| 137 | 137 |
| 138 } // namespace | 138 } // namespace |
| 139 | 139 |
| 140 const char TrayDisplay::kNotificationId[] = "chrome://settings/display"; | 140 const char TrayDisplay::kNotificationId[] = "chrome://settings/display"; |
| 141 | 141 |
| 142 class DisplayView : public ActionableView { | 142 class DisplayView : public ActionableView { |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 default_ = NULL; | 425 default_ = NULL; |
| 426 } | 426 } |
| 427 | 427 |
| 428 void TrayDisplay::OnDisplayConfigurationChanged() { | 428 void TrayDisplay::OnDisplayConfigurationChanged() { |
| 429 DisplayInfoMap old_info; | 429 DisplayInfoMap old_info; |
| 430 UpdateDisplayInfo(&old_info); | 430 UpdateDisplayInfo(&old_info); |
| 431 | 431 |
| 432 if (default_) | 432 if (default_) |
| 433 default_->Update(); | 433 default_->Update(); |
| 434 | 434 |
| 435 if (!Shell::GetInstance()->system_tray_delegate()-> | 435 if (!WmShell::Get() |
| 436 ShouldShowDisplayNotification()) { | 436 ->system_tray_delegate() |
| 437 ->ShouldShowDisplayNotification()) { |
| 437 return; | 438 return; |
| 438 } | 439 } |
| 439 | 440 |
| 440 base::string16 message; | 441 base::string16 message; |
| 441 base::string16 additional_message; | 442 base::string16 additional_message; |
| 442 if (GetDisplayMessageForNotification(old_info, &message, &additional_message)) | 443 if (GetDisplayMessageForNotification(old_info, &message, &additional_message)) |
| 443 CreateOrUpdateNotification(message, additional_message); | 444 CreateOrUpdateNotification(message, additional_message); |
| 444 } | 445 } |
| 445 | 446 |
| 446 base::string16 TrayDisplay::GetDefaultViewMessage() const { | 447 base::string16 TrayDisplay::GetDefaultViewMessage() const { |
| 447 if (!default_ || !default_->visible()) | 448 if (!default_ || !default_->visible()) |
| 448 return base::string16(); | 449 return base::string16(); |
| 449 | 450 |
| 450 return static_cast<DisplayView*>(default_)->label()->text(); | 451 return static_cast<DisplayView*>(default_)->label()->text(); |
| 451 } | 452 } |
| 452 | 453 |
| 453 bool TrayDisplay::GetAccessibleStateForTesting(ui::AXViewState* state) { | 454 bool TrayDisplay::GetAccessibleStateForTesting(ui::AXViewState* state) { |
| 454 views::View* view = default_; | 455 views::View* view = default_; |
| 455 if (view) { | 456 if (view) { |
| 456 view->GetAccessibleState(state); | 457 view->GetAccessibleState(state); |
| 457 return true; | 458 return true; |
| 458 } | 459 } |
| 459 return false; | 460 return false; |
| 460 } | 461 } |
| 461 | 462 |
| 462 } // namespace ash | 463 } // namespace ash |
| OLD | NEW |