Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Unified Diff: chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc

Issue 1412863004: arc-bridge: Add the ARC Bridge Service (Closed) Base URL: https://chromium.googlesource.com/a/chromium/src.git@master
Patch Set: Rebased to ToT Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/ash/chrome_shell_delegate.h ('k') | chrome/chrome_browser_chromeos.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..80b6b095db2f7b3239d206f17cee7d1a5476092e 100644
--- a/chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc
+++ b/chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc
@@ -41,6 +41,10 @@
#include "ui/base/ime/chromeos/input_method_manager.h"
#include "ui/base/l10n/l10n_util.h"
+#if defined(ENABLE_ARC)
+#include "components/arc/arc_bridge_service.h"
+#endif
+
namespace {
void InitAfterFirstSessionStart() {
@@ -225,11 +229,22 @@ void ChromeShellDelegate::PreInit() {
display_configuration_observer_.reset(
new chromeos::DisplayConfigurationObserver());
+#if defined(ENABLE_ARC)
+ arc_session_observer_.reset(new ArcSessionObserver);
+#endif
+
chrome_user_metrics_recorder_.reset(new ChromeUserMetricsRecorder);
}
void ChromeShellDelegate::PreShutdown() {
display_configuration_observer_.reset();
+
+#if defined(ENABLE_ARC)
+ // Remove the ARC observer now since it uses the ash::Shell instance in its
+ // destructor, which is unavailable after PreShutdown() returns.
+ arc_session_observer_.reset();
+#endif
+
chrome_user_metrics_recorder_.reset();
}
@@ -297,3 +312,34 @@ void ChromeShellDelegate::PlatformInit() {
chrome::NOTIFICATION_SESSION_STARTED,
content::NotificationService::AllSources());
}
+
+#if defined(ENABLE_ARC)
+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:
+ arc::ArcBridgeService::Get()->HandleStartup();
+ break;
+ }
+}
+#endif
« no previous file with comments | « chrome/browser/ui/ash/chrome_shell_delegate.h ('k') | chrome/chrome_browser_chromeos.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698