notification_types.h revision 2a99a7e74a7f215066514fe81d2bfa6639d9eddd
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.
4
5#ifndef CONTENT_PUBLIC_BROWSER_NOTIFICATION_TYPES_H_
6#define CONTENT_PUBLIC_BROWSER_NOTIFICATION_TYPES_H_
7
8// This file describes various types used to describe and filter notifications
9// that pass through the NotificationService.
10//
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
13// to by content.
14namespace content {
15
16enum NotificationType {
17  NOTIFICATION_CONTENT_START = 0,
18
19  // General -----------------------------------------------------------------
20
21  // Special signal value to represent an interest in all notifications.
22  // Not valid when posting a notification.
23  NOTIFICATION_ALL = NOTIFICATION_CONTENT_START,
24
25  // NavigationController ----------------------------------------------------
26
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
31  // pending.
32  //
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,
38
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).
42  //
43  // The source will be the navigation controller doing the commit. The
44  // details will be NavigationController::LoadCommittedDetails.
45  NOTIFICATION_NAV_ENTRY_COMMITTED,
46
47  // Indicates that the NavigationController given in the Source has
48  // decreased its back/forward list count by removing entries from either
49  // the front or back of its list. This is usually the result of going back
50  // and then doing a new navigation, meaning all the "forward" items are
51  // deleted.
52  //
53  // This normally happens as a result of a new navigation. It will be
54  // followed by a NAV_ENTRY_COMMITTED message for the new page that
55  // caused the pruning. It could also be a result of removing an item from
56  // the list to fix up after interstitials.
57  //
58  // The details are NavigationController::PrunedDetails.
59  NOTIFICATION_NAV_LIST_PRUNED,
60
61  // Indicates that a NavigationEntry has changed. The source will be the
62  // NavigationController that owns the NavigationEntry. The details will be
63  // a NavigationController::EntryChangedDetails struct.
64  //
65  // This will NOT be sent on navigation, interested parties should also
66  // listen for NAV_ENTRY_COMMITTED to handle that case. This will be
67  // sent when the entry is updated outside of navigation (like when a new
68  // title comes).
69  NOTIFICATION_NAV_ENTRY_CHANGED,
70
71  // Other load-related (not from NavigationController) ----------------------
72
73  // Corresponds to ViewHostMsg_DocumentOnLoadCompletedInMainFrame. The source
74  // is the WebContents and the details the page_id.
75  NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME,
76
77  // A content load is starting.  The source will be a
78  // Source<NavigationController> corresponding to the tab in which the load
79  // is occurring.  No details are expected for this notification.
80  NOTIFICATION_LOAD_START,
81
82  // A content load has stopped. The source will be a
83  // Source<NavigationController> corresponding to the tab in which the load
84  // is occurring.  Details in the form of a LoadNotificationDetails object
85  // are optional.
86  NOTIFICATION_LOAD_STOP,
87
88  // Content was loaded from an in-memory cache.  The source will be a
89  // Source<NavigationController> corresponding to the tab in which the load
90  // occurred.  Details in the form of a LoadFromMemoryCacheDetails object
91  // are provided.
92  NOTIFICATION_LOAD_FROM_MEMORY_CACHE,
93
94  // A response has been received for a resource request.  The source will be
95  // a Source<WebContents> corresponding to the tab in which the request was
96  // issued.  Details in the form of a ResourceRequestDetails object are
97  // provided.
98  NOTIFICATION_RESOURCE_RESPONSE_STARTED,
99
100  // A redirect was received while requesting a resource.  The source will be
101  // a Source<WebContents> corresponding to the tab in which the request was
102  // issued.  Details in the form of a ResourceRedirectDetails are provided.
103  NOTIFICATION_RESOURCE_RECEIVED_REDIRECT,
104
105  // Devtools ------------------------------------------------------------------
106
107  // Indicates that a devtools agent has attached to a client. The source is
108  // the BrowserContext* and the details is the inspected RenderViewHost*.
109  NOTIFICATION_DEVTOOLS_AGENT_ATTACHED,
110
111  // Indicates that a devtools agent has detached from a client. The source is
112  // the BrowserContext* and the details is the inspected RenderViewHost*.
113  NOTIFICATION_DEVTOOLS_AGENT_DETACHED,
114
115  // WebContents ---------------------------------------------------------------
116
117  // This notification is sent when a render view host has connected to a
118  // renderer process. The source is a Source<WebContents> with a pointer to
119  // the WebContents.  A WEB_CONTENTS_DISCONNECTED notification is
120  // guaranteed before the source pointer becomes junk.  No details are
121  // expected.
122  NOTIFICATION_WEB_CONTENTS_CONNECTED,
123
124  // This notification is sent when a WebContents swaps its render view host
125  // with another one, possibly changing processes. The source is a
126  // Source<WebContents> with a pointer to the WebContents.  A
127  // NOTIFICATION_WEB_CONTENTS_DISCONNECTED notification is guaranteed before
128  // the source pointer becomes junk.  Details are the RenderViewHost that
129  // has been replaced, or NULL if the old RVH was shut down.
130  NOTIFICATION_WEB_CONTENTS_SWAPPED,
131
132  // This message is sent after a WebContents is disconnected from the
133  // renderer process.  The source is a Source<WebContents> with a pointer to
134  // the WebContents (the pointer is usable).  No details are expected.
135  NOTIFICATION_WEB_CONTENTS_DISCONNECTED,
136
137  // This notification is sent after WebContents' title is updated. The source
138  // is a Source<WebContents> with a pointer to the WebContents. The details
139  // is a std::pair<NavigationEntry*, bool> that contains more information.
140  NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED,
141
142  // Indicates a WebContents has been hidden or restored.  The source is
143  // a Source<WebContents>. The details is a bool set to true if the new
144  // state is visible.
145  NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED,
146
147  // This notification is sent when a WebContents is being destroyed. Any
148  // object holding a reference to a WebContents can listen to that
149  // notification to properly reset the reference. The source is a
150  // Source<WebContents>.
151  NOTIFICATION_WEB_CONTENTS_DESTROYED,
152
153  // A RenderViewHost was created for a WebContents. The source is the
154  // associated WebContents, and the details is the RenderViewHost
155  // pointer.
156  NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED,
157
158  // Indicates that a RenderProcessHost was created and its handle is now
159  // available. The source will be the RenderProcessHost that corresponds to
160  // the process.
161  NOTIFICATION_RENDERER_PROCESS_CREATED,
162
163  // Indicates that a RenderProcessHost is destructing. The source will be the
164  // RenderProcessHost that corresponds to the process.
165  NOTIFICATION_RENDERER_PROCESS_TERMINATED,
166
167  // Indicates that a render process is starting to exit, such that it should
168  // not be used for future navigations.  The source will be the
169  // RenderProcessHost that corresponds to the process.
170  NOTIFICATION_RENDERER_PROCESS_CLOSING,
171
172  // Indicates that a render process was closed (meaning it exited, but the
173  // RenderProcessHost might be reused).  The source will be the corresponding
174  // RenderProcessHost.  The details will be a RendererClosedDetails struct.
175  // This may get sent along with RENDERER_PROCESS_TERMINATED.
176  NOTIFICATION_RENDERER_PROCESS_CLOSED,
177
178  // Indicates that a render process has become unresponsive for a period of
179  // time. The source will be the RenderWidgetHost that corresponds to the
180  // hung view, and no details are expected.
181  NOTIFICATION_RENDERER_PROCESS_HANG,
182
183  // This is sent to notify that the RenderViewHost displayed in a WebContents
184  // has changed.  Source is the NavigationController for which the change
185  // happened, details is a
186  // std::pair::<old RenderViewHost, new RenderViewHost>).
187  NOTIFICATION_RENDER_VIEW_HOST_CHANGED,
188
189  // This is sent when a RenderWidgetHost is being destroyed. The source is
190  // the RenderWidgetHost, the details are not used.
191  NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED,
192
193  // Sent after the backing store has been updated but before the widget has
194  // painted. The source is the RenderWidgetHost, the details are not used.
195  NOTIFICATION_RENDER_WIDGET_HOST_DID_UPDATE_BACKING_STORE,
196
197  // This notifies the observer that a PaintAtSizeACK was received. The source
198  // is the RenderWidgetHost, the details are an instance of
199  // std::pair<int, gfx::Size>.
200  NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK,
201
202  // This notifies the observer that a HandleInputEventACK was received. The
203  // source is the RenderWidgetHost, the details are the type of event
204  // received.
205  // Note: The RenderWidgetHost may be deallocated at this point.
206  // Used only in testing.
207  NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_INPUT_EVENT_ACK,
208
209  // Sent from RenderViewHost constructor. The source is the RenderViewHost,
210  // the details unused.
211  NOTIFICATION_RENDER_VIEW_HOST_CREATED,
212
213  // Sent from RenderViewHost::ClosePage.  The hosted RenderView has
214  // processed the onbeforeunload handler and is about to be sent a
215  // ViewMsg_ClosePage message to complete the tear-down process.  The source
216  // is the RenderViewHost sending the message, and no details are provided.
217  // Note:  This message is not sent in response to RenderView closure
218  // initiated by window.close().
219  NOTIFICATION_RENDER_VIEW_HOST_WILL_CLOSE_RENDER_VIEW,
220
221  // This notifies the observer that the drag operation ack in a drag and
222  // drop operation was received. The source is the RenderViewHost.
223  // Note: Used only in testing.
224  NOTIFICATION_RENDER_VIEW_HOST_DID_RECEIVE_DRAG_TARGET_DROP_ACK,
225
226  // Indicates a RenderWidgetHost has been hidden or restored. The source is
227  // the RWH whose visibility changed, the details is a bool set to true if
228  // the new state is "visible."
229  NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED,
230
231  // The focused element inside a page has changed.  The source is the
232  // RenderViewHost. The details is a Details<const bool> that indicates whether
233  // or not an editable node was focused.
234  NOTIFICATION_FOCUS_CHANGED_IN_PAGE,
235
236  // Notification from WebContents that we have received a response from the
237  // renderer in response to a dom automation controller action. The source is
238  // the RenderViewHost, and the details is a DomOperationNotificationDetails.
239  NOTIFICATION_DOM_OPERATION_RESPONSE,
240
241  // Custom notifications used by the embedder should start from here.
242  NOTIFICATION_CONTENT_END,
243};
244
245}  // namespace content
246
247#endif  // CONTENT_PUBLIC_BROWSER_NOTIFICATION_TYPES_H_
248