| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ash/system_tray_delegate_chromeos.h" | 5 #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #include "base/time/time.h" | 32 #include "base/time/time.h" |
| 33 #include "chrome/browser/browser_process.h" | 33 #include "chrome/browser/browser_process.h" |
| 34 #include "chrome/browser/chrome_notification_types.h" | 34 #include "chrome/browser/chrome_notification_types.h" |
| 35 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" | 35 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" |
| 36 #include "chrome/browser/chromeos/events/system_key_event_listener.h" | 36 #include "chrome/browser/chromeos/events/system_key_event_listener.h" |
| 37 #include "chrome/browser/chromeos/input_method/input_method_switch_recorder.h" | 37 #include "chrome/browser/chromeos/input_method/input_method_switch_recorder.h" |
| 38 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 38 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
| 39 #include "chrome/browser/chromeos/login/help_app_launcher.h" | 39 #include "chrome/browser/chromeos/login/help_app_launcher.h" |
| 40 #include "chrome/browser/chromeos/login/login_wizard.h" | 40 #include "chrome/browser/chromeos/login/login_wizard.h" |
| 41 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" | 41 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" |
| 42 #include "chrome/browser/chromeos/login/user_flow.h" | |
| 43 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | |
| 44 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" | 42 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" |
| 45 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 43 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 46 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" | 44 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" |
| 47 #include "chrome/browser/chromeos/profiles/multiprofiles_intro_dialog.h" | 45 #include "chrome/browser/chromeos/profiles/multiprofiles_intro_dialog.h" |
| 48 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 46 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 49 #include "chrome/browser/profiles/profile_manager.h" | 47 #include "chrome/browser/profiles/profile_manager.h" |
| 50 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | 48 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
| 51 #include "chrome/browser/ui/ash/networking_config_delegate_chromeos.h" | 49 #include "chrome/browser/ui/ash/networking_config_delegate_chromeos.h" |
| 52 #include "chrome/browser/ui/ash/system_tray_client.h" | 50 #include "chrome/browser/ui/ash/system_tray_client.h" |
| 53 #include "chrome/browser/ui/browser.h" | 51 #include "chrome/browser/ui/browser.h" |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 | 241 |
| 244 bool SystemTrayDelegateChromeOS::IsUserSupervised() const { | 242 bool SystemTrayDelegateChromeOS::IsUserSupervised() const { |
| 245 user_manager::User* user = user_manager::UserManager::Get()->GetActiveUser(); | 243 user_manager::User* user = user_manager::UserManager::Get()->GetActiveUser(); |
| 246 return user && user->IsSupervised(); | 244 return user && user->IsSupervised(); |
| 247 } | 245 } |
| 248 | 246 |
| 249 bool SystemTrayDelegateChromeOS::IsUserChild() const { | 247 bool SystemTrayDelegateChromeOS::IsUserChild() const { |
| 250 return user_manager::UserManager::Get()->IsLoggedInAsChildUser(); | 248 return user_manager::UserManager::Get()->IsLoggedInAsChildUser(); |
| 251 } | 249 } |
| 252 | 250 |
| 253 bool SystemTrayDelegateChromeOS::ShouldShowSettings() const { | |
| 254 // Show setting button only when the user flow allows and it's not in the | |
| 255 // multi-profile login screen. | |
| 256 return ChromeUserManager::Get()->GetCurrentUserFlow()->ShouldShowSettings() && | |
| 257 !IsSessionInSecondaryLoginScreen(); | |
| 258 } | |
| 259 | |
| 260 bool SystemTrayDelegateChromeOS::ShouldShowNotificationTray() const { | |
| 261 // Show notification tray only when the user flow allows and it's not in the | |
| 262 // multi-profile login screen. | |
| 263 return ChromeUserManager::Get() | |
| 264 ->GetCurrentUserFlow() | |
| 265 ->ShouldShowNotificationTray() && | |
| 266 !IsSessionInSecondaryLoginScreen(); | |
| 267 } | |
| 268 | |
| 269 void SystemTrayDelegateChromeOS::ShowEnterpriseInfo() { | 251 void SystemTrayDelegateChromeOS::ShowEnterpriseInfo() { |
| 270 // TODO(mash): Refactor out SessionStateDelegate and move to SystemTrayClient. | 252 // TODO(mash): Refactor out SessionStateDelegate and move to SystemTrayClient. |
| 271 ash::LoginStatus status = GetUserLoginStatus(); | 253 ash::LoginStatus status = GetUserLoginStatus(); |
| 272 if (status == ash::LoginStatus::NOT_LOGGED_IN || | 254 if (status == ash::LoginStatus::NOT_LOGGED_IN || |
| 273 status == ash::LoginStatus::LOCKED || IsSessionInSecondaryLoginScreen()) { | 255 status == ash::LoginStatus::LOCKED || IsSessionInSecondaryLoginScreen()) { |
| 274 scoped_refptr<chromeos::HelpAppLauncher> help_app( | 256 scoped_refptr<chromeos::HelpAppLauncher> help_app( |
| 275 new chromeos::HelpAppLauncher(nullptr /* parent_window */)); | 257 new chromeos::HelpAppLauncher(nullptr /* parent_window */)); |
| 276 help_app->ShowHelpTopic(chromeos::HelpAppLauncher::HELP_ENTERPRISE); | 258 help_app->ShowHelpTopic(chromeos::HelpAppLauncher::HELP_ENTERPRISE); |
| 277 } else { | 259 } else { |
| 278 chrome::ScopedTabbedBrowserDisplayer displayer( | 260 chrome::ScopedTabbedBrowserDisplayer displayer( |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " | 717 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " |
| 736 << "ENABLE_SUPERVISED_USERS undefined."; | 718 << "ENABLE_SUPERVISED_USERS undefined."; |
| 737 return base::string16(); | 719 return base::string16(); |
| 738 } | 720 } |
| 739 | 721 |
| 740 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 722 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
| 741 return new SystemTrayDelegateChromeOS(); | 723 return new SystemTrayDelegateChromeOS(); |
| 742 } | 724 } |
| 743 | 725 |
| 744 } // namespace chromeos | 726 } // namespace chromeos |
| OLD | NEW |