Home | History | Annotate | Download | only in browser
      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   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   // 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   NOTIFICATION_WEB_CONTENTS_CONNECTED,
    113 
    114   // This notification is sent when a WebContents swaps its render view host
    115   // with another one, possibly changing processes. The source is a
    116   // Source<WebContents> with a pointer to the WebContents.  A
    117   // NOTIFICATION_WEB_CONTENTS_DISCONNECTED notification is guaranteed before
    118   // the source pointer becomes junk.  Details are the RenderViewHost that
    119   // has been replaced, or NULL if the old RVH was shut down.
    120   NOTIFICATION_WEB_CONTENTS_SWAPPED,
    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   NOTIFICATION_WEB_CONTENTS_DISCONNECTED,
    126 
    127   // This notification is sent after WebContents' title is updated. The source
    128   // is a Source<WebContents> with a pointer to the WebContents. The details
    129   // is a std::pair<NavigationEntry*, bool> that contains more information.
    130   NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED,
    131 
    132   // Indicates a WebContents has been hidden or restored.  The source is
    133   // a Source<WebContents>. The details is a bool set to true if the new
    134   // state is visible.
    135   NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED,
    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   NOTIFICATION_WEB_CONTENTS_DESTROYED,
    142 
    143   // A RenderViewHost was created for a WebContents. The source is the
    144   // associated WebContents, and the details is the RenderViewHost
    145   // pointer.
    146   NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED,
    147 
    148   // Indicates that a RenderProcessHost was created and its handle is now
    149   // available. The source will be the RenderProcessHost that corresponds to
    150   // the process.
    151   NOTIFICATION_RENDERER_PROCESS_CREATED,
    152 
    153   // Indicates that a RenderProcessHost is destructing. The source will be the
    154   // RenderProcessHost that corresponds to the process.
    155   NOTIFICATION_RENDERER_PROCESS_TERMINATED,
    156 
    157   // Indicates that a render process is starting to exit, such that it should
    158   // not be used for future navigations.  The source will be the
    159   // RenderProcessHost that corresponds to the process.
    160   NOTIFICATION_RENDERER_PROCESS_CLOSING,
    161 
    162   // Indicates that a render process was closed (meaning it exited, but the
    163   // RenderProcessHost might be reused).  The source will be the corresponding
    164   // RenderProcessHost.  The details will be a RendererClosedDetails struct.
    165   // This may get sent along with RENDERER_PROCESS_TERMINATED.
    166   NOTIFICATION_RENDERER_PROCESS_CLOSED,
    167 
    168   // Indicates that a render process has become unresponsive for a period of
    169   // time. The source will be the RenderWidgetHost that corresponds to the
    170   // hung view, and no details are expected.
    171   NOTIFICATION_RENDERER_PROCESS_HANG,
    172 
    173   // This is sent to notify that the RenderViewHost displayed in a WebContents
    174   // has changed.  Source is the NavigationController for which the change
    175   // happened, details is a
    176   // std::pair::<old RenderViewHost, new RenderViewHost>).
    177   NOTIFICATION_RENDER_VIEW_HOST_CHANGED,
    178 
    179   // This is sent when a RenderWidgetHost is being destroyed. The source is
    180   // the RenderWidgetHost, the details are not used.
    181   NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED,
    182 
    183   // Sent after the backing store has been updated but before the widget has
    184   // painted. The source is the RenderWidgetHost, the details are not used.
    185   NOTIFICATION_RENDER_WIDGET_HOST_DID_UPDATE_BACKING_STORE,
    186 
    187   // This notifies the observer that a PaintAtSizeACK was received. The source
    188   // is the RenderWidgetHost, the details are an instance of
    189   // std::pair<int, gfx::Size>.
    190   NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK,
    191 
    192   // This notifies the observer that a HandleInputEventACK was received. The
    193   // source is the RenderWidgetHost, the details are the type of event
    194   // received.
    195   // Note: The RenderWidgetHost may be deallocated at this point.
    196   // Used only in testing.
    197   NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_INPUT_EVENT_ACK,
    198 
    199   // Sent from RenderViewHost::ClosePage.  The hosted RenderView has
    200   // processed the onbeforeunload handler and is about to be sent a
    201   // ViewMsg_ClosePage message to complete the tear-down process.  The source
    202   // is the RenderViewHost sending the message, and no details are provided.
    203   // Note:  This message is not sent in response to RenderView closure
    204   // initiated by window.close().
    205   NOTIFICATION_RENDER_VIEW_HOST_WILL_CLOSE_RENDER_VIEW,
    206 
    207   // This notifies the observer that the drag operation ack in a drag and
    208   // drop operation was received. The source is the RenderViewHost.
    209   // Note: Used only in testing.
    210   NOTIFICATION_RENDER_VIEW_HOST_DID_RECEIVE_DRAG_TARGET_DROP_ACK,
    211 
    212   // Indicates a RenderWidgetHost has been hidden or restored. The source is
    213   // the RWH whose visibility changed, the details is a bool set to true if
    214   // the new state is "visible."
    215   NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED,
    216 
    217   // The focused element inside a page has changed.  The source is the
    218   // RenderViewHost. The details is a Details<const bool> that indicates whether
    219   // or not an editable node was focused.
    220   NOTIFICATION_FOCUS_CHANGED_IN_PAGE,
    221 
    222   // Notification from WebContents that we have received a response from the
    223   // renderer in response to a dom automation controller action. The source is
    224   // the RenderViewHost, and the details is a DomOperationNotificationDetails.
    225   NOTIFICATION_DOM_OPERATION_RESPONSE,
    226 
    227   // Custom notifications used by the embedder should start from here.
    228   NOTIFICATION_CONTENT_END,
    229 };
    230 
    231 }  // namespace content
    232 
    233 #endif  // CONTENT_PUBLIC_BROWSER_NOTIFICATION_TYPES_H_
    234