Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / history / history_notifications.h
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 "chrome/browser/history/history_types.h"
14 #include "chrome/browser/search_engines/template_url_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   content::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
37 // Details for NOTIFICATION_HISTORY_TYPED_URLS_MODIFIED.
38 struct URLsModifiedDetails : public HistoryDetails {
39   URLsModifiedDetails();
40   virtual ~URLsModifiedDetails();
41
42   // Lists the information for each of the URLs affected. The rows will have the
43   // IDs that are currently in effect in the main history database.
44   URLRows changed_urls;
45 };
46
47 // Details for NOTIFICATION_HISTORY_URLS_DELETED.
48 struct URLsDeletedDetails : public HistoryDetails {
49   URLsDeletedDetails();
50   virtual ~URLsDeletedDetails();
51
52   // Set when all history was deleted. False means just a subset was deleted.
53   bool all_history;
54
55   // True if the data was archived. False if the data was deleted in response to
56   // an explicit user action through the History UI.
57   bool archived;
58
59   // The URLRows of URLs deleted. This is valid only when |all_history| is false
60   // indicating that a subset of history has been deleted. The rows will have
61   // the IDs that had been in effect before the deletion in the main history
62   // database.
63   URLRows rows;
64
65   // The list of deleted favicon urls. This is valid only when |all_history| is
66   // false, indicating that a subset of history has been deleted.
67   std::set<GURL> favicon_urls;
68 };
69
70 // Details for HISTORY_KEYWORD_SEARCH_TERM_UPDATED.
71 struct KeywordSearchUpdatedDetails : public HistoryDetails {
72   KeywordSearchUpdatedDetails(const URLRow& url_row,
73                               TemplateURLID keyword_id,
74                               const base::string16& term);
75   virtual ~KeywordSearchUpdatedDetails();
76
77   // The affected URLRow. The ID will be set to the value that is currently in
78   // effect in the main history database.
79   URLRow url_row;
80   TemplateURLID keyword_id;
81   base::string16 term;
82 };
83
84 // Details for HISTORY_KEYWORD_SEARCH_TERM_DELETED.
85 struct KeywordSearchDeletedDetails : public HistoryDetails {
86   explicit KeywordSearchDeletedDetails(URLID url_row_id);
87   virtual ~KeywordSearchDeletedDetails();
88
89   // The ID of the corresponding URLRow in the main history database.
90   URLID url_row_id;
91 };
92
93 }  // namespace history
94
95 #endif  // CHROME_BROWSER_HISTORY_HISTORY_NOTIFICATIONS_H__