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
3 // found in the LICENSE file.
5 #ifndef EXTENSIONS_BROWSER_NOTIFICATION_TYPES_H_
6 #define EXTENSIONS_BROWSER_NOTIFICATION_TYPES_H_
10 #include "content/public/browser/notification_types.h"
12 #if !defined(ENABLE_EXTENSIONS)
13 #error "Extensions must be enabled"
16 namespace extensions
{
18 // Only notifications fired by the extensions module should be here. The
19 // extensions module should not listen to notifications fired by the
21 enum NotificationType
{
22 // WARNING: This need to match chrome/browser/chrome_notification_types.h.
23 NOTIFICATION_EXTENSIONS_START
= content::NOTIFICATION_CONTENT_END
,
25 // Sent when a CrxInstaller finishes. Source is the CrxInstaller that
26 // finished. The details are the extension which was installed.
27 NOTIFICATION_CRX_INSTALLER_DONE
= NOTIFICATION_EXTENSIONS_START
,
29 // Sent when the known installed extensions have all been loaded. In
30 // testing scenarios this can happen multiple times if extensions are
31 // unloaded and reloaded. The source is a BrowserContext*.
33 // DEPRECATED: Use ExtensionSystem::Get(browser_context)->ready().Post().
34 NOTIFICATION_EXTENSIONS_READY_DEPRECATED
,
36 // Sent when a new extension is loaded. The details are an Extension, and
37 // the source is a BrowserContext*.
39 // DEPRECATED: Use ExtensionRegistry::AddObserver instead.
40 NOTIFICATION_EXTENSION_LOADED_DEPRECATED
,
42 // An error occured while attempting to load an extension. The details are a
43 // string with details about why the load failed.
44 NOTIFICATION_EXTENSION_LOAD_ERROR
,
46 // Sent when an extension is enabled. Under most circumstances, listeners will
47 // want to use ExtensionRegistryObserver::OnExtensionLoaded(). This
48 // notification is only fired when the "Enable" button is hit in the
49 // extensions tab. The details are an Extension, and the source is a
51 NOTIFICATION_EXTENSION_ENABLED
,
53 // Sent when attempting to load a new extension, but they are disabled. The
54 // details are an Extension, and the source is a BrowserContext*.
55 NOTIFICATION_EXTENSION_UPDATE_DISABLED
,
57 // Sent when an extension's permissions change. The details are an
58 // UpdatedExtensionPermissionsInfo, and the source is a BrowserContext*.
59 NOTIFICATION_EXTENSION_PERMISSIONS_UPDATED
,
61 // Sent immediately before new extensions are installed or existing
62 // extensions are updated. The details are an InstalledExtensionInfo, and the
63 // source is a BrowserContext*.
65 // DEPRECATED: Use ExtensionRegistry::AddObserver instead.
66 NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED
,
68 // An error occured during extension install. The details are a string with
69 // details about why the install failed.
70 NOTIFICATION_EXTENSION_INSTALL_ERROR
,
72 // Sent when an extension has been uninstalled. The details are an Extension,
73 // and the source is a BrowserContext*.
75 // DEPRECATED: Use ExtensionRegistry::AddObserver instead.
76 NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED
,
78 // Sent when an extension uninstall is not allowed because the extension is
79 // not user manageable. The details are an Extension, and the source is a
81 NOTIFICATION_EXTENSION_UNINSTALL_NOT_ALLOWED
,
83 // Sent when an extension is unloaded. This happens when an extension is
84 // uninstalled or disabled. The details are an UnloadedExtensionInfo, and the
85 // source is a BrowserContext*.
87 // Note that when this notification is sent, the ExtensionService and the
88 // ExtensionRegistry have already removed the extension from their internal
91 // DEPRECATED: Use ExtensionRegistry::AddObserver instead.
92 NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED
,
94 // Sent when an Extension object is removed from ExtensionService. This
95 // can happen when an extension is uninstalled, upgraded, or blacklisted,
96 // including all cases when the Extension is deleted. The details are an
97 // Extension, and the source is a BrowserContext*.
98 NOTIFICATION_EXTENSION_REMOVED
,
100 // Sent after a new ExtensionHost* is created. The details are
101 // an ExtensionHost* and the source is a BrowserContext*.
102 NOTIFICATION_EXTENSION_HOST_CREATED
,
104 // Sent before an ExtensionHost* is destroyed. The details are
105 // an ExtensionHost* and the source is a BrowserContext*.
106 NOTIFICATION_EXTENSION_HOST_DESTROYED
,
108 // Sent by an ExtensionHost* when it has finished its initial page load,
109 // including any external resources.
110 // The details are an ExtensionHost* and the source is a BrowserContext*.
111 NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING
,
113 // Sent by an ExtensionHost* when its render view requests closing through
114 // window.close(). The details are an ExtensionHost* and the source is a
116 NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE
,
118 // Sent when extension render process ends (whether it crashes or closes). The
119 // details are an ExtensionHost* and the source is a BrowserContext*. Not sent
120 // during browser shutdown.
121 NOTIFICATION_EXTENSION_PROCESS_TERMINATED
,
123 // Sent when a background page is ready so other components can load.
124 NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY
,
126 // Sent when the count of page actions has changed. Note that some of them
127 // may not apply to the current page. The source is a LocationBar*. There
129 NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED
,
131 // Sent when a browser action's visibility has changed. The source is the
132 // ExtensionPrefs* that changed, and the details are a std::string with the
134 NOTIFICATION_EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED
,
136 // Sent when an extension command has been removed. The source is the
137 // BrowserContext* and the details is an ExtensionCommandRemovedDetails
138 // consisting of std::strings representing an extension ID, the name of the
139 // command being removed, and the accelerator associated with the command.
140 NOTIFICATION_EXTENSION_COMMAND_REMOVED
,
142 // Sent when an extension command has been added. The source is the
143 // BrowserContext* and the details is a std::pair of two std::string objects
144 // (an extension ID and the name of the command being added).
145 NOTIFICATION_EXTENSION_COMMAND_ADDED
,
147 // Sent when an extension command shortcut for a browser action is activated
148 // on Mac. The source is the BrowserContext* and the details is a std::pair of
149 // a std::string containing an extension ID and a gfx::NativeWindow for the
150 // associated window.
151 NOTIFICATION_EXTENSION_COMMAND_BROWSER_ACTION_MAC
,
153 // Sent when an extension command shortcut for a page action is activated
154 // on Mac. The source is the BrowserContext* and the details is a std::pair of
156 // std::string containing an extension ID and a gfx::NativeWindow for the
157 // associated window.
158 NOTIFICATION_EXTENSION_COMMAND_PAGE_ACTION_MAC
,
160 // A new extension RenderViewHost has been registered. The details are
161 // the RenderViewHost*.
162 NOTIFICATION_EXTENSION_VIEW_REGISTERED
,
164 // An extension RenderViewHost has been unregistered. The details are
165 // the RenderViewHost*.
166 NOTIFICATION_EXTENSION_VIEW_UNREGISTERED
,
168 // Sent by an extension to notify the browser about the results of a unit
170 NOTIFICATION_EXTENSION_TEST_PASSED
,
171 NOTIFICATION_EXTENSION_TEST_FAILED
,
173 // Sent by extension test javascript code, typically in a browser test. The
174 // sender is a std::string representing the extension id, and the details
175 // are a std::string with some message. This is particularly useful when you
176 // want to have C++ code wait for javascript code to do something.
177 NOTIFICATION_EXTENSION_TEST_MESSAGE
,
179 // Sent when an bookmarks extensions API function was successfully invoked.
180 // The source is the id of the extension that invoked the function, and the
181 // details are a pointer to the const BookmarksFunction in question.
182 NOTIFICATION_EXTENSION_BOOKMARKS_API_INVOKED
,
184 // Sent when a downloads extensions API event is fired. The source is an
185 // ExtensionDownloadsEventRouter::NotificationSource, and the details is a
186 // std::string containing json. Used for testing.
187 NOTIFICATION_EXTENSION_DOWNLOADS_EVENT
,
189 // Sent when an omnibox extension has sent back omnibox suggestions. The
190 // source is the BrowserContext*, and the details are an
191 // extensions::api::omnibox::SendSuggestions::Params object.
192 NOTIFICATION_EXTENSION_OMNIBOX_SUGGESTIONS_READY
,
194 // Sent when the user accepts the input in an extension omnibox keyword
195 // session. The source is the BrowserContext*.
196 NOTIFICATION_EXTENSION_OMNIBOX_INPUT_ENTERED
,
198 // Sent when an omnibox extension has updated the default suggestion. The
199 // source is the BrowserContext*.
200 NOTIFICATION_EXTENSION_OMNIBOX_DEFAULT_SUGGESTION_CHANGED
,
202 // Sent when the extension updater starts checking for updates to installed
203 // extensions. The source is a BrowserContext*, and there are no details.
204 NOTIFICATION_EXTENSION_UPDATING_STARTED
,
206 // The extension updater found an update and will attempt to download and
207 // install it. The source is a BrowserContext*, and the details are an
208 // extensions::UpdateDetails object with the extension id and version of the
210 NOTIFICATION_EXTENSION_UPDATE_FOUND
,
212 // Sent when there are new user scripts available. The details are a
213 // pointer to SharedMemory containing the new scripts.
214 NOTIFICATION_USER_SCRIPTS_UPDATED
,
215 NOTIFICATION_EXTENSIONS_END
218 struct ExtensionCommandRemovedDetails
{
219 ExtensionCommandRemovedDetails(const std::string
& extension_id
,
220 const std::string
& command_name
,
221 const std::string
& accelerator
);
223 std::string extension_id
;
224 std::string command_name
;
225 std::string accelerator
;
228 } // namespace extensions
230 #endif // EXTENSIONS_BROWSER_NOTIFICATION_TYPES_H_