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/launcher.h" | 9 #include "apps/launcher.h" |
10 #include "apps/saved_files_service.h" | 10 #include "apps/saved_files_service_impl.h" |
11 #include "content/public/browser/browser_context.h" | 11 #include "content/public/browser/browser_context.h" |
12 #include "extensions/browser/app_window/app_window.h" | 12 #include "extensions/browser/app_window/app_window.h" |
13 #include "extensions/browser/extension_host.h" | 13 #include "extensions/browser/extension_host.h" |
14 #include "extensions/browser/extension_prefs.h" | 14 #include "extensions/browser/extension_prefs.h" |
15 #include "extensions/browser/extension_registry.h" | 15 #include "extensions/browser/extension_registry.h" |
16 #include "extensions/common/extension.h" | 16 #include "extensions/common/extension.h" |
17 #include "extensions/common/extension_set.h" | 17 #include "extensions/common/extension_set.h" |
18 | 18 |
19 using extensions::Extension; | 19 using extensions::Extension; |
20 using extensions::ExtensionHost; | 20 using extensions::ExtensionHost; |
(...skipping 26 matching lines...) Expand all Loading... |
47 it != extensions.end(); ++it) { | 47 it != extensions.end(); ++it) { |
48 const Extension* extension = it->get(); | 48 const Extension* extension = it->get(); |
49 if (extension_prefs->IsExtensionRunning(extension->id())) { | 49 if (extension_prefs->IsExtensionRunning(extension->id())) { |
50 RecordAppStop(extension->id()); | 50 RecordAppStop(extension->id()); |
51 // If we are not restoring apps (e.g., because it is a clean restart), and | 51 // If we are not restoring apps (e.g., because it is a clean restart), and |
52 // the app does not have retain permission, explicitly clear the retained | 52 // the app does not have retain permission, explicitly clear the retained |
53 // entries queue. | 53 // entries queue. |
54 if (should_restore_apps) { | 54 if (should_restore_apps) { |
55 RestoreApp(it->get()); | 55 RestoreApp(it->get()); |
56 } else { | 56 } else { |
57 SavedFilesService::Get(context_)->ClearQueueIfNoRetainPermission( | 57 SavedFilesServiceImpl::Get(context_)->ClearQueueIfNoRetainPermission( |
58 extension); | 58 extension); |
59 } | 59 } |
60 } | 60 } |
61 } | 61 } |
62 } | 62 } |
63 | 63 |
64 bool AppRestoreService::IsAppRestorable(const std::string& extension_id) { | 64 bool AppRestoreService::IsAppRestorable(const std::string& extension_id) { |
65 return ExtensionPrefs::Get(context_)->IsExtensionRunning(extension_id); | 65 return ExtensionPrefs::Get(context_)->IsExtensionRunning(extension_id); |
66 } | 66 } |
67 | 67 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 133 |
134 void AppRestoreService::StopObservingAppLifetime() { | 134 void AppRestoreService::StopObservingAppLifetime() { |
135 AppLifetimeMonitor* app_lifetime_monitor = | 135 AppLifetimeMonitor* app_lifetime_monitor = |
136 AppLifetimeMonitorFactory::GetForBrowserContext(context_); | 136 AppLifetimeMonitorFactory::GetForBrowserContext(context_); |
137 // This might be NULL in tests. | 137 // This might be NULL in tests. |
138 if (app_lifetime_monitor) | 138 if (app_lifetime_monitor) |
139 app_lifetime_monitor->RemoveObserver(this); | 139 app_lifetime_monitor->RemoveObserver(this); |
140 } | 140 } |
141 | 141 |
142 } // namespace apps | 142 } // namespace apps |
OLD | NEW |