| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_APP_RESTORE_SERVICE_H_ | |
| 6 #define CHROME_BROWSER_EXTENSIONS_APP_RESTORE_SERVICE_H_ | |
| 7 | |
| 8 #include "chrome/browser/profiles/profile_keyed_service.h" | |
| 9 #include "content/public/browser/notification_observer.h" | |
| 10 #include "content/public/browser/notification_registrar.h" | |
| 11 | |
| 12 #include <string> | |
| 13 | |
| 14 class Profile; | |
| 15 | |
| 16 namespace extensions { | |
| 17 | |
| 18 class Extension; | |
| 19 | |
| 20 // Tracks what apps need to be restarted when the browser restarts. | |
| 21 class AppRestoreService : public ProfileKeyedService, | |
| 22 public content::NotificationObserver { | |
| 23 public: | |
| 24 explicit AppRestoreService(Profile* profile); | |
| 25 | |
| 26 // Restart apps that need to be restarted and clear the "running" preference | |
| 27 // from apps to prevent them being restarted in subsequent restarts. | |
| 28 void HandleStartup(bool should_restore_apps); | |
| 29 | |
| 30 private: | |
| 31 // content::NotificationObserver. | |
| 32 virtual void Observe(int type, | |
| 33 const content::NotificationSource& source, | |
| 34 const content::NotificationDetails& details) OVERRIDE; | |
| 35 | |
| 36 void RecordAppStart(const std::string& extension_id); | |
| 37 void RecordAppStop(const std::string& extension_id); | |
| 38 void RestoreApp(const Extension* extension); | |
| 39 | |
| 40 content::NotificationRegistrar registrar_; | |
| 41 Profile* profile_; | |
| 42 }; | |
| 43 | |
| 44 } // namespace extensions | |
| 45 | |
| 46 #endif // CHROME_BROWSER_EXTENSIONS_APP_RESTORE_SERVICE_H_ | |
| OLD | NEW |