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