Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(207)

Side by Side Diff: components/bookmarks/core/browser/bookmark_match.h

Issue 184663002: Omnibox: Make URLs of Bookmarks Searchable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix ALL_MATCHES (in response to recent changes) Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « components/bookmarks.gypi ('k') | components/bookmarks/core/browser/bookmark_match.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_BOOKMARKS_CORE_BROWSER_BOOKMARK_TITLE_MATCH_H_ 5 #ifndef COMPONENTS_BOOKMARKS_CORE_BROWSER_BOOKMARK_TITLE_MATCH_H_
6 #define COMPONENTS_BOOKMARKS_CORE_BROWSER_BOOKMARK_TITLE_MATCH_H_ 6 #define COMPONENTS_BOOKMARKS_CORE_BROWSER_BOOKMARK_TITLE_MATCH_H_
7 7
8 #include <stddef.h> 8 #include <cstddef>
9
10 #include <utility> 9 #include <utility>
11 #include <vector> 10 #include <vector>
12 11
13 class BookmarkNode; 12 class BookmarkNode;
14 13
15 struct BookmarkTitleMatch { 14 struct BookmarkMatch {
16 // Each MatchPosition is the [begin, end) positions of a match within a 15 // Each MatchPosition is the [begin, end) positions of a match within a
17 // string. 16 // string.
18 typedef std::pair<size_t, size_t> MatchPosition; 17 typedef std::pair<size_t, size_t> MatchPosition;
19 typedef std::vector<MatchPosition> MatchPositions; 18 typedef std::vector<MatchPosition> MatchPositions;
20 19
21 BookmarkTitleMatch(); 20 BookmarkMatch();
22 ~BookmarkTitleMatch(); 21 ~BookmarkMatch();
22
23 // Extracts and returns the offsets from |match_positions|.
24 static std::vector<size_t> OffsetsFromMatchPositions(
25 const MatchPositions& match_positions);
26
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
29 // positions.
30 static MatchPositions ReplaceOffsetsInMatchPositions(
31 const MatchPositions& match_positions,
32 const std::vector<size_t>& offsets);
23 33
24 // The matching node of a query. 34 // The matching node of a query.
25 const BookmarkNode* node; 35 const BookmarkNode* node;
26 36
27 // Location of the matching words in the title of the node. 37 // Location of the matching words in the title of the node.
28 MatchPositions match_positions; 38 MatchPositions title_match_positions;
39
40 // Location of the matching words in the URL of the node.
41 MatchPositions url_match_positions;
29 }; 42 };
30 43
31 #endif // COMPONENTS_BOOKMARKS_CORE_BROWSER_BOOKMARK_TITLE_MATCH_H_ 44 #endif // COMPONENTS_BOOKMARKS_CORE_BROWSER_BOOKMARK_TITLE_MATCH_H_
OLDNEW
« no previous file with comments | « components/bookmarks.gypi ('k') | components/bookmarks/core/browser/bookmark_match.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698