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 11 matching lines...) Expand all Loading... |
22 namespace base { | 22 namespace base { |
23 class Version; | 23 class Version; |
24 } | 24 } |
25 | 25 |
26 namespace content { | 26 namespace content { |
27 class BrowserContext; | 27 class BrowserContext; |
28 } | 28 } |
29 | 29 |
30 namespace extensions { | 30 namespace extensions { |
31 | 31 |
32 namespace core_api { | 32 namespace api { |
33 namespace runtime { | 33 namespace runtime { |
34 struct PlatformInfo; | 34 struct PlatformInfo; |
35 } | 35 } |
36 } | 36 } |
37 | 37 |
38 class Extension; | 38 class Extension; |
39 class ExtensionHost; | 39 class ExtensionHost; |
40 class ExtensionRegistry; | 40 class ExtensionRegistry; |
41 | 41 |
42 // Runtime API dispatches onStartup, onInstalled, and similar events to | 42 // Runtime API dispatches onStartup, onInstalled, and similar events to |
(...skipping 12 matching lines...) Expand all Loading... |
55 | 55 |
56 // content::NotificationObserver overrides: | 56 // content::NotificationObserver overrides: |
57 void Observe(int type, | 57 void Observe(int type, |
58 const content::NotificationSource& source, | 58 const content::NotificationSource& source, |
59 const content::NotificationDetails& details) override; | 59 const content::NotificationDetails& details) override; |
60 | 60 |
61 void ReloadExtension(const std::string& extension_id); | 61 void ReloadExtension(const std::string& extension_id); |
62 bool CheckForUpdates(const std::string& extension_id, | 62 bool CheckForUpdates(const std::string& extension_id, |
63 const RuntimeAPIDelegate::UpdateCheckCallback& callback); | 63 const RuntimeAPIDelegate::UpdateCheckCallback& callback); |
64 void OpenURL(const GURL& uninstall_url); | 64 void OpenURL(const GURL& uninstall_url); |
65 bool GetPlatformInfo(core_api::runtime::PlatformInfo* info); | 65 bool GetPlatformInfo(api::runtime::PlatformInfo* info); |
66 bool RestartDevice(std::string* error_message); | 66 bool RestartDevice(std::string* error_message); |
67 bool OpenOptionsPage(const Extension* extension); | 67 bool OpenOptionsPage(const Extension* extension); |
68 | 68 |
69 private: | 69 private: |
70 friend class BrowserContextKeyedAPIFactory<RuntimeAPI>; | 70 friend class BrowserContextKeyedAPIFactory<RuntimeAPI>; |
71 | 71 |
72 // ExtensionRegistryObserver implementation. | 72 // ExtensionRegistryObserver implementation. |
73 void OnExtensionLoaded(content::BrowserContext* browser_context, | 73 void OnExtensionLoaded(content::BrowserContext* browser_context, |
74 const Extension* extension) override; | 74 const Extension* extension) override; |
75 void OnExtensionWillBeInstalled(content::BrowserContext* browser_context, | 75 void OnExtensionWillBeInstalled(content::BrowserContext* browser_context, |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 const base::DictionaryValue* manifest); | 135 const base::DictionaryValue* manifest); |
136 | 136 |
137 // Dispatches the onBrowserUpdateAvailable event to all extensions. | 137 // Dispatches the onBrowserUpdateAvailable event to all extensions. |
138 static void DispatchOnBrowserUpdateAvailableEvent( | 138 static void DispatchOnBrowserUpdateAvailableEvent( |
139 content::BrowserContext* context); | 139 content::BrowserContext* context); |
140 | 140 |
141 // Dispatches the onRestartRequired event to the given app. | 141 // Dispatches the onRestartRequired event to the given app. |
142 static void DispatchOnRestartRequiredEvent( | 142 static void DispatchOnRestartRequiredEvent( |
143 content::BrowserContext* context, | 143 content::BrowserContext* context, |
144 const std::string& app_id, | 144 const std::string& app_id, |
145 core_api::runtime::OnRestartRequiredReason reason); | 145 api::runtime::OnRestartRequiredReason reason); |
146 | 146 |
147 // Does any work needed at extension uninstall (e.g. load uninstall url). | 147 // Does any work needed at extension uninstall (e.g. load uninstall url). |
148 static void OnExtensionUninstalled(content::BrowserContext* context, | 148 static void OnExtensionUninstalled(content::BrowserContext* context, |
149 const std::string& extension_id, | 149 const std::string& extension_id, |
150 UninstallReason reason); | 150 UninstallReason reason); |
151 }; | 151 }; |
152 | 152 |
153 class RuntimeGetBackgroundPageFunction : public UIThreadExtensionFunction { | 153 class RuntimeGetBackgroundPageFunction : public UIThreadExtensionFunction { |
154 public: | 154 public: |
155 DECLARE_EXTENSION_FUNCTION("runtime.getBackgroundPage", | 155 DECLARE_EXTENSION_FUNCTION("runtime.getBackgroundPage", |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 RUNTIME_GETPACKAGEDIRECTORYENTRY) | 229 RUNTIME_GETPACKAGEDIRECTORYENTRY) |
230 | 230 |
231 protected: | 231 protected: |
232 ~RuntimeGetPackageDirectoryEntryFunction() override {} | 232 ~RuntimeGetPackageDirectoryEntryFunction() override {} |
233 ResponseAction Run() override; | 233 ResponseAction Run() override; |
234 }; | 234 }; |
235 | 235 |
236 } // namespace extensions | 236 } // namespace extensions |
237 | 237 |
238 #endif // EXTENSIONS_BROWSER_API_RUNTIME_RUNTIME_API_H_ | 238 #endif // EXTENSIONS_BROWSER_API_RUNTIME_RUNTIME_API_H_ |
OLD | NEW |