- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / history / page_usage_data.h
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_PAGE_USAGE_DATA_H__
6 #define CHROME_BROWSER_HISTORY_PAGE_USAGE_DATA_H__
7
8 #include "base/strings/string16.h"
9 #include "base/time/time.h"
10 #include "chrome/browser/history/history_types.h"
11 #include "url/gurl.h"
12
13 class SkBitmap;
14
15 /////////////////////////////////////////////////////////////////////////////
16 //
17 // PageUsageData
18 //
19 // A per domain usage data structure to compute and manage most visited
20 // pages.
21 //
22 // See History::QueryPageUsageSince()
23 //
24 /////////////////////////////////////////////////////////////////////////////
25 class PageUsageData {
26  public:
27   explicit PageUsageData(history::SegmentID id);
28
29   virtual ~PageUsageData();
30
31   // Return the url ID
32   history::SegmentID GetID() const {
33     return id_;
34   }
35
36   void SetURL(const GURL& url) {
37     url_ = url;
38   }
39
40   const GURL& GetURL() const {
41     return url_;
42   }
43
44   void SetTitle(const string16& s) {
45     title_ = s;
46   }
47
48   const string16& GetTitle() const {
49     return title_;
50   }
51
52   void SetScore(double v) {
53     score_ = v;
54   }
55
56   double GetScore() const {
57     return score_;
58   }
59
60   void SetDuration(base::TimeDelta duration) {
61     duration_ = duration;
62   }
63
64   base::TimeDelta duration() const {
65     return duration_;
66   }
67
68   // Sort predicate to sort instances by score (high to low)
69   static bool Predicate(const PageUsageData* dud1, const PageUsageData* dud2);
70
71  private:
72   history::SegmentID id_;
73   GURL url_;
74   string16 title_;
75
76   double score_;
77
78   // Duration is only set by QuerySegmentDurationSince().
79   base::TimeDelta duration_;
80 };
81
82 #endif  // CHROME_BROWSER_HISTORY_PAGE_USAGE_DATA_H__