| 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_PAGE_USAGE_DATA_H__ | 5 #ifndef COMPONENTS_HISTORY_CORE_BROWSER_PAGE_USAGE_DATA_H__ |
| 6 #define COMPONENTS_HISTORY_CORE_BROWSER_PAGE_USAGE_DATA_H__ | 6 #define COMPONENTS_HISTORY_CORE_BROWSER_PAGE_USAGE_DATA_H__ |
| 7 | 7 |
| 8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
| 9 #include "components/history/core/browser/history_types.h" | 9 #include "components/history/core/browser/history_types.h" |
| 10 #include "url/gurl.h" | 10 #include "url/gurl.h" |
| 11 | 11 |
| 12 class SkBitmap; | 12 class SkBitmap; |
| 13 | 13 |
| 14 namespace history { |
| 15 |
| 14 ///////////////////////////////////////////////////////////////////////////// | 16 ///////////////////////////////////////////////////////////////////////////// |
| 15 // | 17 // |
| 16 // PageUsageData | 18 // PageUsageData |
| 17 // | 19 // |
| 18 // A per domain usage data structure to compute and manage most visited | 20 // A per domain usage data structure to compute and manage most visited |
| 19 // pages. | 21 // pages. |
| 20 // | 22 // |
| 21 // See History::QueryPageUsageSince() | 23 // See QueryPageUsageSince() |
| 22 // | 24 // |
| 23 ///////////////////////////////////////////////////////////////////////////// | 25 ///////////////////////////////////////////////////////////////////////////// |
| 24 class PageUsageData { | 26 class PageUsageData { |
| 25 public: | 27 public: |
| 26 explicit PageUsageData(history::SegmentID id); | 28 explicit PageUsageData(SegmentID id); |
| 27 | 29 |
| 28 virtual ~PageUsageData(); | 30 virtual ~PageUsageData(); |
| 29 | 31 |
| 30 // Return the url ID | 32 // Return the url ID |
| 31 history::SegmentID GetID() const { | 33 SegmentID GetID() const { return id_; } |
| 32 return id_; | |
| 33 } | |
| 34 | 34 |
| 35 void SetURL(const GURL& url) { | 35 void SetURL(const GURL& url) { |
| 36 url_ = url; | 36 url_ = url; |
| 37 } | 37 } |
| 38 | 38 |
| 39 const GURL& GetURL() const { | 39 const GURL& GetURL() const { |
| 40 return url_; | 40 return url_; |
| 41 } | 41 } |
| 42 | 42 |
| 43 void SetTitle(const base::string16& s) { | 43 void SetTitle(const base::string16& s) { |
| 44 title_ = s; | 44 title_ = s; |
| 45 } | 45 } |
| 46 | 46 |
| 47 const base::string16& GetTitle() const { | 47 const base::string16& GetTitle() const { |
| 48 return title_; | 48 return title_; |
| 49 } | 49 } |
| 50 | 50 |
| 51 void SetScore(double v) { | 51 void SetScore(double v) { |
| 52 score_ = v; | 52 score_ = v; |
| 53 } | 53 } |
| 54 | 54 |
| 55 double GetScore() const { | 55 double GetScore() const { |
| 56 return score_; | 56 return score_; |
| 57 } | 57 } |
| 58 | 58 |
| 59 // Sort predicate to sort instances by score (high to low) | 59 // Sort predicate to sort instances by score (high to low) |
| 60 static bool Predicate(const PageUsageData* dud1, const PageUsageData* dud2); | 60 static bool Predicate(const PageUsageData* dud1, const PageUsageData* dud2); |
| 61 | 61 |
| 62 private: | 62 private: |
| 63 history::SegmentID id_; | 63 SegmentID id_; |
| 64 GURL url_; | 64 GURL url_; |
| 65 base::string16 title_; | 65 base::string16 title_; |
| 66 | 66 |
| 67 double score_; | 67 double score_; |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 } // namespace history |
| 71 |
| 70 #endif // COMPONENTS_HISTORY_CORE_BROWSER_PAGE_USAGE_DATA_H__ | 72 #endif // COMPONENTS_HISTORY_CORE_BROWSER_PAGE_USAGE_DATA_H__ |
| OLD | NEW |