| 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> | 8 #include <string> |
| 9 | 9 |
| 10 #include "chrome/browser/extensions/chrome_extension_function.h" | 10 #include "chrome/browser/extensions/chrome_extension_function.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 const std::string& extension_id); | 122 const std::string& extension_id); |
| 123 }; | 123 }; |
| 124 | 124 |
| 125 class RuntimeGetBackgroundPageFunction : public ChromeAsyncExtensionFunction { | 125 class RuntimeGetBackgroundPageFunction : public ChromeAsyncExtensionFunction { |
| 126 public: | 126 public: |
| 127 DECLARE_EXTENSION_FUNCTION("runtime.getBackgroundPage", | 127 DECLARE_EXTENSION_FUNCTION("runtime.getBackgroundPage", |
| 128 RUNTIME_GETBACKGROUNDPAGE) | 128 RUNTIME_GETBACKGROUNDPAGE) |
| 129 | 129 |
| 130 protected: | 130 protected: |
| 131 virtual ~RuntimeGetBackgroundPageFunction() {} | 131 virtual ~RuntimeGetBackgroundPageFunction() {} |
| 132 virtual bool RunImpl() OVERRIDE; | 132 virtual bool RunSync() OVERRIDE; |
| 133 | 133 |
| 134 private: | 134 private: |
| 135 void OnPageLoaded(ExtensionHost*); | 135 void OnPageLoaded(ExtensionHost*); |
| 136 }; | 136 }; |
| 137 | 137 |
| 138 class RuntimeSetUninstallURLFunction : public ChromeSyncExtensionFunction { | 138 class RuntimeSetUninstallURLFunction : public ChromeSyncExtensionFunction { |
| 139 public: | 139 public: |
| 140 DECLARE_EXTENSION_FUNCTION("runtime.setUninstallURL", | 140 DECLARE_EXTENSION_FUNCTION("runtime.setUninstallURL", |
| 141 RUNTIME_SETUNINSTALLURL) | 141 RUNTIME_SETUNINSTALLURL) |
| 142 | 142 |
| 143 protected: | 143 protected: |
| 144 virtual ~RuntimeSetUninstallURLFunction() {} | 144 virtual ~RuntimeSetUninstallURLFunction() {} |
| 145 virtual bool RunImpl() OVERRIDE; | 145 virtual bool RunSync() OVERRIDE; |
| 146 }; | 146 }; |
| 147 | 147 |
| 148 class RuntimeReloadFunction : public ChromeSyncExtensionFunction { | 148 class RuntimeReloadFunction : public ChromeSyncExtensionFunction { |
| 149 public: | 149 public: |
| 150 DECLARE_EXTENSION_FUNCTION("runtime.reload", RUNTIME_RELOAD) | 150 DECLARE_EXTENSION_FUNCTION("runtime.reload", RUNTIME_RELOAD) |
| 151 | 151 |
| 152 protected: | 152 protected: |
| 153 virtual ~RuntimeReloadFunction() {} | 153 virtual ~RuntimeReloadFunction() {} |
| 154 virtual bool RunImpl() OVERRIDE; | 154 virtual bool RunSync() OVERRIDE; |
| 155 }; | 155 }; |
| 156 | 156 |
| 157 class RuntimeRequestUpdateCheckFunction : public ChromeAsyncExtensionFunction, | 157 class RuntimeRequestUpdateCheckFunction : public ChromeAsyncExtensionFunction, |
| 158 public content::NotificationObserver { | 158 public content::NotificationObserver { |
| 159 public: | 159 public: |
| 160 DECLARE_EXTENSION_FUNCTION("runtime.requestUpdateCheck", | 160 DECLARE_EXTENSION_FUNCTION("runtime.requestUpdateCheck", |
| 161 RUNTIME_REQUESTUPDATECHECK) | 161 RUNTIME_REQUESTUPDATECHECK) |
| 162 | 162 |
| 163 RuntimeRequestUpdateCheckFunction(); | 163 RuntimeRequestUpdateCheckFunction(); |
| 164 protected: | 164 protected: |
| 165 virtual ~RuntimeRequestUpdateCheckFunction() {} | 165 virtual ~RuntimeRequestUpdateCheckFunction() {} |
| 166 virtual bool RunImpl() OVERRIDE; | 166 virtual bool RunSync() OVERRIDE; |
| 167 | 167 |
| 168 // Implements content::NotificationObserver interface. | 168 // Implements content::NotificationObserver interface. |
| 169 virtual void Observe(int type, | 169 virtual void Observe(int type, |
| 170 const content::NotificationSource& source, | 170 const content::NotificationSource& source, |
| 171 const content::NotificationDetails& details) OVERRIDE; | 171 const content::NotificationDetails& details) OVERRIDE; |
| 172 private: | 172 private: |
| 173 void CheckComplete(); | 173 void CheckComplete(); |
| 174 void ReplyUpdateFound(const std::string& version); | 174 void ReplyUpdateFound(const std::string& version); |
| 175 | 175 |
| 176 content::NotificationRegistrar registrar_; | 176 content::NotificationRegistrar registrar_; |
| 177 bool did_reply_; | 177 bool did_reply_; |
| 178 }; | 178 }; |
| 179 | 179 |
| 180 class RuntimeRestartFunction : public ChromeSyncExtensionFunction { | 180 class RuntimeRestartFunction : public ChromeSyncExtensionFunction { |
| 181 public: | 181 public: |
| 182 DECLARE_EXTENSION_FUNCTION("runtime.restart", RUNTIME_RESTART) | 182 DECLARE_EXTENSION_FUNCTION("runtime.restart", RUNTIME_RESTART) |
| 183 | 183 |
| 184 protected: | 184 protected: |
| 185 virtual ~RuntimeRestartFunction() {} | 185 virtual ~RuntimeRestartFunction() {} |
| 186 virtual bool RunImpl() OVERRIDE; | 186 virtual bool RunSync() OVERRIDE; |
| 187 }; | 187 }; |
| 188 | 188 |
| 189 class RuntimeGetPlatformInfoFunction : public ChromeSyncExtensionFunction { | 189 class RuntimeGetPlatformInfoFunction : public ChromeSyncExtensionFunction { |
| 190 public: | 190 public: |
| 191 DECLARE_EXTENSION_FUNCTION("runtime.getPlatformInfo", | 191 DECLARE_EXTENSION_FUNCTION("runtime.getPlatformInfo", |
| 192 RUNTIME_GETPLATFORMINFO); | 192 RUNTIME_GETPLATFORMINFO); |
| 193 protected: | 193 protected: |
| 194 virtual ~RuntimeGetPlatformInfoFunction() {} | 194 virtual ~RuntimeGetPlatformInfoFunction() {} |
| 195 virtual bool RunImpl() OVERRIDE; | 195 virtual bool RunSync() OVERRIDE; |
| 196 }; | 196 }; |
| 197 | 197 |
| 198 class RuntimeGetPackageDirectoryEntryFunction | 198 class RuntimeGetPackageDirectoryEntryFunction |
| 199 : public ChromeSyncExtensionFunction { | 199 : public ChromeSyncExtensionFunction { |
| 200 public: | 200 public: |
| 201 DECLARE_EXTENSION_FUNCTION("runtime.getPackageDirectoryEntry", | 201 DECLARE_EXTENSION_FUNCTION("runtime.getPackageDirectoryEntry", |
| 202 RUNTIME_GETPACKAGEDIRECTORYENTRY) | 202 RUNTIME_GETPACKAGEDIRECTORYENTRY) |
| 203 | 203 |
| 204 protected: | 204 protected: |
| 205 virtual ~RuntimeGetPackageDirectoryEntryFunction() {} | 205 virtual ~RuntimeGetPackageDirectoryEntryFunction() {} |
| 206 virtual bool RunImpl() OVERRIDE; | 206 virtual bool RunSync() OVERRIDE; |
| 207 }; | 207 }; |
| 208 | 208 |
| 209 } // namespace extensions | 209 } // namespace extensions |
| 210 | 210 |
| 211 #endif // CHROME_BROWSER_EXTENSIONS_API_RUNTIME_RUNTIME_API_H_ | 211 #endif // CHROME_BROWSER_EXTENSIONS_API_RUNTIME_RUNTIME_API_H_ |
| OLD | NEW |