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 EXTENSIONS_BROWSER_API_RUNTIME_RUNTIME_API_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_RUNTIME_RUNTIME_API_H_ |
6 #define EXTENSIONS_BROWSER_API_RUNTIME_RUNTIME_API_H_ | 6 #define EXTENSIONS_BROWSER_API_RUNTIME_RUNTIME_API_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/scoped_observer.h" | 10 #include "base/scoped_observer.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 public ProcessManagerObserver { | 48 public ProcessManagerObserver { |
49 public: | 49 public: |
50 static BrowserContextKeyedAPIFactory<RuntimeAPI>* GetFactoryInstance(); | 50 static BrowserContextKeyedAPIFactory<RuntimeAPI>* GetFactoryInstance(); |
51 | 51 |
52 explicit RuntimeAPI(content::BrowserContext* context); | 52 explicit RuntimeAPI(content::BrowserContext* context); |
53 virtual ~RuntimeAPI(); | 53 virtual ~RuntimeAPI(); |
54 | 54 |
55 // content::NotificationObserver overrides: | 55 // content::NotificationObserver overrides: |
56 virtual void Observe(int type, | 56 virtual void Observe(int type, |
57 const content::NotificationSource& source, | 57 const content::NotificationSource& source, |
58 const content::NotificationDetails& details) OVERRIDE; | 58 const content::NotificationDetails& details) override; |
59 | 59 |
60 void ReloadExtension(const std::string& extension_id); | 60 void ReloadExtension(const std::string& extension_id); |
61 bool CheckForUpdates(const std::string& extension_id, | 61 bool CheckForUpdates(const std::string& extension_id, |
62 const RuntimeAPIDelegate::UpdateCheckCallback& callback); | 62 const RuntimeAPIDelegate::UpdateCheckCallback& callback); |
63 void OpenURL(const GURL& uninstall_url); | 63 void OpenURL(const GURL& uninstall_url); |
64 bool GetPlatformInfo(core_api::runtime::PlatformInfo* info); | 64 bool GetPlatformInfo(core_api::runtime::PlatformInfo* info); |
65 bool RestartDevice(std::string* error_message); | 65 bool RestartDevice(std::string* error_message); |
66 | 66 |
67 private: | 67 private: |
68 friend class BrowserContextKeyedAPIFactory<RuntimeAPI>; | 68 friend class BrowserContextKeyedAPIFactory<RuntimeAPI>; |
69 | 69 |
70 // ExtensionRegistryObserver implementation. | 70 // ExtensionRegistryObserver implementation. |
71 virtual void OnExtensionLoaded(content::BrowserContext* browser_context, | 71 virtual void OnExtensionLoaded(content::BrowserContext* browser_context, |
72 const Extension* extension) OVERRIDE; | 72 const Extension* extension) override; |
73 virtual void OnExtensionWillBeInstalled( | 73 virtual void OnExtensionWillBeInstalled( |
74 content::BrowserContext* browser_context, | 74 content::BrowserContext* browser_context, |
75 const Extension* extension, | 75 const Extension* extension, |
76 bool is_update, | 76 bool is_update, |
77 bool from_ephemeral, | 77 bool from_ephemeral, |
78 const std::string& old_name) OVERRIDE; | 78 const std::string& old_name) override; |
79 virtual void OnExtensionUninstalled(content::BrowserContext* browser_context, | 79 virtual void OnExtensionUninstalled(content::BrowserContext* browser_context, |
80 const Extension* extension, | 80 const Extension* extension, |
81 UninstallReason reason) OVERRIDE; | 81 UninstallReason reason) override; |
82 | 82 |
83 // BrowserContextKeyedAPI implementation: | 83 // BrowserContextKeyedAPI implementation: |
84 static const char* service_name() { return "RuntimeAPI"; } | 84 static const char* service_name() { return "RuntimeAPI"; } |
85 static const bool kServiceRedirectedInIncognito = true; | 85 static const bool kServiceRedirectedInIncognito = true; |
86 static const bool kServiceIsNULLWhileTesting = true; | 86 static const bool kServiceIsNULLWhileTesting = true; |
87 virtual void Shutdown() OVERRIDE; | 87 virtual void Shutdown() override; |
88 | 88 |
89 // extensions::UpdateObserver overrides: | 89 // extensions::UpdateObserver overrides: |
90 virtual void OnAppUpdateAvailable(const Extension* extension) OVERRIDE; | 90 virtual void OnAppUpdateAvailable(const Extension* extension) override; |
91 virtual void OnChromeUpdateAvailable() OVERRIDE; | 91 virtual void OnChromeUpdateAvailable() override; |
92 | 92 |
93 // ProcessManagerObserver implementation: | 93 // ProcessManagerObserver implementation: |
94 virtual void OnBackgroundHostStartup(const Extension* extension) OVERRIDE; | 94 virtual void OnBackgroundHostStartup(const Extension* extension) override; |
95 | 95 |
96 scoped_ptr<RuntimeAPIDelegate> delegate_; | 96 scoped_ptr<RuntimeAPIDelegate> delegate_; |
97 | 97 |
98 content::BrowserContext* browser_context_; | 98 content::BrowserContext* browser_context_; |
99 | 99 |
100 // True if we should dispatch the chrome.runtime.onInstalled event with | 100 // True if we should dispatch the chrome.runtime.onInstalled event with |
101 // reason "chrome_update" upon loading each extension. | 101 // reason "chrome_update" upon loading each extension. |
102 bool dispatch_chrome_updated_event_; | 102 bool dispatch_chrome_updated_event_; |
103 | 103 |
104 content::NotificationRegistrar registrar_; | 104 content::NotificationRegistrar registrar_; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 UninstallReason reason); | 144 UninstallReason reason); |
145 }; | 145 }; |
146 | 146 |
147 class RuntimeGetBackgroundPageFunction : public UIThreadExtensionFunction { | 147 class RuntimeGetBackgroundPageFunction : public UIThreadExtensionFunction { |
148 public: | 148 public: |
149 DECLARE_EXTENSION_FUNCTION("runtime.getBackgroundPage", | 149 DECLARE_EXTENSION_FUNCTION("runtime.getBackgroundPage", |
150 RUNTIME_GETBACKGROUNDPAGE) | 150 RUNTIME_GETBACKGROUNDPAGE) |
151 | 151 |
152 protected: | 152 protected: |
153 virtual ~RuntimeGetBackgroundPageFunction() {} | 153 virtual ~RuntimeGetBackgroundPageFunction() {} |
154 virtual ResponseAction Run() OVERRIDE; | 154 virtual ResponseAction Run() override; |
155 | 155 |
156 private: | 156 private: |
157 void OnPageLoaded(ExtensionHost*); | 157 void OnPageLoaded(ExtensionHost*); |
158 }; | 158 }; |
159 | 159 |
160 class RuntimeSetUninstallURLFunction : public UIThreadExtensionFunction { | 160 class RuntimeSetUninstallURLFunction : public UIThreadExtensionFunction { |
161 public: | 161 public: |
162 DECLARE_EXTENSION_FUNCTION("runtime.setUninstallURL", RUNTIME_SETUNINSTALLURL) | 162 DECLARE_EXTENSION_FUNCTION("runtime.setUninstallURL", RUNTIME_SETUNINSTALLURL) |
163 | 163 |
164 protected: | 164 protected: |
165 virtual ~RuntimeSetUninstallURLFunction() {} | 165 virtual ~RuntimeSetUninstallURLFunction() {} |
166 virtual ResponseAction Run() OVERRIDE; | 166 virtual ResponseAction Run() override; |
167 }; | 167 }; |
168 | 168 |
169 class RuntimeReloadFunction : public UIThreadExtensionFunction { | 169 class RuntimeReloadFunction : public UIThreadExtensionFunction { |
170 public: | 170 public: |
171 DECLARE_EXTENSION_FUNCTION("runtime.reload", RUNTIME_RELOAD) | 171 DECLARE_EXTENSION_FUNCTION("runtime.reload", RUNTIME_RELOAD) |
172 | 172 |
173 protected: | 173 protected: |
174 virtual ~RuntimeReloadFunction() {} | 174 virtual ~RuntimeReloadFunction() {} |
175 virtual ResponseAction Run() OVERRIDE; | 175 virtual ResponseAction Run() override; |
176 }; | 176 }; |
177 | 177 |
178 class RuntimeRequestUpdateCheckFunction : public UIThreadExtensionFunction { | 178 class RuntimeRequestUpdateCheckFunction : public UIThreadExtensionFunction { |
179 public: | 179 public: |
180 DECLARE_EXTENSION_FUNCTION("runtime.requestUpdateCheck", | 180 DECLARE_EXTENSION_FUNCTION("runtime.requestUpdateCheck", |
181 RUNTIME_REQUESTUPDATECHECK) | 181 RUNTIME_REQUESTUPDATECHECK) |
182 | 182 |
183 protected: | 183 protected: |
184 virtual ~RuntimeRequestUpdateCheckFunction() {} | 184 virtual ~RuntimeRequestUpdateCheckFunction() {} |
185 virtual ResponseAction Run() OVERRIDE; | 185 virtual ResponseAction Run() override; |
186 | 186 |
187 private: | 187 private: |
188 void CheckComplete(const RuntimeAPIDelegate::UpdateCheckResult& result); | 188 void CheckComplete(const RuntimeAPIDelegate::UpdateCheckResult& result); |
189 }; | 189 }; |
190 | 190 |
191 class RuntimeRestartFunction : public UIThreadExtensionFunction { | 191 class RuntimeRestartFunction : public UIThreadExtensionFunction { |
192 public: | 192 public: |
193 DECLARE_EXTENSION_FUNCTION("runtime.restart", RUNTIME_RESTART) | 193 DECLARE_EXTENSION_FUNCTION("runtime.restart", RUNTIME_RESTART) |
194 | 194 |
195 protected: | 195 protected: |
196 virtual ~RuntimeRestartFunction() {} | 196 virtual ~RuntimeRestartFunction() {} |
197 virtual ResponseAction Run() OVERRIDE; | 197 virtual ResponseAction Run() override; |
198 }; | 198 }; |
199 | 199 |
200 class RuntimeGetPlatformInfoFunction : public UIThreadExtensionFunction { | 200 class RuntimeGetPlatformInfoFunction : public UIThreadExtensionFunction { |
201 public: | 201 public: |
202 DECLARE_EXTENSION_FUNCTION("runtime.getPlatformInfo", | 202 DECLARE_EXTENSION_FUNCTION("runtime.getPlatformInfo", |
203 RUNTIME_GETPLATFORMINFO); | 203 RUNTIME_GETPLATFORMINFO); |
204 | 204 |
205 protected: | 205 protected: |
206 virtual ~RuntimeGetPlatformInfoFunction() {} | 206 virtual ~RuntimeGetPlatformInfoFunction() {} |
207 virtual ResponseAction Run() OVERRIDE; | 207 virtual ResponseAction Run() override; |
208 }; | 208 }; |
209 | 209 |
210 class RuntimeGetPackageDirectoryEntryFunction | 210 class RuntimeGetPackageDirectoryEntryFunction |
211 : public UIThreadExtensionFunction { | 211 : public UIThreadExtensionFunction { |
212 public: | 212 public: |
213 DECLARE_EXTENSION_FUNCTION("runtime.getPackageDirectoryEntry", | 213 DECLARE_EXTENSION_FUNCTION("runtime.getPackageDirectoryEntry", |
214 RUNTIME_GETPACKAGEDIRECTORYENTRY) | 214 RUNTIME_GETPACKAGEDIRECTORYENTRY) |
215 | 215 |
216 protected: | 216 protected: |
217 virtual ~RuntimeGetPackageDirectoryEntryFunction() {} | 217 virtual ~RuntimeGetPackageDirectoryEntryFunction() {} |
218 virtual ResponseAction Run() OVERRIDE; | 218 virtual ResponseAction Run() override; |
219 }; | 219 }; |
220 | 220 |
221 } // namespace extensions | 221 } // namespace extensions |
222 | 222 |
223 #endif // EXTENSIONS_BROWSER_API_RUNTIME_RUNTIME_API_H_ | 223 #endif // EXTENSIONS_BROWSER_API_RUNTIME_RUNTIME_API_H_ |
OLD | NEW |