Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: chrome/browser/extensions/api/runtime/runtime_api.h

Issue 16844020: app_mode: Add runtime.onRestartRequired event. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments in #1, add test and remove onBrowserUpdateAvailable Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 onRestartRequired event to the given app.
41 static void DispatchOnBrowserUpdateAvailableEvent(Profile* profile); 49 static void DispatchOnRestartRequiredEvent(Profile* profile,
50 const std::string& app_id,
51 RestartReason reason);
42 52
43 // Does any work needed at extension uninstall (e.g. load uninstall url). 53 // Does any work needed at extension uninstall (e.g. load uninstall url).
44 static void OnExtensionUninstalled(Profile* profile, 54 static void OnExtensionUninstalled(Profile* profile,
45 const std::string& extension_id); 55 const std::string& extension_id);
46 }; 56 };
47 57
48 class RuntimeGetBackgroundPageFunction : public AsyncExtensionFunction { 58 class RuntimeGetBackgroundPageFunction : public AsyncExtensionFunction {
49 public: 59 public:
50 DECLARE_EXTENSION_FUNCTION("runtime.getBackgroundPage", 60 DECLARE_EXTENSION_FUNCTION("runtime.getBackgroundPage",
51 RUNTIME_GETBACKGROUNDPAGE) 61 RUNTIME_GETBACKGROUNDPAGE)
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 DECLARE_EXTENSION_FUNCTION("runtime.getPlatformInfo", 115 DECLARE_EXTENSION_FUNCTION("runtime.getPlatformInfo",
106 RUNTIME_GETPLATFORMINFO); 116 RUNTIME_GETPLATFORMINFO);
107 protected: 117 protected:
108 virtual ~RuntimeGetPlatformInfoFunction() {} 118 virtual ~RuntimeGetPlatformInfoFunction() {}
109 virtual bool RunImpl() OVERRIDE; 119 virtual bool RunImpl() OVERRIDE;
110 }; 120 };
111 121
112 } // namespace extensions 122 } // namespace extensions
113 123
114 #endif // CHROME_BROWSER_EXTENSIONS_API_RUNTIME_RUNTIME_API_H_ 124 #endif // CHROME_BROWSER_EXTENSIONS_API_RUNTIME_RUNTIME_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698