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 "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 void Init(Profile* profile) { | 47 void Init(Profile* profile) { |
48 DCHECK(!window_registry_); | 48 DCHECK(!window_registry_); |
49 window_registry_ = AppWindowRegistry::Get(profile); | 49 window_registry_ = AppWindowRegistry::Get(profile); |
50 if (window_registry_) | 50 if (window_registry_) |
51 window_registry_->AddObserver(this); | 51 window_registry_->AddObserver(this); |
52 } | 52 } |
53 | 53 |
54 private: | 54 private: |
55 // extensions::AppWindowRegistry::Observer overrides: | 55 // extensions::AppWindowRegistry::Observer overrides: |
56 virtual void OnAppWindowRemoved(AppWindow* app_window) OVERRIDE { | 56 virtual void OnAppWindowRemoved(AppWindow* app_window) override { |
57 if (window_registry_->app_windows().empty()) { | 57 if (window_registry_->app_windows().empty()) { |
58 if (DemoAppLauncher::IsDemoAppSession( | 58 if (DemoAppLauncher::IsDemoAppSession( |
59 user_manager::UserManager::Get()->GetActiveUser()->email())) { | 59 user_manager::UserManager::Get()->GetActiveUser()->email())) { |
60 // If we were in demo mode, we disabled all our network technologies, | 60 // If we were in demo mode, we disabled all our network technologies, |
61 // re-enable them. | 61 // re-enable them. |
62 NetworkStateHandler* handler = | 62 NetworkStateHandler* handler = |
63 NetworkHandler::Get()->network_state_handler(); | 63 NetworkHandler::Get()->network_state_handler(); |
64 handler->SetTechnologyEnabled( | 64 handler->SetTechnologyEnabled( |
65 NetworkTypePattern::NonVirtual(), | 65 NetworkTypePattern::NonVirtual(), |
66 true, | 66 true, |
(...skipping 30 matching lines...) Expand all Loading... |
97 browser->tab_strip_model()->GetActiveWebContents(); | 97 browser->tab_strip_model()->GetActiveWebContents(); |
98 std::string url_string = | 98 std::string url_string = |
99 active_tab ? active_tab->GetURL().spec() : std::string(); | 99 active_tab ? active_tab->GetURL().spec() : std::string(); |
100 LOG(WARNING) << "Browser opened in kiosk session" | 100 LOG(WARNING) << "Browser opened in kiosk session" |
101 << ", url=" << url_string; | 101 << ", url=" << url_string; |
102 | 102 |
103 browser->window()->Close(); | 103 browser->window()->Close(); |
104 } | 104 } |
105 | 105 |
106 // chrome::BrowserListObserver overrides: | 106 // chrome::BrowserListObserver overrides: |
107 virtual void OnBrowserAdded(Browser* browser) OVERRIDE { | 107 virtual void OnBrowserAdded(Browser* browser) override { |
108 base::MessageLoop::current()->PostTask( | 108 base::MessageLoop::current()->PostTask( |
109 FROM_HERE, | 109 FROM_HERE, |
110 base::Bind(&BrowserWindowHandler::HandleBrowser, | 110 base::Bind(&BrowserWindowHandler::HandleBrowser, |
111 base::Unretained(this), // LazyInstance, always valid | 111 base::Unretained(this), // LazyInstance, always valid |
112 browser)); | 112 browser)); |
113 } | 113 } |
114 | 114 |
115 DISALLOW_COPY_AND_ASSIGN(BrowserWindowHandler); | 115 DISALLOW_COPY_AND_ASSIGN(BrowserWindowHandler); |
116 }; | 116 }; |
117 | 117 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 policy::BrowserPolicyConnectorChromeOS* connector = | 150 policy::BrowserPolicyConnectorChromeOS* connector = |
151 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 151 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
152 if (!connector->IsEnterpriseManaged()) { | 152 if (!connector->IsEnterpriseManaged()) { |
153 PrefService* local_state = g_browser_process->local_state(); | 153 PrefService* local_state = g_browser_process->local_state(); |
154 local_state->SetBoolean(prefs::kRebootAfterUpdate, true); | 154 local_state->SetBoolean(prefs::kRebootAfterUpdate, true); |
155 KioskModeIdleAppNameNotification::Initialize(); | 155 KioskModeIdleAppNameNotification::Initialize(); |
156 } | 156 } |
157 } | 157 } |
158 | 158 |
159 } // namespace chromeos | 159 } // namespace chromeos |
OLD | NEW |