| 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/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 void Init(Profile* profile) { | 30 void Init(Profile* profile) { |
| 31 DCHECK(!window_registry_); | 31 DCHECK(!window_registry_); |
| 32 window_registry_ = ShellWindowRegistry::Get(profile); | 32 window_registry_ = ShellWindowRegistry::Get(profile); |
| 33 if (window_registry_) | 33 if (window_registry_) |
| 34 window_registry_->AddObserver(this); | 34 window_registry_->AddObserver(this); |
| 35 } | 35 } |
| 36 | 36 |
| 37 private: | 37 private: |
| 38 // extensions::ShellWindowRegistry::Observer overrides: | 38 // extensions::ShellWindowRegistry::Observer overrides: |
| 39 virtual void OnShellWindowAdded(ShellWindow* shell_window) OVERRIDE {} | 39 virtual void OnShellWindowAdded(apps::ShellWindow* shell_window) OVERRIDE {} |
| 40 virtual void OnShellWindowIconChanged(ShellWindow* shell_window) OVERRIDE {} | 40 virtual void OnShellWindowIconChanged(apps::ShellWindow* shell_window) |
| 41 virtual void OnShellWindowRemoved(ShellWindow* shell_window) OVERRIDE { | 41 OVERRIDE {} |
| 42 virtual void OnShellWindowRemoved(apps::ShellWindow* shell_window) OVERRIDE { |
| 42 if (window_registry_->shell_windows().empty()) { | 43 if (window_registry_->shell_windows().empty()) { |
| 43 chrome::AttemptUserExit(); | 44 chrome::AttemptUserExit(); |
| 44 window_registry_->RemoveObserver(this); | 45 window_registry_->RemoveObserver(this); |
| 45 } | 46 } |
| 46 } | 47 } |
| 47 | 48 |
| 48 extensions::ShellWindowRegistry* window_registry_; | 49 extensions::ShellWindowRegistry* window_registry_; |
| 49 | 50 |
| 50 DISALLOW_COPY_AND_ASSIGN(AppWindowWatcher); | 51 DISALLOW_COPY_AND_ASSIGN(AppWindowWatcher); |
| 51 }; | 52 }; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 68 update_service->set_app_id(app_id); | 69 update_service->set_app_id(app_id); |
| 69 | 70 |
| 70 // If the device is not enterprise managed, set prefs to reboot after update. | 71 // If the device is not enterprise managed, set prefs to reboot after update. |
| 71 if (!g_browser_process->browser_policy_connector()->IsEnterpriseManaged()) { | 72 if (!g_browser_process->browser_policy_connector()->IsEnterpriseManaged()) { |
| 72 PrefService* local_state = g_browser_process->local_state(); | 73 PrefService* local_state = g_browser_process->local_state(); |
| 73 local_state->SetBoolean(prefs::kRebootAfterUpdate, true); | 74 local_state->SetBoolean(prefs::kRebootAfterUpdate, true); |
| 74 } | 75 } |
| 75 } | 76 } |
| 76 | 77 |
| 77 } // namespace chromeos | 78 } // namespace chromeos |
| OLD | NEW |