| 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 #ifndef CHROME_BROWSER_EXTENSIONS_API_RUNTIME_RUNTIME_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_RUNTIME_RUNTIME_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_RUNTIME_RUNTIME_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_RUNTIME_RUNTIME_API_H_ |
| 7 | 7 |
| 8 #include <string> |
| 9 |
| 8 #include "chrome/browser/extensions/extension_function.h" | 10 #include "chrome/browser/extensions/extension_function.h" |
| 9 #include "content/public/browser/notification_observer.h" | 11 #include "content/public/browser/notification_observer.h" |
| 10 #include "content/public/browser/notification_registrar.h" | 12 #include "content/public/browser/notification_registrar.h" |
| 11 | 13 |
| 12 class Profile; | 14 class Profile; |
| 13 | 15 |
| 14 namespace base { | 16 namespace base { |
| 15 class Version; | 17 class Version; |
| 16 } | 18 } |
| 17 | 19 |
| 18 namespace extensions { | 20 namespace extensions { |
| 19 class Extension; | 21 class Extension; |
| 20 class ExtensionHost; | 22 class ExtensionHost; |
| 21 | 23 |
| 22 class RuntimeEventRouter { | 24 class RuntimeEventRouter { |
| 23 public: | 25 public: |
| 26 enum RestartReason { |
| 27 RESTART_REASON_APP_UPDATE, |
| 28 RESTART_REASON_OS_UPDATE, |
| 29 RESTART_REASON_PERIODIC, |
| 30 }; |
| 31 |
| 24 // Dispatches the onStartup event to all currently-loaded extensions. | 32 // Dispatches the onStartup event to all currently-loaded extensions. |
| 25 static void DispatchOnStartupEvent(Profile* profile, | 33 static void DispatchOnStartupEvent(Profile* profile, |
| 26 const std::string& extension_id); | 34 const std::string& extension_id); |
| 27 | 35 |
| 28 // Dispatches the onInstalled event to the given extension. | 36 // Dispatches the onInstalled event to the given extension. |
| 29 static void DispatchOnInstalledEvent(Profile* profile, | 37 static void DispatchOnInstalledEvent(Profile* profile, |
| 30 const std::string& extension_id, | 38 const std::string& extension_id, |
| 31 const base::Version& old_version, | 39 const base::Version& old_version, |
| 32 bool chrome_updated); | 40 bool chrome_updated); |
| 33 | 41 |
| 34 // Dispatches the onUpdateAvailable event to the given extension. | 42 // Dispatches the onUpdateAvailable event to the given extension. |
| 35 static void DispatchOnUpdateAvailableEvent( | 43 static void DispatchOnUpdateAvailableEvent( |
| 36 Profile* profile, | 44 Profile* profile, |
| 37 const std::string& extension_id, | 45 const std::string& extension_id, |
| 38 const base::DictionaryValue* manifest); | 46 const base::DictionaryValue* manifest); |
| 39 | 47 |
| 40 // Dispatches the onBrowserUpdateAvailable event to all extensions. | 48 // Dispatches the onBrowserUpdateAvailable event to all extensions. |
| 41 static void DispatchOnBrowserUpdateAvailableEvent(Profile* profile); | 49 static void DispatchOnBrowserUpdateAvailableEvent(Profile* profile); |
| 42 | 50 |
| 51 // Dispatches the onRestartRequired event to the given app. |
| 52 static void DispatchOnRestartRequiredEvent(Profile* profile, |
| 53 const std::string& app_id, |
| 54 RestartReason reason); |
| 55 |
| 43 // Does any work needed at extension uninstall (e.g. load uninstall url). | 56 // Does any work needed at extension uninstall (e.g. load uninstall url). |
| 44 static void OnExtensionUninstalled(Profile* profile, | 57 static void OnExtensionUninstalled(Profile* profile, |
| 45 const std::string& extension_id); | 58 const std::string& extension_id); |
| 46 }; | 59 }; |
| 47 | 60 |
| 48 class RuntimeGetBackgroundPageFunction : public AsyncExtensionFunction { | 61 class RuntimeGetBackgroundPageFunction : public AsyncExtensionFunction { |
| 49 public: | 62 public: |
| 50 DECLARE_EXTENSION_FUNCTION("runtime.getBackgroundPage", | 63 DECLARE_EXTENSION_FUNCTION("runtime.getBackgroundPage", |
| 51 RUNTIME_GETBACKGROUNDPAGE) | 64 RUNTIME_GETBACKGROUNDPAGE) |
| 52 | 65 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 DECLARE_EXTENSION_FUNCTION("runtime.getPlatformInfo", | 118 DECLARE_EXTENSION_FUNCTION("runtime.getPlatformInfo", |
| 106 RUNTIME_GETPLATFORMINFO); | 119 RUNTIME_GETPLATFORMINFO); |
| 107 protected: | 120 protected: |
| 108 virtual ~RuntimeGetPlatformInfoFunction() {} | 121 virtual ~RuntimeGetPlatformInfoFunction() {} |
| 109 virtual bool RunImpl() OVERRIDE; | 122 virtual bool RunImpl() OVERRIDE; |
| 110 }; | 123 }; |
| 111 | 124 |
| 112 } // namespace extensions | 125 } // namespace extensions |
| 113 | 126 |
| 114 #endif // CHROME_BROWSER_EXTENSIONS_API_RUNTIME_RUNTIME_API_H_ | 127 #endif // CHROME_BROWSER_EXTENSIONS_API_RUNTIME_RUNTIME_API_H_ |
| OLD | NEW |