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

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: restore onBrowserUpdateAvailable and address comments in #2 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_UNKNOWN,
28 RESTART_REASON_APP_UPDATE,
29 RESTART_REASON_OS_UPDATE,
30 RESTART_REASON_PERIODIC,
31 };
32
24 // Dispatches the onStartup event to all currently-loaded extensions. 33 // Dispatches the onStartup event to all currently-loaded extensions.
25 static void DispatchOnStartupEvent(Profile* profile, 34 static void DispatchOnStartupEvent(Profile* profile,
26 const std::string& extension_id); 35 const std::string& extension_id);
27 36
28 // Dispatches the onInstalled event to the given extension. 37 // Dispatches the onInstalled event to the given extension.
29 static void DispatchOnInstalledEvent(Profile* profile, 38 static void DispatchOnInstalledEvent(Profile* profile,
30 const std::string& extension_id, 39 const std::string& extension_id,
31 const base::Version& old_version, 40 const base::Version& old_version,
32 bool chrome_updated); 41 bool chrome_updated);
33 42
34 // Dispatches the onUpdateAvailable event to the given extension. 43 // Dispatches the onUpdateAvailable event to the given extension.
35 static void DispatchOnUpdateAvailableEvent( 44 static void DispatchOnUpdateAvailableEvent(
36 Profile* profile, 45 Profile* profile,
37 const std::string& extension_id, 46 const std::string& extension_id,
38 const base::DictionaryValue* manifest); 47 const base::DictionaryValue* manifest);
39 48
40 // Dispatches the onBrowserUpdateAvailable event to all extensions. 49 // Dispatches the onBrowserUpdateAvailable event to all extensions.
41 static void DispatchOnBrowserUpdateAvailableEvent(Profile* profile); 50 static void DispatchOnBrowserUpdateAvailableEvent(Profile* profile);
42 51
52 // Dispatches the onRestartRequired event to the given app.
53 static void DispatchOnRestartRequiredEvent(Profile* profile,
54 const std::string& app_id,
55 RestartReason reason);
56
43 // Does any work needed at extension uninstall (e.g. load uninstall url). 57 // Does any work needed at extension uninstall (e.g. load uninstall url).
44 static void OnExtensionUninstalled(Profile* profile, 58 static void OnExtensionUninstalled(Profile* profile,
45 const std::string& extension_id); 59 const std::string& extension_id);
46 }; 60 };
47 61
48 class RuntimeGetBackgroundPageFunction : public AsyncExtensionFunction { 62 class RuntimeGetBackgroundPageFunction : public AsyncExtensionFunction {
49 public: 63 public:
50 DECLARE_EXTENSION_FUNCTION("runtime.getBackgroundPage", 64 DECLARE_EXTENSION_FUNCTION("runtime.getBackgroundPage",
51 RUNTIME_GETBACKGROUNDPAGE) 65 RUNTIME_GETBACKGROUNDPAGE)
52 66
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 DECLARE_EXTENSION_FUNCTION("runtime.getPlatformInfo", 119 DECLARE_EXTENSION_FUNCTION("runtime.getPlatformInfo",
106 RUNTIME_GETPLATFORMINFO); 120 RUNTIME_GETPLATFORMINFO);
107 protected: 121 protected:
108 virtual ~RuntimeGetPlatformInfoFunction() {} 122 virtual ~RuntimeGetPlatformInfoFunction() {}
109 virtual bool RunImpl() OVERRIDE; 123 virtual bool RunImpl() OVERRIDE;
110 }; 124 };
111 125
112 } // namespace extensions 126 } // namespace extensions
113 127
114 #endif // CHROME_BROWSER_EXTENSIONS_API_RUNTIME_RUNTIME_API_H_ 128 #endif // CHROME_BROWSER_EXTENSIONS_API_RUNTIME_RUNTIME_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698