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 #ifndef CHROME_BROWSER_HISTORY_HISTORY_TYPES_H_ 6 #define CHROME_BROWSER_HISTORY_HISTORY_TYPES_H_ 7 8 #include <deque> 9 #include <map> 10 #include <set> 11 #include <string> 12 #include <vector> 13 14 #include "base/basictypes.h" 15 #include "base/containers/stack_container.h" 16 #include "base/memory/ref_counted_memory.h" 17 #include "base/memory/scoped_vector.h" 18 #include "base/strings/string16.h" 19 #include "base/time/time.h" 20 #include "chrome/browser/history/snippet.h" 21 #include "chrome/browser/search_engines/template_url_id.h" 22 #include "chrome/common/favicon/favicon_types.h" 23 #include "chrome/common/ref_counted_util.h" 24 #include "chrome/common/thumbnail_score.h" 25 #include "content/public/common/page_transition_types.h" 26 #include "ui/gfx/image/image.h" 27 #include "ui/gfx/size.h" 28 #include "url/gurl.h" 29 30 class PageUsageData; 31 32 namespace history { 33 34 // Forward declaration for friend statements. 35 class HistoryBackend; 36 class URLDatabase; 37 38 // Structure to hold redirect lists for URLs. For a redirect chain 39 // A -> B -> C, and entry in the map would look like "A => {B -> C}". 40 typedef std::map<GURL, scoped_refptr<RefCountedVector<GURL> > > RedirectMap; 41 42 // Container for a list of URLs. 43 typedef std::vector<GURL> RedirectList; 44 45 typedef int64 FaviconBitmapID; // Identifier for a bitmap in a favicon. 46 typedef int64 SegmentID; // URL segments for the most visited view. 47 typedef int64 SegmentDurationID; // Unique identifier for segment_duration. 48 typedef int64 IconMappingID; // For page url and icon mapping. 49 50 // URLRow --------------------------------------------------------------------- 51 52 typedef int64 URLID; 53 54 // Holds all information globally associated with one URL (one row in the 55 // URL table). 56 // 57 // This keeps track of dirty bits, which are currently unused: 58 // 59 // TODO(brettw) the dirty bits are broken in a number of respects. First, the 60 // database will want to update them on a const object, so they need to be 61 // mutable. 62 // 63 // Second, there is a problem copying. If you make a copy of this structure 64 // (as we allow since we put this into vectors in various places) then the 65 // dirty bits will not be in sync for these copies. 66 class URLRow { 67 public: 68 URLRow(); 69 70 explicit URLRow(const GURL& url); 71 72 // We need to be able to set the id of a URLRow that's being passed through 73 // an IPC message. This constructor should probably not be used otherwise. 74 URLRow(const GURL& url, URLID id); 75 76 virtual ~URLRow(); 77 URLRow& operator=(const URLRow& other); 78 79 URLID id() const { return id_; } 80 81 // Sets the id of the row. The id should only be manually set when a row has 82 // been retrieved from the history database or other dataset based on criteria 83 // other than its id (i.e. by URL) and when the id has not yet been set in the 84 // row. 85 void set_id(URLID id) { id_ = id; } 86 87 const GURL& url() const { return url_; } 88 89 const base::string16& title() const { 90 return title_; 91 } 92 void set_title(const base::string16& title) { 93 // The title is frequently set to the same thing, so we don't bother 94 // updating unless the string has changed. 95 if (title != title_) { 96 title_ = title; 97 } 98 } 99 100 // The number of times this URL has been visited. This will often match the 101 // number of entries in the visit table for this URL, but won't always. It's 102 // really designed for autocomplete ranking, so some "useless" transitions 103 // from the visit table aren't counted in this tally. 104 int visit_count() const { 105 return visit_count_; 106 } 107 void set_visit_count(int visit_count) { 108 visit_count_ = visit_count; 109 } 110 111 // Number of times the URL was typed in the Omnibox. This "should" match 112 // the number of TYPED transitions in the visit table. It's used primarily 113 // for faster autocomplete ranking. If you need to know the actual number of 114 // TYPED transitions, you should query the visit table since there could be 115 // something out of sync. 116 int typed_count() const { 117 return typed_count_; 118 } 119 void set_typed_count(int typed_count) { 120 typed_count_ = typed_count; 121 } 122 123 base::Time last_visit() const { 124 return last_visit_; 125 } 126 void set_last_visit(base::Time last_visit) { 127 last_visit_ = last_visit; 128 } 129 130 // If this is set, we won't autocomplete this URL. 131 bool hidden() const { 132 return hidden_; 133 } 134 void set_hidden(bool hidden) { 135 hidden_ = hidden; 136 } 137 138 // Helper functor that determines if an URLRow refers to a given URL. 139 class URLRowHasURL { 140 public: 141 explicit URLRowHasURL(const GURL& url) : url_(url) {} 142 143 bool operator()(const URLRow& row) { 144 return row.url() == url_; 145 } 146 147 private: 148 const GURL& url_; 149 }; 150 151 protected: 152 // Swaps the contents of this URLRow with another, which allows it to be 153 // destructively copied without memory allocations. 154 void Swap(URLRow* other); 155 156 private: 157 // This class writes directly into this structure and clears our dirty bits 158 // when reading out of the DB. 159 friend class URLDatabase; 160 friend class HistoryBackend; 161 162 // Initializes all values that need initialization to their defaults. 163 // This excludes objects which autoinitialize such as strings. 164 void Initialize(); 165 166 // The row ID of this URL from the history database. This is immutable except 167 // when retrieving the row from the database or when determining if the URL 168 // referenced by the URLRow already exists in the database. 169 URLID id_; 170 171 // The URL of this row. Immutable except for the database which sets it 172 // when it pulls them out. If clients want to change it, they must use 173 // the constructor to make a new one. 174 GURL url_; 175 176 base::string16 title_; 177 178 // Total number of times this URL has been visited. 179 int visit_count_; 180 181 // Number of times this URL has been manually entered in the URL bar. 182 int typed_count_; 183 184 // The date of the last visit of this URL, which saves us from having to 185 // loop up in the visit table for things like autocomplete and expiration. 186 base::Time last_visit_; 187 188 // Indicates this entry should now be shown in typical UI or queries, this 189 // is usually for subframes. 190 bool hidden_; 191 192 // We support the implicit copy constuctor and operator=. 193 }; 194 typedef std::vector<URLRow> URLRows; 195 196 // The enumeration of all possible sources of visits is listed below. 197 // The source will be propagated along with a URL or a visit item 198 // and eventually be stored in the history database, 199 // visit_source table specifically. 200 // Different from page transition types, they describe the origins of visits. 201 // (Warning): Please don't change any existing values while it is ok to add 202 // new values when needed. 203 enum VisitSource { 204 SOURCE_SYNCED = 0, // Synchronized from somewhere else. 205 SOURCE_BROWSED = 1, // User browsed. 206 SOURCE_EXTENSION = 2, // Added by an extension. 207 SOURCE_FIREFOX_IMPORTED = 3, 208 SOURCE_IE_IMPORTED = 4, 209 SOURCE_SAFARI_IMPORTED = 5, 210 }; 211 212 typedef int64 VisitID; 213 // Structure to hold the mapping between each visit's id and its source. 214 typedef std::map<VisitID, VisitSource> VisitSourceMap; 215 216 // VisitRow ------------------------------------------------------------------- 217 218 // Holds all information associated with a specific visit. A visit holds time 219 // and referrer information for one time a URL is visited. 220 class VisitRow { 221 public: 222 VisitRow(); 223 VisitRow(URLID arg_url_id, 224 base::Time arg_visit_time, 225 VisitID arg_referring_visit, 226 content::PageTransition arg_transition, 227 SegmentID arg_segment_id); 228 ~VisitRow(); 229 230 // ID of this row (visit ID, used a a referrer for other visits). 231 VisitID visit_id; 232 233 // Row ID into the URL table of the URL that this page is. 234 URLID url_id; 235 236 base::Time visit_time; 237 238 // Indicates another visit that was the referring page for this one. 239 // 0 indicates no referrer. 240 VisitID referring_visit; 241 242 // A combination of bits from PageTransition. 243 content::PageTransition transition; 244 245 // The segment id (see visitsegment_database.*). 246 // If 0, the segment id is null in the table. 247 SegmentID segment_id; 248 249 // Record how much time a user has this visit starting from the user 250 // opened this visit to the user closed or ended this visit. 251 // This includes both active and inactive time as long as 252 // the visit was present. 253 base::TimeDelta visit_duration; 254 255 // Compares two visits based on dates, for sorting. 256 bool operator<(const VisitRow& other) { 257 return visit_time < other.visit_time; 258 } 259 260 // We allow the implicit copy constuctor and operator=. 261 }; 262 263 // We pass around vectors of visits a lot 264 typedef std::vector<VisitRow> VisitVector; 265 266 // The basic information associated with a visit (timestamp, type of visit), 267 // used by HistoryBackend::AddVisits() to create new visits for a URL. 268 typedef std::pair<base::Time, content::PageTransition> VisitInfo; 269 270 // PageVisit ------------------------------------------------------------------ 271 272 // Represents a simplified version of a visit for external users. Normally, 273 // views are only interested in the time, and not the other information 274 // associated with a VisitRow. 275 struct PageVisit { 276 URLID page_id; 277 base::Time visit_time; 278 }; 279 280 // URLResult ------------------------------------------------------------------- 281 282 class URLResult : public URLRow { 283 public: 284 URLResult(); 285 URLResult(const GURL& url, base::Time visit_time); 286 // Constructor that create a URLResult from the specified URL and title match 287 // positions from title_matches. 288 URLResult(const GURL& url, const Snippet::MatchPositions& title_matches); 289 explicit URLResult(const URLRow& url_row); 290 virtual ~URLResult(); 291 292 base::Time visit_time() const { return visit_time_; } 293 void set_visit_time(base::Time visit_time) { visit_time_ = visit_time; } 294 295 const Snippet& snippet() const { return snippet_; } 296 297 bool blocked_visit() const { return blocked_visit_; } 298 void set_blocked_visit(bool blocked_visit) { 299 blocked_visit_ = blocked_visit; 300 } 301 302 // If this is a title match, title_match_positions contains an entry for 303 // every word in the title that matched one of the query parameters. Each 304 // entry contains the start and end of the match. 305 const Snippet::MatchPositions& title_match_positions() const { 306 return title_match_positions_; 307 } 308 309 void SwapResult(URLResult* other); 310 311 static bool CompareVisitTime(const URLResult& lhs, const URLResult& rhs); 312 313 private: 314 friend class HistoryBackend; 315 316 // The time that this result corresponds to. 317 base::Time visit_time_; 318 319 // These values are typically set by HistoryBackend. 320 Snippet snippet_; 321 Snippet::MatchPositions title_match_positions_; 322 323 // Whether a managed user was blocked when attempting to visit this URL. 324 bool blocked_visit_; 325 326 // We support the implicit copy constructor and operator=. 327 }; 328 329 // QueryResults ---------------------------------------------------------------- 330 331 // Encapsulates the results of a history query. It supports an ordered list of 332 // URLResult objects, plus an efficient way of looking up the index of each time 333 // a given URL appears in those results. 334 class QueryResults { 335 public: 336 typedef std::vector<URLResult*> URLResultVector; 337 338 QueryResults(); 339 ~QueryResults(); 340 341 // Indicates the first time that the query includes results for (queries are 342 // clipped at the beginning, so it will always include to the end of the time 343 // queried). 344 // 345 // If the number of results was clipped as a result of the max count, this 346 // will be the time of the first query returned. If there were fewer results 347 // than we were allowed to return, this represents the first date considered 348 // in the query (this will be before the first result if there was time 349 // queried with no results). 350 // 351 // TODO(brettw): bug 1203054: This field is not currently set properly! Do 352 // not use until the bug is fixed. 353 base::Time first_time_searched() const { return first_time_searched_; } 354 void set_first_time_searched(base::Time t) { first_time_searched_ = t; } 355 // Note: If you need end_time_searched, it can be added. 356 357 void set_reached_beginning(bool reached) { reached_beginning_ = reached; } 358 bool reached_beginning() { return reached_beginning_; } 359 360 size_t size() const { return results_.size(); } 361 bool empty() const { return results_.empty(); } 362 363 URLResult& back() { return *results_.back(); } 364 const URLResult& back() const { return *results_.back(); } 365 366 URLResult& operator[](size_t i) { return *results_[i]; } 367 const URLResult& operator[](size_t i) const { return *results_[i]; } 368 369 URLResultVector::const_iterator begin() const { return results_.begin(); } 370 URLResultVector::const_iterator end() const { return results_.end(); } 371 URLResultVector::const_reverse_iterator rbegin() const { 372 return results_.rbegin(); 373 } 374 URLResultVector::const_reverse_iterator rend() const { 375 return results_.rend(); 376 } 377 378 // Returns a pointer to the beginning of an array of all matching indices 379 // for entries with the given URL. The array will be |*num_matches| long. 380 // |num_matches| can be NULL if the caller is not interested in the number of 381 // results (commonly it will only be interested in the first one and can test 382 // the pointer for NULL). 383 // 384 // When there is no match, it will return NULL and |*num_matches| will be 0. 385 const size_t* MatchesForURL(const GURL& url, size_t* num_matches) const; 386 387 // Swaps the current result with another. This allows ownership to be 388 // efficiently transferred without copying. 389 void Swap(QueryResults* other); 390 391 // Adds the given result to the map, using swap() on the members to avoid 392 // copying (there are a lot of strings and vectors). This means the parameter 393 // object will be cleared after this call. 394 void AppendURLBySwapping(URLResult* result); 395 396 // Removes all instances of the given URL from the result set. 397 void DeleteURL(const GURL& url); 398 399 // Deletes the given range of items in the result set. 400 void DeleteRange(size_t begin, size_t end); 401 402 private: 403 // Maps the given URL to a list of indices into results_ which identify each 404 // time an entry with that URL appears. Normally, each URL will have one or 405 // very few indices after it, so we optimize this to use statically allocated 406 // memory when possible. 407 typedef std::map<GURL, base::StackVector<size_t, 4> > URLToResultIndices; 408 409 // Inserts an entry into the |url_to_results_| map saying that the given URL 410 // is at the given index in the results_. 411 void AddURLUsageAtIndex(const GURL& url, size_t index); 412 413 // Adds |delta| to each index in url_to_results_ in the range [begin,end] 414 // (this is inclusive). This is used when inserting or deleting. 415 void AdjustResultMap(size_t begin, size_t end, ptrdiff_t delta); 416 417 base::Time first_time_searched_; 418 419 // Whether the query reaches the beginning of the database. 420 bool reached_beginning_; 421 422 // The ordered list of results. The pointers inside this are owned by this 423 // QueryResults object. 424 ScopedVector<URLResult> results_; 425 426 // Maps URLs to entries in results_. 427 URLToResultIndices url_to_results_; 428 429 DISALLOW_COPY_AND_ASSIGN(QueryResults); 430 }; 431 432 // QueryOptions ---------------------------------------------------------------- 433 434 struct QueryOptions { 435 QueryOptions(); 436 437 // The time range to search for matches in. The beginning is inclusive and 438 // the ending is exclusive. Either one (or both) may be null. 439 // 440 // This will match only the one recent visit of a URL. For text search 441 // queries, if the URL was visited in the given time period, but has also 442 // been visited more recently than that, it will not be returned. When the 443 // text query is empty, this will return the most recent visit within the 444 // time range. 445 base::Time begin_time; 446 base::Time end_time; 447 448 // Sets the query time to the last |days_ago| days to the present time. 449 void SetRecentDayRange(int days_ago); 450 451 // The maximum number of results to return. The results will be sorted with 452 // the most recent first, so older results may not be returned if there is not 453 // enough room. When 0, this will return everything (the default). 454 int max_count; 455 456 enum DuplicateHandling { 457 // Omit visits for which there is a more recent visit to the same URL. 458 // Each URL in the results will appear only once. 459 REMOVE_ALL_DUPLICATES, 460 461 // Omit visits for which there is a more recent visit to the same URL on 462 // the same day. Each URL will appear no more than once per day, where the 463 // day is defined by the local timezone. 464 REMOVE_DUPLICATES_PER_DAY, 465 466 // Return all visits without deduping. 467 KEEP_ALL_DUPLICATES 468 }; 469 470 // Allows the caller to specify how duplicate URLs in the result set should 471 // be handled. The default is REMOVE_DUPLICATES. 472 DuplicateHandling duplicate_policy; 473 474 // Helpers to get the effective parameters values, since a value of 0 means 475 // "unspecified". 476 int EffectiveMaxCount() const; 477 int64 EffectiveBeginTime() const; 478 int64 EffectiveEndTime() const; 479 }; 480 481 // KeywordSearchTermVisit ----------------------------------------------------- 482 483 // KeywordSearchTermVisit is returned from GetMostRecentKeywordSearchTerms. It 484 // gives the time and search term of the keyword visit. 485 struct KeywordSearchTermVisit { 486 KeywordSearchTermVisit(); 487 ~KeywordSearchTermVisit(); 488 489 base::string16 term; // The search term that was used. 490 int visits; // The visit count. 491 base::Time time; // The time of the most recent visit. 492 }; 493 494 // KeywordSearchTermRow -------------------------------------------------------- 495 496 // Used for URLs that have a search term associated with them. 497 struct KeywordSearchTermRow { 498 KeywordSearchTermRow(); 499 ~KeywordSearchTermRow(); 500 501 TemplateURLID keyword_id; // ID of the keyword. 502 URLID url_id; // ID of the url. 503 base::string16 term; // The search term that was used. 504 }; 505 506 // MostVisitedURL -------------------------------------------------------------- 507 508 // Holds the per-URL information of the most visited query. 509 struct MostVisitedURL { 510 MostVisitedURL(); 511 MostVisitedURL(const GURL& url, const base::string16& title); 512 MostVisitedURL(const GURL& url, 513 const base::string16& title, 514 const base::Time& last_forced_time); 515 ~MostVisitedURL(); 516 517 GURL url; 518 base::string16 title; 519 520 // If this is a URL for which we want to force a thumbnail, records the last 521 // time it was forced so we can evict it when more recent URLs are requested. 522 // If it's not a forced thumbnail, keep a time of 0. 523 base::Time last_forced_time; 524 525 RedirectList redirects; 526 527 bool operator==(const MostVisitedURL& other) { 528 return url == other.url; 529 } 530 }; 531 532 // FilteredURL ----------------------------------------------------------------- 533 534 // Holds the per-URL information of the filterd url query. 535 struct FilteredURL { 536 struct ExtendedInfo { 537 ExtendedInfo(); 538 // The absolute number of visits. 539 unsigned int total_visits; 540 // The number of visits, as seen by the Most Visited NTP pane. 541 unsigned int visits; 542 // The total number of seconds that the page was open. 543 int64 duration_opened; 544 // The time when the page was last visited. 545 base::Time last_visit_time; 546 }; 547 548 FilteredURL(); 549 explicit FilteredURL(const PageUsageData& data); 550 ~FilteredURL(); 551 552 GURL url; 553 base::string16 title; 554 double score; 555 ExtendedInfo extended_info; 556 }; 557 558 // Navigation ----------------------------------------------------------------- 559 560 // Marshalling structure for AddPage. 561 struct HistoryAddPageArgs { 562 // The default constructor is equivalent to: 563 // 564 // HistoryAddPageArgs( 565 // GURL(), base::Time(), NULL, 0, GURL(), 566 // history::RedirectList(), content::PAGE_TRANSITION_LINK, 567 // SOURCE_BROWSED, false) 568 HistoryAddPageArgs(); 569 HistoryAddPageArgs(const GURL& url, 570 base::Time time, 571 const void* id_scope, 572 int32 page_id, 573 const GURL& referrer, 574 const history::RedirectList& redirects, 575 content::PageTransition transition, 576 VisitSource source, 577 bool did_replace_entry); 578 ~HistoryAddPageArgs(); 579 580 GURL url; 581 base::Time time; 582 583 const void* id_scope; 584 int32 page_id; 585 586 GURL referrer; 587 history::RedirectList redirects; 588 content::PageTransition transition; 589 VisitSource visit_source; 590 bool did_replace_entry; 591 }; 592 593 // TopSites ------------------------------------------------------------------- 594 595 typedef std::vector<MostVisitedURL> MostVisitedURLList; 596 typedef std::vector<FilteredURL> FilteredURLList; 597 598 // Used by TopSites to store the thumbnails. 599 struct Images { 600 Images(); 601 ~Images(); 602 603 scoped_refptr<base::RefCountedMemory> thumbnail; 604 ThumbnailScore thumbnail_score; 605 606 // TODO(brettw): this will eventually store the favicon. 607 // scoped_refptr<base::RefCountedBytes> favicon; 608 }; 609 610 struct MostVisitedURLWithRank { 611 MostVisitedURL url; 612 int rank; 613 }; 614 615 typedef std::vector<MostVisitedURLWithRank> MostVisitedURLWithRankList; 616 617 struct TopSitesDelta { 618 TopSitesDelta(); 619 ~TopSitesDelta(); 620 621 MostVisitedURLList deleted; 622 MostVisitedURLWithRankList added; 623 MostVisitedURLWithRankList moved; 624 }; 625 626 typedef std::map<GURL, scoped_refptr<base::RefCountedBytes> > URLToThumbnailMap; 627 628 // Used when migrating most visited thumbnails out of history and into topsites. 629 struct ThumbnailMigration { 630 ThumbnailMigration(); 631 ~ThumbnailMigration(); 632 633 MostVisitedURLList most_visited; 634 URLToThumbnailMap url_to_thumbnail_map; 635 }; 636 637 typedef std::map<GURL, Images> URLToImagesMap; 638 639 class MostVisitedThumbnails 640 : public base::RefCountedThreadSafe<MostVisitedThumbnails> { 641 public: 642 MostVisitedThumbnails(); 643 644 MostVisitedURLList most_visited; 645 URLToImagesMap url_to_images_map; 646 647 private: 648 friend class base::RefCountedThreadSafe<MostVisitedThumbnails>; 649 virtual ~MostVisitedThumbnails(); 650 651 DISALLOW_COPY_AND_ASSIGN(MostVisitedThumbnails); 652 }; 653 654 // Autocomplete thresholds ----------------------------------------------------- 655 656 // Constants which specify, when considered altogether, 'significant' 657 // history items. These are used to filter out insignificant items 658 // for consideration as autocomplete candidates. 659 extern const int kLowQualityMatchTypedLimit; 660 extern const int kLowQualityMatchVisitLimit; 661 extern const int kLowQualityMatchAgeLimitInDays; 662 663 // Returns the date threshold for considering an history item as significant. 664 base::Time AutocompleteAgeThreshold(); 665 666 // Return true if |row| qualifies as an autocomplete candidate. If |time_cache| 667 // is_null() then this function determines a new time threshold each time it is 668 // called. Since getting system time can be costly (such as for cases where 669 // this function will be called in a loop over many history items), you can 670 // provide a non-null |time_cache| by simply initializing |time_cache| with 671 // AutocompleteAgeThreshold() (or any other desired time in the past). 672 bool RowQualifiesAsSignificant(const URLRow& row, const base::Time& threshold); 673 674 // Favicons ------------------------------------------------------------------- 675 676 // Used for the mapping between the page and icon. 677 struct IconMapping { 678 IconMapping(); 679 ~IconMapping(); 680 681 // The unique id of the mapping. 682 IconMappingID mapping_id; 683 684 // The url of a web page. 685 GURL page_url; 686 687 // The unique id of the icon. 688 chrome::FaviconID icon_id; 689 690 // The url of the icon. 691 GURL icon_url; 692 693 // The type of icon. 694 chrome::IconType icon_type; 695 }; 696 697 // Defines a favicon bitmap and its associated pixel size. 698 struct FaviconBitmapIDSize { 699 FaviconBitmapIDSize(); 700 ~FaviconBitmapIDSize(); 701 702 // The unique id of the favicon bitmap. 703 FaviconBitmapID bitmap_id; 704 705 // The pixel dimensions of the associated bitmap. 706 gfx::Size pixel_size; 707 }; 708 709 // Defines a favicon bitmap stored in the history backend. 710 struct FaviconBitmap { 711 FaviconBitmap(); 712 ~FaviconBitmap(); 713 714 // The unique id of the bitmap. 715 FaviconBitmapID bitmap_id; 716 717 // The id of the favicon to which the bitmap belongs to. 718 chrome::FaviconID icon_id; 719 720 // Time at which |bitmap_data| was last updated. 721 base::Time last_updated; 722 723 // The bits of the bitmap. 724 scoped_refptr<base::RefCountedMemory> bitmap_data; 725 726 // The pixel dimensions of bitmap_data. 727 gfx::Size pixel_size; 728 }; 729 730 // Abbreviated information about a visit. 731 struct BriefVisitInfo { 732 URLID url_id; 733 base::Time time; 734 content::PageTransition transition; 735 }; 736 737 // An observer of VisitDatabase. 738 class VisitDatabaseObserver { 739 public: 740 virtual ~VisitDatabaseObserver(); 741 virtual void OnAddVisit(const BriefVisitInfo& info) = 0; 742 }; 743 744 struct ExpireHistoryArgs { 745 ExpireHistoryArgs(); 746 ~ExpireHistoryArgs(); 747 748 // Sets |begin_time| and |end_time| to the beginning and end of the day (in 749 // local time) on which |time| occurs. 750 void SetTimeRangeForOneDay(base::Time time); 751 752 std::set<GURL> urls; 753 base::Time begin_time; 754 base::Time end_time; 755 }; 756 757 } // namespace history 758 759 #endif // CHROME_BROWSER_HISTORY_HISTORY_TYPES_H_ 760