| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CHROME_BROWSER_EXTENSIONS_API_RUNTIME_CHROME_RUNTIME_API_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_RUNTIME_CHROME_RUNTIME_API_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_RUNTIME_CHROME_RUNTIME_API_DELEGATE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_RUNTIME_CHROME_RUNTIME_API_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 void RemoveUpdateObserver(extensions::UpdateObserver* observer) override; | 52 void RemoveUpdateObserver(extensions::UpdateObserver* observer) override; |
| 53 base::Version GetPreviousExtensionVersion( | 53 base::Version GetPreviousExtensionVersion( |
| 54 const extensions::Extension* extension) override; | 54 const extensions::Extension* extension) override; |
| 55 void ReloadExtension(const std::string& extension_id) override; | 55 void ReloadExtension(const std::string& extension_id) override; |
| 56 bool CheckForUpdates(const std::string& extension_id, | 56 bool CheckForUpdates(const std::string& extension_id, |
| 57 const UpdateCheckCallback& callback) override; | 57 const UpdateCheckCallback& callback) override; |
| 58 void OpenURL(const GURL& uninstall_url) override; | 58 void OpenURL(const GURL& uninstall_url) override; |
| 59 bool GetPlatformInfo(extensions::api::runtime::PlatformInfo* info) override; | 59 bool GetPlatformInfo(extensions::api::runtime::PlatformInfo* info) override; |
| 60 bool RestartDevice(std::string* error_message) override; | 60 bool RestartDevice(std::string* error_message) override; |
| 61 bool OpenOptionsPage(const extensions::Extension* extension) override; | 61 bool OpenOptionsPage(const extensions::Extension* extension) override; |
| 62 void SetOnDeviceShutdownCallback(const base::Closure& callback) override; |
| 62 | 63 |
| 63 // content::NotificationObserver implementation. | 64 // content::NotificationObserver implementation. |
| 64 void Observe(int type, | 65 void Observe(int type, |
| 65 const content::NotificationSource& source, | 66 const content::NotificationSource& source, |
| 66 const content::NotificationDetails& details) override; | 67 const content::NotificationDetails& details) override; |
| 67 | 68 |
| 68 // ExtensionRegistryObserver implementation. | 69 // ExtensionRegistryObserver implementation. |
| 69 void OnExtensionInstalled(content::BrowserContext* browser_context, | 70 void OnExtensionInstalled(content::BrowserContext* browser_context, |
| 70 const extensions::Extension* extension, | 71 const extensions::Extension* extension, |
| 71 bool is_update) override; | 72 bool is_update) override; |
| 72 | 73 |
| 73 void UpdateCheckComplete(const std::string& extension_id); | 74 void UpdateCheckComplete(const std::string& extension_id); |
| 74 void CallUpdateCallbacks(const std::string& extension_id, | 75 void CallUpdateCallbacks(const std::string& extension_id, |
| 75 const UpdateCheckResult& result); | 76 const UpdateCheckResult& result); |
| 76 | 77 |
| 77 content::BrowserContext* browser_context_; | 78 content::BrowserContext* browser_context_; |
| 78 | 79 |
| 79 content::NotificationRegistrar registrar_; | 80 content::NotificationRegistrar registrar_; |
| 80 | 81 |
| 82 base::Closure on_device_shutdown_callback_; |
| 83 |
| 81 // Whether the API registered with the ExtensionService to receive | 84 // Whether the API registered with the ExtensionService to receive |
| 82 // update notifications. | 85 // update notifications. |
| 83 bool registered_for_updates_; | 86 bool registered_for_updates_; |
| 84 | 87 |
| 85 // Map to prevent extensions from getting stuck in reload loops. Maps | 88 // Map to prevent extensions from getting stuck in reload loops. Maps |
| 86 // extension id to the last time it was reloaded and the number of times | 89 // extension id to the last time it was reloaded and the number of times |
| 87 // it was reloaded with not enough time in between reloads. | 90 // it was reloaded with not enough time in between reloads. |
| 88 std::map<std::string, std::pair<base::TimeTicks, int> > last_reload_time_; | 91 std::map<std::string, std::pair<base::TimeTicks, int> > last_reload_time_; |
| 89 | 92 |
| 90 // Information about update checks, keyed by extension id. | 93 // Information about update checks, keyed by extension id. |
| 91 struct UpdateCheckInfo; | 94 struct UpdateCheckInfo; |
| 92 std::map<std::string, UpdateCheckInfo> update_check_info_; | 95 std::map<std::string, UpdateCheckInfo> update_check_info_; |
| 93 | 96 |
| 94 ScopedObserver<extensions::ExtensionRegistry, | 97 ScopedObserver<extensions::ExtensionRegistry, |
| 95 extensions::ExtensionRegistryObserver> | 98 extensions::ExtensionRegistryObserver> |
| 96 extension_registry_observer_; | 99 extension_registry_observer_; |
| 97 | 100 |
| 98 DISALLOW_COPY_AND_ASSIGN(ChromeRuntimeAPIDelegate); | 101 DISALLOW_COPY_AND_ASSIGN(ChromeRuntimeAPIDelegate); |
| 99 }; | 102 }; |
| 100 | 103 |
| 101 #endif // CHROME_BROWSER_EXTENSIONS_API_RUNTIME_CHROME_RUNTIME_API_DELEGATE_H_ | 104 #endif // CHROME_BROWSER_EXTENSIONS_API_RUNTIME_CHROME_RUNTIME_API_DELEGATE_H_ |
| OLD | NEW |