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
3 // found in the LICENSE file.
5 #ifndef CONTENT_PUBLIC_BROWSER_NOTIFICATION_TYPES_H_
6 #define CONTENT_PUBLIC_BROWSER_NOTIFICATION_TYPES_H_
8 // This file describes various types used to describe and filter notifications
9 // that pass through the NotificationService.
11 // Only notifications that are fired from the content module should be here. We
12 // should never have a notification that is fired by the embedder and listened
16 enum NotificationType
{
17 NOTIFICATION_CONTENT_START
= 0,
19 // General -----------------------------------------------------------------
21 // Special signal value to represent an interest in all notifications.
22 // Not valid when posting a notification.
23 NOTIFICATION_ALL
= NOTIFICATION_CONTENT_START
,
25 // NavigationController ----------------------------------------------------
27 // A new pending navigation has been created. Pending entries are created
28 // when the user requests the navigation. We don't know if it will actually
29 // happen until it does (at this point, it will be "committed." Note that
30 // renderer- initiated navigations such as link clicks will never be
33 // This notification is called after the pending entry is created, but
34 // before we actually try to navigate. The source will be the
35 // NavigationController that owns the pending entry, and the details
36 // will be a NavigationEntry.
37 NOTIFICATION_NAV_ENTRY_PENDING
,
39 // A new non-pending navigation entry has been created. This will
40 // correspond to one NavigationController entry being created (in the case
41 // of new navigations) or renavigated to (for back/forward navigations).
43 // The source will be the navigation controller doing the commit. The
44 // details will be NavigationController::LoadCommittedDetails.
45 // DEPRECATED: Use WebContentsObserver::NavigationEntryCommitted()
46 NOTIFICATION_NAV_ENTRY_COMMITTED
,
48 // Indicates that the NavigationController given in the Source has
49 // decreased its back/forward list count by removing entries from either
50 // the front or back of its list. This is usually the result of going back
51 // and then doing a new navigation, meaning all the "forward" items are
54 // This normally happens as a result of a new navigation. It will be
55 // followed by a NAV_ENTRY_COMMITTED message for the new page that
56 // caused the pruning. It could also be a result of removing an item from
57 // the list to fix up after interstitials.
59 // The details are NavigationController::PrunedDetails.
60 NOTIFICATION_NAV_LIST_PRUNED
,
62 // Indicates that a NavigationEntry has changed. The source will be the
63 // NavigationController that owns the NavigationEntry. The details will be
64 // a NavigationController::EntryChangedDetails struct.
66 // This will NOT be sent on navigation, interested parties should also
67 // listen for NAV_ENTRY_COMMITTED to handle that case. This will be
68 // sent when the entry is updated outside of navigation (like when a new
70 NOTIFICATION_NAV_ENTRY_CHANGED
,
72 // Other load-related (not from NavigationController) ----------------------
74 // Corresponds to ViewHostMsg_DocumentOnLoadCompletedInMainFrame. The source
75 // is the WebContents.
76 // DEPRECATED: Use WebContentsObserver::DocumentOnLoadCompletedInMainFrame()
77 NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME
,
79 // A content load is starting. The source will be a
80 // Source<NavigationController> corresponding to the tab in which the load
81 // is occurring. No details are expected for this notification.
82 // DEPRECATED: Use WebContentsObserver::DidStartLoading()
83 NOTIFICATION_LOAD_START
,
85 // A content load has stopped. The source will be a
86 // Source<NavigationController> corresponding to the tab in which the load
87 // is occurring. Details in the form of a LoadNotificationDetails object
89 // DEPRECATED: Use WebContentsObserver::DidStopLoading()
90 NOTIFICATION_LOAD_STOP
,
92 // A redirect was received while requesting a resource. The source will be
93 // a Source<WebContents> corresponding to the tab in which the request was
94 // issued. Details in the form of a ResourceRedirectDetails are provided.
95 // DEPRECATED: Use WebContentsObserver::DidGetRedirectForResourceRequest()
96 NOTIFICATION_RESOURCE_RECEIVED_REDIRECT
,
98 // WebContents ---------------------------------------------------------------
100 // This notification is sent when a render view host has connected to a
101 // renderer process. The source is a Source<WebContents> with a pointer to
102 // the WebContents. A WEB_CONTENTS_DISCONNECTED notification is
103 // guaranteed before the source pointer becomes junk. No details are
105 // DEPRECATED: Use WebContentsObserver::RenderViewReady()
106 NOTIFICATION_WEB_CONTENTS_CONNECTED
,
108 // This message is sent after a WebContents is disconnected from the
109 // renderer process. The source is a Source<WebContents> with a pointer to
110 // the WebContents (the pointer is usable). No details are expected.
111 // DEPRECATED: This is fired in two situations: when the render process
112 // crashes, in which case use WebContentsObserver::RenderProcessGone, and when
113 // the WebContents is being torn down, in which case use
114 // WebContentsObserver::WebContentsDestroyed()
115 NOTIFICATION_WEB_CONTENTS_DISCONNECTED
,
117 // This notification is sent when a WebContents is being destroyed. Any
118 // object holding a reference to a WebContents can listen to that
119 // notification to properly reset the reference. The source is a
120 // Source<WebContents>.
121 // DEPRECATED: Use WebContentsObserver::WebContentsDestroyed()
122 NOTIFICATION_WEB_CONTENTS_DESTROYED
,
124 // A RenderViewHost was created for a WebContents. The source is the
125 // associated WebContents, and the details is the RenderViewHost
127 NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED
,
129 // Indicates that a RenderProcessHost was created and its handle is now
130 // available. The source will be the RenderProcessHost that corresponds to
132 NOTIFICATION_RENDERER_PROCESS_CREATED
,
134 // Indicates that a RenderProcessHost is destructing. The source will be the
135 // RenderProcessHost that corresponds to the process.
136 NOTIFICATION_RENDERER_PROCESS_TERMINATED
,
138 // Indicates that a render process was closed (meaning it exited, but the
139 // RenderProcessHost might be reused). The source will be the corresponding
140 // RenderProcessHost. The details will be a RendererClosedDetails struct.
141 // This may get sent along with RENDERER_PROCESS_TERMINATED.
142 NOTIFICATION_RENDERER_PROCESS_CLOSED
,
144 // Indicates that a RenderWidgetHost has become unresponsive for a period of
145 // time. The source will be the RenderWidgetHost that corresponds to the
146 // hung view, and no details are expected.
147 NOTIFICATION_RENDER_WIDGET_HOST_HANG
,
149 // This is sent when a RenderWidgetHost is being destroyed. The source is
150 // the RenderWidgetHost, the details are not used.
151 NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED
,
153 // Sent after the backing store has been updated but before the widget has
154 // painted. The source is the RenderWidgetHost, the details are not used.
155 NOTIFICATION_RENDER_WIDGET_HOST_DID_UPDATE_BACKING_STORE
,
157 // Sent from RenderViewHost::ClosePage. The hosted RenderView has
158 // processed the onbeforeunload handler and is about to be sent a
159 // ViewMsg_ClosePage message to complete the tear-down process. The source
160 // is the RenderViewHost sending the message, and no details are provided.
161 // Note: This message is not sent in response to RenderView closure
162 // initiated by window.close().
163 NOTIFICATION_RENDER_VIEW_HOST_WILL_CLOSE_RENDER_VIEW
,
165 // Indicates a RenderWidgetHost has been hidden or restored. The source is
166 // the RWH whose visibility changed, the details is a bool set to true if
167 // the new state is "visible."
168 NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED
,
170 // The focused element inside a page has changed. The source is the
171 // RenderViewHost. The details is a Details<const bool> that indicates whether
172 // or not an editable node was focused.
173 NOTIFICATION_FOCUS_CHANGED_IN_PAGE
,
175 // Notification from WebContents that we have received a response from the
176 // renderer in response to a dom automation controller action. The source is
177 // the RenderViewHost, and the details is a DomOperationNotificationDetails.
178 NOTIFICATION_DOM_OPERATION_RESPONSE
,
180 // Custom notifications used by the embedder should start from here.
181 NOTIFICATION_CONTENT_END
,
184 } // namespace content
186 #endif // CONTENT_PUBLIC_BROWSER_NOTIFICATION_TYPES_H_