Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / android / history_report / delta_file_commons.h
blob2c2cd306002b67e816baa49847a1d552f16ec1e7
1 // Copyright 2015 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.
5 #ifndef CHROME_BROWSER_ANDROID_HISTORY_REPORT_DELTA_FILE_COMMONS_H_
6 #define CHROME_BROWSER_ANDROID_HISTORY_REPORT_DELTA_FILE_COMMONS_H_
8 #include "base/basictypes.h"
9 #include "base/strings/string16.h"
10 #include "chrome/browser/android/proto/delta_file.pb.h"
11 #include "components/bookmarks/browser/bookmark_model.h"
12 #include "components/history/core/browser/history_types.h"
14 class GURL;
16 namespace history_report {
18 // Represents a single delta file entry with additional data.
19 class DeltaFileEntryWithData {
20 public:
21 explicit DeltaFileEntryWithData(DeltaFileEntry entry);
22 ~DeltaFileEntryWithData();
24 // Returns sequence number of this delta file entry.
25 int64 SeqNo() const;
27 // Returns type of delta file entry ('add' or 'del').
28 std::string Type() const;
30 // Returns ID of delta file entry.
31 std::string Id() const;
33 // Returns url of delta file entry.
34 std::string Url() const;
36 // Returns title of delta file entry.
37 base::string16 Title() const;
39 // Returns ranking score of url described by delta file entry.
40 int32 Score() const;
42 // Returns part of delta file entry's url
43 // which will be used as a key in search index.
44 std::string IndexedUrl() const;
46 // Checks if delta file entry is valid and can be returned as a result.
47 // Entries with missing data or the one that are hidden are not valid.
48 bool Valid() const;
50 // Adds additional data to delta file entry.
51 void SetData(const history::URLRow& data);
53 // Marks delta file entry as bookmark.
54 void MarkAsBookmark(const bookmarks::BookmarkModel::URLAndTitle& bookmark);
56 // Whether given url can be used as Id.
57 static bool IsValidId(const std::string& url);
59 // Generates a unique id for a given url
60 static std::string UrlToId(const std::string& url);
62 private:
63 DeltaFileEntry entry_;
64 bool data_set_;
65 history::URLRow data_;
66 bool is_bookmark_;
67 base::string16 bookmark_title_;
70 } // namespace history_report
72 #endif // CHROME_BROWSER_ANDROID_HISTORY_REPORT_DELTA_FILE_COMMONS_H_