notification_types.h revision 4e180b6a0b4720a9b8e9e959a882386f690f08ff
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 // 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 // Indicates a WebContents has been hidden or restored. The source is 138 // a Source<WebContents>. The details is a bool set to true if the new 139 // state is visible. 140 // DEPRECATED: Use WebContentsObserver::WasShown() and/or 141 // WebContentsObserver::WasHidden() 142 NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED, 143 144 // This notification is sent when a WebContents is being destroyed. Any 145 // object holding a reference to a WebContents can listen to that 146 // notification to properly reset the reference. The source is a 147 // Source<WebContents>. 148 // DEPRECATED: Use WebContentsObserver::WebContentsDestroyed() 149 NOTIFICATION_WEB_CONTENTS_DESTROYED, 150 151 // A RenderViewHost was created for a WebContents. The source is the 152 // associated WebContents, and the details is the RenderViewHost 153 // pointer. 154 NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED, 155 156 // Indicates that a RenderProcessHost was created and its handle is now 157 // available. The source will be the RenderProcessHost that corresponds to 158 // the process. 159 NOTIFICATION_RENDERER_PROCESS_CREATED, 160 161 // Indicates that a RenderProcessHost is destructing. The source will be the 162 // RenderProcessHost that corresponds to the process. 163 NOTIFICATION_RENDERER_PROCESS_TERMINATED, 164 165 // Indicates that a render process is starting to exit, such that it should 166 // not be used for future navigations. The source will be the 167 // RenderProcessHost that corresponds to the process. 168 NOTIFICATION_RENDERER_PROCESS_CLOSING, 169 170 // Indicates that a render process was closed (meaning it exited, but the 171 // RenderProcessHost might be reused). The source will be the corresponding 172 // RenderProcessHost. The details will be a RendererClosedDetails struct. 173 // This may get sent along with RENDERER_PROCESS_TERMINATED. 174 NOTIFICATION_RENDERER_PROCESS_CLOSED, 175 176 // Indicates that a render process has become unresponsive for a period of 177 // time. The source will be the RenderWidgetHost that corresponds to the 178 // hung view, and no details are expected. 179 NOTIFICATION_RENDERER_PROCESS_HANG, 180 181 // This is sent when a RenderWidgetHost is being destroyed. The source is 182 // the RenderWidgetHost, the details are not used. 183 NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, 184 185 // Sent after the backing store has been updated but before the widget has 186 // painted. The source is the RenderWidgetHost, the details are not used. 187 NOTIFICATION_RENDER_WIDGET_HOST_DID_UPDATE_BACKING_STORE, 188 189 // This notifies the observer that a PaintAtSizeACK was received. The source 190 // is the RenderWidgetHost, the details are an instance of 191 // std::pair<int, gfx::Size>. 192 NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK, 193 194 // This notifies the observer that a HandleInputEventACK was received. The 195 // source is the RenderWidgetHost, the details are the type of event 196 // received. 197 // Note: The RenderWidgetHost may be deallocated at this point. 198 // Used only in testing. 199 NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_INPUT_EVENT_ACK, 200 201 // Sent from RenderViewHost::ClosePage. The hosted RenderView has 202 // processed the onbeforeunload handler and is about to be sent a 203 // ViewMsg_ClosePage message to complete the tear-down process. The source 204 // is the RenderViewHost sending the message, and no details are provided. 205 // Note: This message is not sent in response to RenderView closure 206 // initiated by window.close(). 207 NOTIFICATION_RENDER_VIEW_HOST_WILL_CLOSE_RENDER_VIEW, 208 209 // This notifies the observer that the drag operation ack in a drag and 210 // drop operation was received. The source is the RenderViewHost. 211 // Note: Used only in testing. 212 NOTIFICATION_RENDER_VIEW_HOST_DID_RECEIVE_DRAG_TARGET_DROP_ACK, 213 214 // Indicates a RenderWidgetHost has been hidden or restored. The source is 215 // the RWH whose visibility changed, the details is a bool set to true if 216 // the new state is "visible." 217 NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, 218 219 // The focused element inside a page has changed. The source is the 220 // RenderViewHost. The details is a Details<const bool> that indicates whether 221 // or not an editable node was focused. 222 NOTIFICATION_FOCUS_CHANGED_IN_PAGE, 223 224 // Notification from WebContents that we have received a response from the 225 // renderer in response to a dom automation controller action. The source is 226 // the RenderViewHost, and the details is a DomOperationNotificationDetails. 227 NOTIFICATION_DOM_OPERATION_RESPONSE, 228 229 // Custom notifications used by the embedder should start from here. 230 NOTIFICATION_CONTENT_END, 231}; 232 233} // namespace content 234 235#endif // CONTENT_PUBLIC_BROWSER_NOTIFICATION_TYPES_H_ 236