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/chromeos/app_mode/app_session_lifetime.h" | 5 #include "chrome/browser/chromeos/app_mode/app_session_lifetime.h" |
6 | 6 |
7 #include "apps/app_window.h" | 7 #include "apps/app_window.h" |
8 #include "apps/app_window_registry.h" | 8 #include "apps/app_window_registry.h" |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 window_registry_ = AppWindowRegistry::Get(profile); | 47 window_registry_ = AppWindowRegistry::Get(profile); |
48 if (window_registry_) | 48 if (window_registry_) |
49 window_registry_->AddObserver(this); | 49 window_registry_->AddObserver(this); |
50 } | 50 } |
51 | 51 |
52 private: | 52 private: |
53 // apps::AppWindowRegistry::Observer overrides: | 53 // apps::AppWindowRegistry::Observer overrides: |
54 virtual void OnAppWindowRemoved(apps::AppWindow* app_window) OVERRIDE { | 54 virtual void OnAppWindowRemoved(apps::AppWindow* app_window) OVERRIDE { |
55 if (window_registry_->app_windows().empty()) { | 55 if (window_registry_->app_windows().empty()) { |
56 if (DemoAppLauncher::IsDemoAppSession( | 56 if (DemoAppLauncher::IsDemoAppSession( |
57 chromeos::UserManager::Get()->GetActiveUser()->email())) { | 57 chromeos::GetUserManager()->GetActiveUser()->email())) { |
58 // If we were in demo mode, we disabled all our network technologies, | 58 // If we were in demo mode, we disabled all our network technologies, |
59 // re-enable them. | 59 // re-enable them. |
60 NetworkStateHandler* handler = | 60 NetworkStateHandler* handler = |
61 NetworkHandler::Get()->network_state_handler(); | 61 NetworkHandler::Get()->network_state_handler(); |
62 handler->SetTechnologyEnabled( | 62 handler->SetTechnologyEnabled( |
63 NetworkTypePattern::NonVirtual(), | 63 NetworkTypePattern::NonVirtual(), |
64 true, | 64 true, |
65 chromeos::network_handler::ErrorCallback()); | 65 chromeos::network_handler::ErrorCallback()); |
66 } | 66 } |
67 chrome::AttemptUserExit(); | 67 chrome::AttemptUserExit(); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 // Binds the session lifetime with app window counts. | 122 // Binds the session lifetime with app window counts. |
123 CHECK(app_window_handler == NULL); | 123 CHECK(app_window_handler == NULL); |
124 app_window_handler.Get().Init(profile); | 124 app_window_handler.Get().Init(profile); |
125 | 125 |
126 CHECK(browser_window_handler == NULL); | 126 CHECK(browser_window_handler == NULL); |
127 browser_window_handler.Get(); | 127 browser_window_handler.Get(); |
128 | 128 |
129 // For a demo app, we don't need to either setup the update service or | 129 // For a demo app, we don't need to either setup the update service or |
130 // the idle app name notification. | 130 // the idle app name notification. |
131 if (DemoAppLauncher::IsDemoAppSession( | 131 if (DemoAppLauncher::IsDemoAppSession( |
132 chromeos::UserManager::Get()->GetActiveUser()->email())) | 132 chromeos::GetUserManager()->GetActiveUser()->email())) |
133 return; | 133 return; |
134 | 134 |
135 // Set the app_id for the current instance of KioskAppUpdateService. | 135 // Set the app_id for the current instance of KioskAppUpdateService. |
136 KioskAppUpdateService* update_service = | 136 KioskAppUpdateService* update_service = |
137 KioskAppUpdateServiceFactory::GetForProfile(profile); | 137 KioskAppUpdateServiceFactory::GetForProfile(profile); |
138 DCHECK(update_service); | 138 DCHECK(update_service); |
139 if (update_service) | 139 if (update_service) |
140 update_service->set_app_id(app_id); | 140 update_service->set_app_id(app_id); |
141 | 141 |
142 // If the device is not enterprise managed, set prefs to reboot after update | 142 // If the device is not enterprise managed, set prefs to reboot after update |
143 // and create a user security message which shows the user the application | 143 // and create a user security message which shows the user the application |
144 // name and author after some idle timeout. | 144 // name and author after some idle timeout. |
145 policy::BrowserPolicyConnectorChromeOS* connector = | 145 policy::BrowserPolicyConnectorChromeOS* connector = |
146 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 146 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
147 if (!connector->IsEnterpriseManaged()) { | 147 if (!connector->IsEnterpriseManaged()) { |
148 PrefService* local_state = g_browser_process->local_state(); | 148 PrefService* local_state = g_browser_process->local_state(); |
149 local_state->SetBoolean(prefs::kRebootAfterUpdate, true); | 149 local_state->SetBoolean(prefs::kRebootAfterUpdate, true); |
150 KioskModeIdleAppNameNotification::Initialize(); | 150 KioskModeIdleAppNameNotification::Initialize(); |
151 } | 151 } |
152 } | 152 } |
153 | 153 |
154 } // namespace chromeos | 154 } // namespace chromeos |
OLD | NEW |