history_notifications.h revision 3345a6884c488ff3a535c2c9acdd33d74b37e311
1// Copyright (c) 2006-2008 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#pragma once
10
11#include <set>
12#include <vector>
13
14#include "googleurl/src/gurl.h"
15#include "chrome/browser/history/history_types.h"
16
17namespace history {
18
19// Base class for history notifications. This needs only a virtual destructor
20// so that the history service's broadcaster can delete it when the request
21// is complete.
22struct HistoryDetails {
23 public:
24  virtual ~HistoryDetails() {}
25};
26
27// Details for HISTORY_URL_VISITED.
28struct URLVisitedDetails : public HistoryDetails {
29  PageTransition::Type transition;
30  URLRow row;
31
32  // A list of redirects leading up to the URL represented by this struct. If
33  // we have the redirect chain A -> B -> C and this struct represents visiting
34  // C, then redirects[0]=B and redirects[1]=A.  If there are no redirects,
35  // this will be an empty vector.
36  history::RedirectList redirects;
37};
38
39// Details for NOTIFY_HISTORY_TYPED_URLS_MODIFIED.
40struct URLsModifiedDetails : public HistoryDetails {
41  // Lists the information for each of the URLs affected.
42  std::vector<URLRow> changed_urls;
43};
44
45// Details for NOTIFY_HISTORY_URLS_DELETED.
46struct URLsDeletedDetails : public HistoryDetails {
47  // Set when all history was deleted. False means just a subset was deleted.
48  bool all_history;
49
50  // The list of unique URLs affected. This is valid only when a subset of
51  // history is deleted. When all of it is deleted, this will be empty, since
52  // we do not bother to list all URLs.
53  std::set<GURL> urls;
54};
55
56// Details for NOTIFY_URLS_STARRED.
57struct URLsStarredDetails : public HistoryDetails {
58  explicit URLsStarredDetails(bool being_starred) : starred(being_starred) {}
59
60  // The new starred state of the list of URLs. True when they are being
61  // starred, false when they are being unstarred.
62  bool starred;
63
64  // The list of URLs that are changing.
65  std::set<GURL> changed_urls;
66};
67
68// Details for NOTIFY_FAVICON_CHANGED.
69struct FavIconChangeDetails : public HistoryDetails {
70  std::set<GURL> urls;
71};
72
73}  // namespace history
74
75#endif  // CHROME_BROWSER_HISTORY_HISTORY_NOTIFICATIONS_H__
76