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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_BOOKMARKS_CORE_BROWSER_BOOKMARK_TITLE_MATCH_H_
6 #define COMPONENTS_BOOKMARKS_CORE_BROWSER_BOOKMARK_TITLE_MATCH_H_
14 struct BookmarkMatch {
15 // Each MatchPosition is the [begin, end) positions of a match within a
17 typedef std::pair<size_t, size_t> MatchPosition;
18 typedef std::vector<MatchPosition> MatchPositions;
23 // Extracts and returns the offsets from |match_positions|.
24 static std::vector<size_t> OffsetsFromMatchPositions(
25 const MatchPositions& match_positions);
27 // Replaces the offsets in |match_positions| with those given in |offsets|,
28 // deleting any which are npos, and returns the updated list of match
30 static MatchPositions ReplaceOffsetsInMatchPositions(
31 const MatchPositions& match_positions,
32 const std::vector<size_t>& offsets);
34 // The matching node of a query.
35 const BookmarkNode* node;
37 // Location of the matching words in the title of the node.
38 MatchPositions title_match_positions;
40 // Location of the matching words in the URL of the node.
41 MatchPositions url_match_positions;
44 #endif // COMPONENTS_BOOKMARKS_CORE_BROWSER_BOOKMARK_TITLE_MATCH_H_