OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef CHROME_BROWSER_ANDROID_HISTORY_REPORT_DELTA_FILE_COMMONS_H_ |
| 6 #define CHROME_BROWSER_ANDROID_HISTORY_REPORT_DELTA_FILE_COMMONS_H_ |
| 7 |
| 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" |
| 13 |
| 14 class GURL; |
| 15 |
| 16 namespace history_report { |
| 17 |
| 18 // Represents a single delta file entry with additional data. |
| 19 class DeltaFileEntryWithData { |
| 20 public: |
| 21 explicit DeltaFileEntryWithData(DeltaFileEntry entry); |
| 22 ~DeltaFileEntryWithData(); |
| 23 |
| 24 // Returns sequence number of this delta file entry. |
| 25 int64 SeqNo() const; |
| 26 |
| 27 // Returns type of delta file entry ('add' or 'del'). |
| 28 std::string Type() const; |
| 29 |
| 30 // Returns ID of delta file entry. |
| 31 std::string Id() const; |
| 32 |
| 33 // Returns url of delta file entry. |
| 34 std::string Url() const; |
| 35 |
| 36 // Returns title of delta file entry. |
| 37 base::string16 Title() const; |
| 38 |
| 39 // Returns ranking score of url described by delta file entry. |
| 40 int32 Score() const; |
| 41 |
| 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; |
| 45 |
| 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; |
| 49 |
| 50 // Adds additional data to delta file entry. |
| 51 void SetData(const history::URLRow& data); |
| 52 |
| 53 // Marks delta file entry as bookmark. |
| 54 void MarkAsBookmark(const bookmarks::BookmarkModel::URLAndTitle& bookmark); |
| 55 |
| 56 // Whether given url can be used as Id. |
| 57 static bool IsValidId(const std::string& url); |
| 58 |
| 59 // Generates a unique id for a given url |
| 60 static std::string UrlToId(const std::string& url); |
| 61 |
| 62 private: |
| 63 DeltaFileEntry entry_; |
| 64 bool data_set_; |
| 65 history::URLRow data_; |
| 66 bool is_bookmark_; |
| 67 base::string16 bookmark_title_; |
| 68 }; |
| 69 |
| 70 } // namespace history_report |
| 71 |
| 72 #endif // CHROME_BROWSER_ANDROID_HISTORY_REPORT_DELTA_FILE_COMMONS_H_ |
OLD | NEW |