| Index: chrome/browser/android/history_report/delta_file_commons.h
|
| diff --git a/chrome/browser/android/history_report/delta_file_commons.h b/chrome/browser/android/history_report/delta_file_commons.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..2c2cd306002b67e816baa49847a1d552f16ec1e7
|
| --- /dev/null
|
| +++ b/chrome/browser/android/history_report/delta_file_commons.h
|
| @@ -0,0 +1,72 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CHROME_BROWSER_ANDROID_HISTORY_REPORT_DELTA_FILE_COMMONS_H_
|
| +#define CHROME_BROWSER_ANDROID_HISTORY_REPORT_DELTA_FILE_COMMONS_H_
|
| +
|
| +#include "base/basictypes.h"
|
| +#include "base/strings/string16.h"
|
| +#include "chrome/browser/android/proto/delta_file.pb.h"
|
| +#include "components/bookmarks/browser/bookmark_model.h"
|
| +#include "components/history/core/browser/history_types.h"
|
| +
|
| +class GURL;
|
| +
|
| +namespace history_report {
|
| +
|
| +// Represents a single delta file entry with additional data.
|
| +class DeltaFileEntryWithData {
|
| + public:
|
| + explicit DeltaFileEntryWithData(DeltaFileEntry entry);
|
| + ~DeltaFileEntryWithData();
|
| +
|
| + // Returns sequence number of this delta file entry.
|
| + int64 SeqNo() const;
|
| +
|
| + // Returns type of delta file entry ('add' or 'del').
|
| + std::string Type() const;
|
| +
|
| + // Returns ID of delta file entry.
|
| + std::string Id() const;
|
| +
|
| + // Returns url of delta file entry.
|
| + std::string Url() const;
|
| +
|
| + // Returns title of delta file entry.
|
| + base::string16 Title() const;
|
| +
|
| + // Returns ranking score of url described by delta file entry.
|
| + int32 Score() const;
|
| +
|
| + // Returns part of delta file entry's url
|
| + // which will be used as a key in search index.
|
| + std::string IndexedUrl() const;
|
| +
|
| + // Checks if delta file entry is valid and can be returned as a result.
|
| + // Entries with missing data or the one that are hidden are not valid.
|
| + bool Valid() const;
|
| +
|
| + // Adds additional data to delta file entry.
|
| + void SetData(const history::URLRow& data);
|
| +
|
| + // Marks delta file entry as bookmark.
|
| + void MarkAsBookmark(const bookmarks::BookmarkModel::URLAndTitle& bookmark);
|
| +
|
| + // Whether given url can be used as Id.
|
| + static bool IsValidId(const std::string& url);
|
| +
|
| + // Generates a unique id for a given url
|
| + static std::string UrlToId(const std::string& url);
|
| +
|
| + private:
|
| + DeltaFileEntry entry_;
|
| + bool data_set_;
|
| + history::URLRow data_;
|
| + bool is_bookmark_;
|
| + base::string16 bookmark_title_;
|
| +};
|
| +
|
| +} // namespace history_report
|
| +
|
| +#endif // CHROME_BROWSER_ANDROID_HISTORY_REPORT_DELTA_FILE_COMMONS_H_
|
|
|