| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "apps/app_restore_service.h" | 5 #include "apps/app_restore_service.h" |
| 6 | 6 |
| 7 #include "apps/app_lifetime_monitor_factory.h" | 7 #include "apps/app_lifetime_monitor_factory.h" |
| 8 #include "apps/app_restore_service_factory.h" | 8 #include "apps/app_restore_service_factory.h" |
| 9 #include "apps/app_window.h" | 9 #include "apps/app_window.h" |
| 10 #include "apps/browser/api/app_runtime/app_runtime_api.h" | 10 #include "apps/browser/api/app_runtime/app_runtime_api.h" |
| 11 #include "apps/launcher.h" | 11 #include "apps/launcher.h" |
| 12 #include "apps/saved_files_service.h" | 12 #include "apps/saved_files_service.h" |
| 13 #include "chrome/browser/chrome_notification_types.h" | 13 #include "chrome/browser/chrome_notification_types.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "extensions/browser/extension_host.h" | 15 #include "extensions/browser/extension_host.h" |
| 16 #include "extensions/browser/extension_prefs.h" | 16 #include "extensions/browser/extension_prefs.h" |
| 17 #include "extensions/browser/extension_registry.h" | 17 #include "extensions/browser/extension_registry.h" |
| 18 #include "extensions/common/extension.h" | 18 #include "extensions/common/extension.h" |
| 19 #include "extensions/common/extension_set.h" | 19 #include "extensions/common/extension_set.h" |
| 20 | 20 |
| 21 #if defined(OS_WIN) | |
| 22 #include "win8/util/win8_util.h" | |
| 23 #endif | |
| 24 | |
| 25 using extensions::Extension; | 21 using extensions::Extension; |
| 26 using extensions::ExtensionHost; | 22 using extensions::ExtensionHost; |
| 27 using extensions::ExtensionPrefs; | 23 using extensions::ExtensionPrefs; |
| 28 using extensions::ExtensionRegistry; | 24 using extensions::ExtensionRegistry; |
| 29 | 25 |
| 30 namespace apps { | 26 namespace apps { |
| 31 | 27 |
| 32 // static | 28 // static |
| 33 bool AppRestoreService::ShouldRestoreApps(bool is_browser_restart) { | 29 bool AppRestoreService::ShouldRestoreApps(bool is_browser_restart) { |
| 34 bool should_restore_apps = is_browser_restart; | 30 bool should_restore_apps = is_browser_restart; |
| 35 #if defined(OS_CHROMEOS) | 31 #if defined(OS_CHROMEOS) |
| 36 // Chromeos always restarts apps, even if it was a regular shutdown. | 32 // Chromeos always restarts apps, even if it was a regular shutdown. |
| 37 should_restore_apps = true; | 33 should_restore_apps = true; |
| 38 #elif defined(OS_WIN) | |
| 39 // Packaged apps are not supported in Metro mode, so don't try to start them. | |
| 40 if (win8::IsSingleWindowMetroMode()) | |
| 41 should_restore_apps = false; | |
| 42 #endif | 34 #endif |
| 43 return should_restore_apps; | 35 return should_restore_apps; |
| 44 } | 36 } |
| 45 | 37 |
| 46 AppRestoreService::AppRestoreService(Profile* profile) | 38 AppRestoreService::AppRestoreService(Profile* profile) |
| 47 : profile_(profile) { | 39 : profile_(profile) { |
| 48 StartObservingAppLifetime(); | 40 StartObservingAppLifetime(); |
| 49 } | 41 } |
| 50 | 42 |
| 51 void AppRestoreService::HandleStartup(bool should_restore_apps) { | 43 void AppRestoreService::HandleStartup(bool should_restore_apps) { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 | 134 |
| 143 void AppRestoreService::StopObservingAppLifetime() { | 135 void AppRestoreService::StopObservingAppLifetime() { |
| 144 AppLifetimeMonitor* app_lifetime_monitor = | 136 AppLifetimeMonitor* app_lifetime_monitor = |
| 145 AppLifetimeMonitorFactory::GetForProfile(profile_); | 137 AppLifetimeMonitorFactory::GetForProfile(profile_); |
| 146 // This might be NULL in tests. | 138 // This might be NULL in tests. |
| 147 if (app_lifetime_monitor) | 139 if (app_lifetime_monitor) |
| 148 app_lifetime_monitor->RemoveObserver(this); | 140 app_lifetime_monitor->RemoveObserver(this); |
| 149 } | 141 } |
| 150 | 142 |
| 151 } // namespace apps | 143 } // namespace apps |
| OLD | NEW |