• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
14 namespace content {
15 
16 enum 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   // DEPRECATED: Use WebContentsObserver::NavigationEntryCommitted()
46   NOTIFICATION_NAV_ENTRY_COMMITTED,
47 
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
52   // deleted.
53   //
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.
58   //
59   // The details are NavigationController::PrunedDetails.
60   NOTIFICATION_NAV_LIST_PRUNED,
61 
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.
65   //
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
69   // title comes).
70   NOTIFICATION_NAV_ENTRY_CHANGED,
71 
72   // Other load-related (not from NavigationController) ----------------------
73 
74   // Corresponds to ViewHostMsg_DocumentOnLoadCompletedInMainFrame. The source
75   // is the WebContents and the details the page_id.
76   // DEPRECATED: Use WebContentsObserver::DocumentOnLoadCompletedInMainFrame()
77   NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME,
78 
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,
84 
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
88   // are optional.
89   // DEPRECATED: Use WebContentsObserver::DidStopLoading()
90   NOTIFICATION_LOAD_STOP,
91 
92   // A response has been received for a resource request.  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 ResourceRequestDetails object are
95   // provided.
96   // DEPRECATED: Use WebContentsObserver::DidGetResourceResponseStart()
97   NOTIFICATION_RESOURCE_RESPONSE_STARTED,
98 
99   // A redirect was received while requesting a resource.  The source will be
100   // a Source<WebContents> corresponding to the tab in which the request was
101   // issued.  Details in the form of a ResourceRedirectDetails are provided.
102   // DEPRECATED: Use WebContentsObserver::DidGetRedirectForResourceRequest()
103   NOTIFICATION_RESOURCE_RECEIVED_REDIRECT,
104 
105   // WebContents ---------------------------------------------------------------
106 
107   // This notification is sent when a render view host has connected to a
108   // renderer process. The source is a Source<WebContents> with a pointer to
109   // the WebContents.  A WEB_CONTENTS_DISCONNECTED notification is
110   // guaranteed before the source pointer becomes junk.  No details are
111   // expected.
112   // DEPRECATED: Use WebContentsObserver::RenderViewReady()
113   NOTIFICATION_WEB_CONTENTS_CONNECTED,
114 
115   // This notification is sent when a WebContents swaps its render view host
116   // with another one, possibly changing processes. The source is a
117   // Source<WebContents> with a pointer to the WebContents, details is a
118   // std::pair::<old RenderViewHost, new RenderViewHost>.
119   // DEPRECATED: Use WebContentsObserver::RenderViewHostChanged()
120   NOTIFICATION_RENDER_VIEW_HOST_CHANGED,
121 
122   // This message is sent after a WebContents is disconnected from the
123   // renderer process.  The source is a Source<WebContents> with a pointer to
124   // the WebContents (the pointer is usable).  No details are expected.
125   // DEPRECATED: This is fired in two situations: when the render process
126   // crashes, in which case use WebContentsObserver::RenderProcessGone, and when
127   // the WebContents is being torn down, in which case use
128   // WebContentsObserver::WebContentsDestroyed()
129   NOTIFICATION_WEB_CONTENTS_DISCONNECTED,
130 
131   // This notification is sent after WebContents' title is updated. The source
132   // is a Source<WebContents> with a pointer to the WebContents. The details
133   // is a std::pair<NavigationEntry*, bool> that contains more information.
134   // DEPRECATED: Use WebContentsObserver::TitleWasSet()
135   NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED,
136 
137   // This notification is sent when a WebContents is being destroyed. Any
138   // object holding a reference to a WebContents can listen to that
139   // notification to properly reset the reference. The source is a
140   // Source<WebContents>.
141   // DEPRECATED: Use WebContentsObserver::WebContentsDestroyed()
142   NOTIFICATION_WEB_CONTENTS_DESTROYED,
143 
144   // A RenderViewHost was created for a WebContents. The source is the
145   // associated WebContents, and the details is the RenderViewHost
146   // pointer.
147   NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED,
148 
149   // Indicates that a RenderProcessHost was created and its handle is now
150   // available. The source will be the RenderProcessHost that corresponds to
151   // the process.
152   NOTIFICATION_RENDERER_PROCESS_CREATED,
153 
154   // Indicates that a RenderProcessHost is destructing. The source will be the
155   // RenderProcessHost that corresponds to the process.
156   NOTIFICATION_RENDERER_PROCESS_TERMINATED,
157 
158   // Indicates that a render process is starting to exit, such that it should
159   // not be used for future navigations.  The source will be the
160   // RenderProcessHost that corresponds to the process.
161   NOTIFICATION_RENDERER_PROCESS_CLOSING,
162 
163   // Indicates that a render process was closed (meaning it exited, but the
164   // RenderProcessHost might be reused).  The source will be the corresponding
165   // RenderProcessHost.  The details will be a RendererClosedDetails struct.
166   // This may get sent along with RENDERER_PROCESS_TERMINATED.
167   NOTIFICATION_RENDERER_PROCESS_CLOSED,
168 
169   // Indicates that a RenderWidgetHost has become unresponsive for a period of
170   // time. The source will be the RenderWidgetHost that corresponds to the
171   // hung view, and no details are expected.
172   NOTIFICATION_RENDER_WIDGET_HOST_HANG,
173 
174   // This is sent when a RenderWidgetHost is being destroyed. The source is
175   // the RenderWidgetHost, the details are not used.
176   NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED,
177 
178   // Sent after the backing store has been updated but before the widget has
179   // painted. The source is the RenderWidgetHost, the details are not used.
180   NOTIFICATION_RENDER_WIDGET_HOST_DID_UPDATE_BACKING_STORE,
181 
182   // This notifies the observer that a PaintAtSizeACK was received. The source
183   // is the RenderWidgetHost, the details are an instance of
184   // std::pair<int, gfx::Size>.
185   NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK,
186 
187   // This notifies the observer that a HandleInputEventACK was received. The
188   // source is the RenderWidgetHost, the details are the type of event
189   // received.
190   // Note: The RenderWidgetHost may be deallocated at this point.
191   // Used only in testing.
192   NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_INPUT_EVENT_ACK,
193 
194   // Sent from RenderViewHost::ClosePage.  The hosted RenderView has
195   // processed the onbeforeunload handler and is about to be sent a
196   // ViewMsg_ClosePage message to complete the tear-down process.  The source
197   // is the RenderViewHost sending the message, and no details are provided.
198   // Note:  This message is not sent in response to RenderView closure
199   // initiated by window.close().
200   NOTIFICATION_RENDER_VIEW_HOST_WILL_CLOSE_RENDER_VIEW,
201 
202   // This notifies the observer that the drag operation ack in a drag and
203   // drop operation was received. The source is the RenderViewHost.
204   // Note: Used only in testing.
205   NOTIFICATION_RENDER_VIEW_HOST_DID_RECEIVE_DRAG_TARGET_DROP_ACK,
206 
207   // Indicates a RenderWidgetHost has been hidden or restored. The source is
208   // the RWH whose visibility changed, the details is a bool set to true if
209   // the new state is "visible."
210   NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED,
211 
212   // The focused element inside a page has changed.  The source is the
213   // RenderViewHost. The details is a Details<const bool> that indicates whether
214   // or not an editable node was focused.
215   NOTIFICATION_FOCUS_CHANGED_IN_PAGE,
216 
217   // Notification from WebContents that we have received a response from the
218   // renderer in response to a dom automation controller action. The source is
219   // the RenderViewHost, and the details is a DomOperationNotificationDetails.
220   NOTIFICATION_DOM_OPERATION_RESPONSE,
221 
222   // Custom notifications used by the embedder should start from here.
223   NOTIFICATION_CONTENT_END,
224 };
225 
226 }  // namespace content
227 
228 #endif  // CONTENT_PUBLIC_BROWSER_NOTIFICATION_TYPES_H_
229