| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_TYPES_H_ | 5 #ifndef COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_TYPES_H_ |
| 6 #define COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_TYPES_H_ | 6 #define COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_TYPES_H_ |
| 7 | 7 |
| 8 #include <stddef.h> |
| 9 #include <stdint.h> |
| 10 |
| 8 #include <deque> | 11 #include <deque> |
| 9 #include <map> | 12 #include <map> |
| 10 #include <set> | 13 #include <set> |
| 11 #include <string> | 14 #include <string> |
| 12 #include <utility> | 15 #include <utility> |
| 13 #include <vector> | 16 #include <vector> |
| 14 | 17 |
| 15 #include "base/basictypes.h" | |
| 16 #include "base/containers/stack_container.h" | 18 #include "base/containers/stack_container.h" |
| 19 #include "base/macros.h" |
| 17 #include "base/memory/ref_counted_memory.h" | 20 #include "base/memory/ref_counted_memory.h" |
| 18 #include "base/memory/scoped_vector.h" | 21 #include "base/memory/scoped_vector.h" |
| 19 #include "base/strings/string16.h" | 22 #include "base/strings/string16.h" |
| 20 #include "base/time/time.h" | 23 #include "base/time/time.h" |
| 21 #include "components/favicon_base/favicon_types.h" | 24 #include "components/favicon_base/favicon_types.h" |
| 22 #include "components/history/core/browser/history_context.h" | 25 #include "components/history/core/browser/history_context.h" |
| 23 #include "components/history/core/browser/url_row.h" | 26 #include "components/history/core/browser/url_row.h" |
| 24 #include "components/history/core/common/thumbnail_score.h" | 27 #include "components/history/core/common/thumbnail_score.h" |
| 25 #include "ui/base/page_transition_types.h" | 28 #include "ui/base/page_transition_types.h" |
| 26 #include "ui/gfx/geometry/size.h" | 29 #include "ui/gfx/geometry/size.h" |
| 27 #include "url/gurl.h" | 30 #include "url/gurl.h" |
| 28 | 31 |
| 29 namespace history { | 32 namespace history { |
| 30 | 33 |
| 31 // Forward declaration for friend statements. | 34 // Forward declaration for friend statements. |
| 32 class HistoryBackend; | 35 class HistoryBackend; |
| 33 class PageUsageData; | 36 class PageUsageData; |
| 34 class URLDatabase; | 37 class URLDatabase; |
| 35 | 38 |
| 36 // Container for a list of URLs. | 39 // Container for a list of URLs. |
| 37 typedef std::vector<GURL> RedirectList; | 40 typedef std::vector<GURL> RedirectList; |
| 38 | 41 |
| 39 typedef int64 FaviconBitmapID; // Identifier for a bitmap in a favicon. | 42 typedef int64_t FaviconBitmapID; // Identifier for a bitmap in a favicon. |
| 40 typedef int64 SegmentID; // URL segments for the most visited view. | 43 typedef int64_t SegmentID; // URL segments for the most visited view. |
| 41 typedef int64 IconMappingID; // For page url and icon mapping. | 44 typedef int64_t IconMappingID; // For page url and icon mapping. |
| 42 | 45 |
| 43 // The enumeration of all possible sources of visits is listed below. | 46 // The enumeration of all possible sources of visits is listed below. |
| 44 // The source will be propagated along with a URL or a visit item | 47 // The source will be propagated along with a URL or a visit item |
| 45 // and eventually be stored in the history database, | 48 // and eventually be stored in the history database, |
| 46 // visit_source table specifically. | 49 // visit_source table specifically. |
| 47 // Different from page transition types, they describe the origins of visits. | 50 // Different from page transition types, they describe the origins of visits. |
| 48 // (Warning): Please don't change any existing values while it is ok to add | 51 // (Warning): Please don't change any existing values while it is ok to add |
| 49 // new values when needed. | 52 // new values when needed. |
| 50 enum VisitSource { | 53 enum VisitSource { |
| 51 SOURCE_SYNCED = 0, // Synchronized from somewhere else. | 54 SOURCE_SYNCED = 0, // Synchronized from somewhere else. |
| 52 SOURCE_BROWSED = 1, // User browsed. | 55 SOURCE_BROWSED = 1, // User browsed. |
| 53 SOURCE_EXTENSION = 2, // Added by an extension. | 56 SOURCE_EXTENSION = 2, // Added by an extension. |
| 54 SOURCE_FIREFOX_IMPORTED = 3, | 57 SOURCE_FIREFOX_IMPORTED = 3, |
| 55 SOURCE_IE_IMPORTED = 4, | 58 SOURCE_IE_IMPORTED = 4, |
| 56 SOURCE_SAFARI_IMPORTED = 5, | 59 SOURCE_SAFARI_IMPORTED = 5, |
| 57 }; | 60 }; |
| 58 | 61 |
| 59 typedef int64 VisitID; | 62 typedef int64_t VisitID; |
| 60 // Structure to hold the mapping between each visit's id and its source. | 63 // Structure to hold the mapping between each visit's id and its source. |
| 61 typedef std::map<VisitID, VisitSource> VisitSourceMap; | 64 typedef std::map<VisitID, VisitSource> VisitSourceMap; |
| 62 | 65 |
| 63 // VisitRow ------------------------------------------------------------------- | 66 // VisitRow ------------------------------------------------------------------- |
| 64 | 67 |
| 65 // Holds all information associated with a specific visit. A visit holds time | 68 // Holds all information associated with a specific visit. A visit holds time |
| 66 // and referrer information for one time a URL is visited. | 69 // and referrer information for one time a URL is visited. |
| 67 class VisitRow { | 70 class VisitRow { |
| 68 public: | 71 public: |
| 69 VisitRow(); | 72 VisitRow(); |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 KEEP_ALL_DUPLICATES | 268 KEEP_ALL_DUPLICATES |
| 266 }; | 269 }; |
| 267 | 270 |
| 268 // Allows the caller to specify how duplicate URLs in the result set should | 271 // Allows the caller to specify how duplicate URLs in the result set should |
| 269 // be handled. The default is REMOVE_DUPLICATES. | 272 // be handled. The default is REMOVE_DUPLICATES. |
| 270 DuplicateHandling duplicate_policy; | 273 DuplicateHandling duplicate_policy; |
| 271 | 274 |
| 272 // Helpers to get the effective parameters values, since a value of 0 means | 275 // Helpers to get the effective parameters values, since a value of 0 means |
| 273 // "unspecified". | 276 // "unspecified". |
| 274 int EffectiveMaxCount() const; | 277 int EffectiveMaxCount() const; |
| 275 int64 EffectiveBeginTime() const; | 278 int64_t EffectiveBeginTime() const; |
| 276 int64 EffectiveEndTime() const; | 279 int64_t EffectiveEndTime() const; |
| 277 }; | 280 }; |
| 278 | 281 |
| 279 // QueryURLResult ------------------------------------------------------------- | 282 // QueryURLResult ------------------------------------------------------------- |
| 280 | 283 |
| 281 // QueryURLResult encapsulates the result of a call to HistoryBackend::QueryURL. | 284 // QueryURLResult encapsulates the result of a call to HistoryBackend::QueryURL. |
| 282 struct QueryURLResult { | 285 struct QueryURLResult { |
| 283 QueryURLResult(); | 286 QueryURLResult(); |
| 284 ~QueryURLResult(); | 287 ~QueryURLResult(); |
| 285 | 288 |
| 286 // Indicates whether the call to HistoryBackend::QueryURL was successfull | 289 // Indicates whether the call to HistoryBackend::QueryURL was successfull |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 | 336 |
| 334 // Holds the per-URL information of the filterd url query. | 337 // Holds the per-URL information of the filterd url query. |
| 335 struct FilteredURL { | 338 struct FilteredURL { |
| 336 struct ExtendedInfo { | 339 struct ExtendedInfo { |
| 337 ExtendedInfo(); | 340 ExtendedInfo(); |
| 338 // The absolute number of visits. | 341 // The absolute number of visits. |
| 339 unsigned int total_visits; | 342 unsigned int total_visits; |
| 340 // The number of visits, as seen by the Most Visited NTP pane. | 343 // The number of visits, as seen by the Most Visited NTP pane. |
| 341 unsigned int visits; | 344 unsigned int visits; |
| 342 // The total number of seconds that the page was open. | 345 // The total number of seconds that the page was open. |
| 343 int64 duration_opened; | 346 int64_t duration_opened; |
| 344 // The time when the page was last visited. | 347 // The time when the page was last visited. |
| 345 base::Time last_visit_time; | 348 base::Time last_visit_time; |
| 346 }; | 349 }; |
| 347 | 350 |
| 348 FilteredURL(); | 351 FilteredURL(); |
| 349 explicit FilteredURL(const PageUsageData& data); | 352 explicit FilteredURL(const PageUsageData& data); |
| 350 ~FilteredURL(); | 353 ~FilteredURL(); |
| 351 | 354 |
| 352 GURL url; | 355 GURL url; |
| 353 base::string16 title; | 356 base::string16 title; |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 void SetTimeRangeForOneDay(base::Time time); | 537 void SetTimeRangeForOneDay(base::Time time); |
| 535 | 538 |
| 536 std::set<GURL> urls; | 539 std::set<GURL> urls; |
| 537 base::Time begin_time; | 540 base::Time begin_time; |
| 538 base::Time end_time; | 541 base::Time end_time; |
| 539 }; | 542 }; |
| 540 | 543 |
| 541 } // namespace history | 544 } // namespace history |
| 542 | 545 |
| 543 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_TYPES_H_ | 546 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_TYPES_H_ |
| OLD | NEW |