Home | History | Annotate | Download | only in history
      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 // Structs that hold data used in broadcasting notifications.
      6 
      7 #ifndef CHROME_BROWSER_HISTORY_HISTORY_NOTIFICATIONS_H__
      8 #define CHROME_BROWSER_HISTORY_HISTORY_NOTIFICATIONS_H__
      9 
     10 #include <set>
     11 
     12 #include "chrome/browser/history/history_details.h"
     13 #include "components/history/core/browser/history_types.h"
     14 #include "components/history/core/browser/keyword_id.h"
     15 #include "url/gurl.h"
     16 
     17 namespace history {
     18 
     19 // Details for NOTIFICATION_HISTORY_URL_VISITED.
     20 struct URLVisitedDetails : public HistoryDetails {
     21   URLVisitedDetails();
     22   virtual ~URLVisitedDetails();
     23 
     24   ui::PageTransition transition;
     25 
     26   // The affected URLRow. The ID will be set to the value that is currently in
     27   // effect in the main history database.
     28   URLRow row;
     29 
     30   // A list of redirects leading up to the URL represented by this struct. If
     31   // we have the redirect chain A -> B -> C and this struct represents visiting
     32   // C, then redirects[0]=B and redirects[1]=A.  If there are no redirects,
     33   // this will be an empty vector.
     34   history::RedirectList redirects;
     35 
     36   base::Time visit_time;
     37 };
     38 
     39 // Details for NOTIFICATION_HISTORY_TYPED_URLS_MODIFIED.
     40 struct URLsModifiedDetails : public HistoryDetails {
     41   URLsModifiedDetails();
     42   virtual ~URLsModifiedDetails();
     43 
     44   // Lists the information for each of the URLs affected. The rows will have the
     45   // IDs that are currently in effect in the main history database.
     46   URLRows changed_urls;
     47 };
     48 
     49 // Details for NOTIFICATION_HISTORY_URLS_DELETED.
     50 struct URLsDeletedDetails : public HistoryDetails {
     51   URLsDeletedDetails();
     52   virtual ~URLsDeletedDetails();
     53 
     54   // Set when all history was deleted. False means just a subset was deleted.
     55   bool all_history;
     56 
     57   // True if the data was expired due to old age. False if the data was deleted
     58   // in response to an explicit user action through the History UI.
     59   bool expired;
     60 
     61   // The URLRows of URLs deleted. This is valid only when |all_history| is false
     62   // indicating that a subset of history has been deleted. The rows will have
     63   // the IDs that had been in effect before the deletion in the main history
     64   // database.
     65   URLRows rows;
     66 
     67   // The list of deleted favicon urls. This is valid only when |all_history| is
     68   // false, indicating that a subset of history has been deleted.
     69   std::set<GURL> favicon_urls;
     70 };
     71 
     72 // Details for HISTORY_KEYWORD_SEARCH_TERM_UPDATED.
     73 struct KeywordSearchUpdatedDetails : public HistoryDetails {
     74   KeywordSearchUpdatedDetails(const URLRow& url_row,
     75                               KeywordID keyword_id,
     76                               const base::string16& term);
     77   virtual ~KeywordSearchUpdatedDetails();
     78 
     79   // The affected URLRow. The ID will be set to the value that is currently in
     80   // effect in the main history database.
     81   URLRow url_row;
     82   KeywordID keyword_id;
     83   base::string16 term;
     84 };
     85 
     86 // Details for HISTORY_KEYWORD_SEARCH_TERM_DELETED.
     87 struct KeywordSearchDeletedDetails : public HistoryDetails {
     88   explicit KeywordSearchDeletedDetails(URLID url_row_id);
     89   virtual ~KeywordSearchDeletedDetails();
     90 
     91   // The ID of the corresponding URLRow in the main history database.
     92   URLID url_row_id;
     93 };
     94 
     95 }  // namespace history
     96 
     97 #endif  // CHROME_BROWSER_HISTORY_HISTORY_NOTIFICATIONS_H__
     98