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 #include "chrome/browser/search_engines/template_url_id.h" 17 18 namespace history { 19 20 // Base class for history notifications. This needs only a virtual destructor 21 // so that the history service's broadcaster can delete it when the request 22 // is complete. 23 struct HistoryDetails { 24 public: ~HistoryDetailsHistoryDetails25 virtual ~HistoryDetails() {} 26 }; 27 28 // Details for HISTORY_URL_VISITED. 29 struct URLVisitedDetails : public HistoryDetails { 30 URLVisitedDetails(); 31 virtual ~URLVisitedDetails(); 32 33 PageTransition::Type transition; 34 URLRow row; 35 36 // A list of redirects leading up to the URL represented by this struct. If 37 // we have the redirect chain A -> B -> C and this struct represents visiting 38 // C, then redirects[0]=B and redirects[1]=A. If there are no redirects, 39 // this will be an empty vector. 40 history::RedirectList redirects; 41 }; 42 43 // Details for NOTIFY_HISTORY_TYPED_URLS_MODIFIED. 44 struct URLsModifiedDetails : public HistoryDetails { 45 URLsModifiedDetails(); 46 virtual ~URLsModifiedDetails(); 47 48 // Lists the information for each of the URLs affected. 49 std::vector<URLRow> changed_urls; 50 }; 51 52 // Details for NOTIFY_HISTORY_URLS_DELETED. 53 struct URLsDeletedDetails : public HistoryDetails { 54 URLsDeletedDetails(); 55 virtual ~URLsDeletedDetails(); 56 57 // Set when all history was deleted. False means just a subset was deleted. 58 bool all_history; 59 60 // The list of unique URLs affected. This is valid only when a subset of 61 // history is deleted. When all of it is deleted, this will be empty, since 62 // we do not bother to list all URLs. 63 std::set<GURL> urls; 64 }; 65 66 // Details for NOTIFY_URLS_STARRED. 67 struct URLsStarredDetails : public HistoryDetails { 68 explicit URLsStarredDetails(bool being_starred); 69 virtual ~URLsStarredDetails(); 70 71 // The new starred state of the list of URLs. True when they are being 72 // starred, false when they are being unstarred. 73 bool starred; 74 75 // The list of URLs that are changing. 76 std::set<GURL> changed_urls; 77 }; 78 79 // Details for NOTIFY_FAVICON_CHANGED. 80 struct FaviconChangeDetails : public HistoryDetails { 81 FaviconChangeDetails(); 82 virtual ~FaviconChangeDetails(); 83 84 std::set<GURL> urls; 85 }; 86 87 // Details for HISTORY_KEYWORD_SEARCH_TERM_UPDATED. 88 struct KeywordSearchTermDetails : public HistoryDetails { 89 KeywordSearchTermDetails(); 90 ~KeywordSearchTermDetails(); 91 92 GURL url; 93 TemplateURLID keyword_id; 94 string16 term; 95 }; 96 97 } // namespace history 98 99 #endif // CHROME_BROWSER_HISTORY_HISTORY_NOTIFICATIONS_H__ 100