Chromium Code Reviews| Index: chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc |
| diff --git a/chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc b/chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc |
| index 79e85d1cb49ac7919688c08aa4aea7d698fac820..c58c39a790179a87e31f727de79e42ae926c173e 100644 |
| --- a/chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc |
| +++ b/chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc |
| @@ -35,6 +35,7 @@ |
| #include "chrome/browser/ui/browser_window.h" |
| #include "chrome/grit/generated_resources.h" |
| #include "chromeos/chromeos_switches.h" |
| +#include "components/arc/arc_bridge_service.h" |
| #include "content/public/browser/notification_service.h" |
| #include "content/public/browser/user_metrics.h" |
| #include "ui/aura/window.h" |
| @@ -225,11 +226,14 @@ void ChromeShellDelegate::PreInit() { |
| display_configuration_observer_.reset( |
| new chromeos::DisplayConfigurationObserver()); |
| + arc_session_observer_.reset(new ArcSessionObserver); |
| + |
| chrome_user_metrics_recorder_.reset(new ChromeUserMetricsRecorder); |
| } |
| void ChromeShellDelegate::PreShutdown() { |
| display_configuration_observer_.reset(); |
| + arc_session_observer_.reset(); |
|
sky
2015/11/12 22:06:53
Please document why this needs to be shutdown here
Luis Héctor Chávez
2015/11/12 22:21:38
Done.
|
| chrome_user_metrics_recorder_.reset(); |
| } |
| @@ -297,3 +301,36 @@ void ChromeShellDelegate::PlatformInit() { |
| chrome::NOTIFICATION_SESSION_STARTED, |
| content::NotificationService::AllSources()); |
| } |
| + |
| +ChromeShellDelegate::ArcSessionObserver::ArcSessionObserver() { |
| + ash::Shell::GetInstance()->AddShellObserver(this); |
| +} |
| + |
| +ChromeShellDelegate::ArcSessionObserver::~ArcSessionObserver() { |
| + ash::Shell::GetInstance()->RemoveShellObserver(this); |
| +} |
| + |
| +void ChromeShellDelegate::ArcSessionObserver::OnLoginStateChanged( |
| + ash::user::LoginStatus status) { |
| + switch (status) { |
| + case ash::user::LOGGED_IN_LOCKED: |
| + case ash::user::LOGGED_IN_KIOSK_APP: |
| + return; |
| + |
| + case ash::user::LOGGED_IN_NONE: |
| + arc::ArcBridgeService::Get()->Shutdown(); |
| + break; |
| + |
| + case ash::user::LOGGED_IN_USER: |
| + case ash::user::LOGGED_IN_OWNER: |
| + case ash::user::LOGGED_IN_GUEST: |
| + case ash::user::LOGGED_IN_PUBLIC: |
| + case ash::user::LOGGED_IN_SUPERVISED: |
| + Profile* profile = ProfileManager::GetActiveUserProfile(); |
| + const bool enabled = arc::ArcPrefs::GetEnabled( |
| + profile->GetPrefs(), base::CommandLine::ForCurrentProcess()); |
| + arc::ArcBridgeService::Get()->SetEnabled(enabled); |
| + arc::ArcBridgeService::Get()->HandleStartup(); |
|
oshima
2015/11/11 22:07:38
This is a future suggestion, as this requires chan
Luis Héctor Chávez
2015/11/11 22:11:12
SetEnabled might change during runtime, so HandleS
oshima
2015/11/11 22:55:30
It's not clear to me why you need both (SetEnable
|
| + break; |
| + } |
| +} |