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
17namespace history {
18
19// Details for NOTIFICATION_HISTORY_URL_VISITED.
20struct URLVisitedDetails : public HistoryDetails {
21  URLVisitedDetails();
22  virtual ~URLVisitedDetails();
23
24  content::PageTransition transition;
25  URLRow row;
26
27  // A list of redirects leading up to the URL represented by this struct. If
28  // we have the redirect chain A -> B -> C and this struct represents visiting
29  // C, then redirects[0]=B and redirects[1]=A.  If there are no redirects,
30  // this will be an empty vector.
31  history::RedirectList redirects;
32};
33
34// Details for NOTIFICATION_HISTORY_TYPED_URLS_MODIFIED.
35struct URLsModifiedDetails : public HistoryDetails {
36  URLsModifiedDetails();
37  virtual ~URLsModifiedDetails();
38
39  // Lists the information for each of the URLs affected.
40  URLRows changed_urls;
41};
42
43// Details for NOTIFICATION_HISTORY_URLS_DELETED.
44struct URLsDeletedDetails : public HistoryDetails {
45  URLsDeletedDetails();
46  virtual ~URLsDeletedDetails();
47
48  // Set when all history was deleted. False means just a subset was deleted.
49  bool all_history;
50
51  // True if the data was archived. False if the data was deleted in response to
52  // an explicit user action through the History UI.
53  bool archived;
54
55  // The URLRows of URLs deleted. This is valid only when |all_history| is false
56  // indicating that a subset of history has been deleted.
57  URLRows rows;
58
59  // The list of deleted favicon urls. This is valid only when |all_history| is
60  // false, indicating that a subset of history has been deleted.
61  std::set<GURL> favicon_urls;
62};
63
64// Details for HISTORY_KEYWORD_SEARCH_TERM_UPDATED.
65struct KeywordSearchUpdatedDetails : public HistoryDetails {
66  KeywordSearchUpdatedDetails(const GURL& url,
67                              TemplateURLID keyword_id,
68                              const base::string16& term);
69  virtual ~KeywordSearchUpdatedDetails();
70
71  GURL url;
72  TemplateURLID keyword_id;
73  base::string16 term;
74};
75
76// Details for HISTORY_KEYWORD_SEARCH_TERM_DELETED.
77struct KeywordSearchDeletedDetails : public HistoryDetails {
78  explicit KeywordSearchDeletedDetails(const GURL& url);
79  virtual ~KeywordSearchDeletedDetails();
80
81  GURL url;
82};
83
84}  // namespace history
85
86#endif  // CHROME_BROWSER_HISTORY_HISTORY_NOTIFICATIONS_H__
87