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

Unified Diff: chrome/browser/bookmarks/bookmark_match.h

Issue 184663002: Omnibox: Make URLs of Bookmarks Searchable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tested; works 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/bookmarks/bookmark_match.h
diff --git a/chrome/browser/bookmarks/bookmark_match.h b/chrome/browser/bookmarks/bookmark_match.h
new file mode 100644
index 0000000000000000000000000000000000000000..3869541201157f9b7ce765372c15c89f8233905c
--- /dev/null
+++ b/chrome/browser/bookmarks/bookmark_match.h
@@ -0,0 +1,45 @@
+// Copyright 2013 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_BOOKMARKS_BOOKMARK_MATCH_H_
+#define CHROME_BROWSER_BOOKMARKS_BOOKMARK_MATCH_H_
+
+#include <stddef.h>
Peter Kasting 2014/04/16 23:44:25 Nit: If this is needed for size_t, include <cstdde
Mark P 2014/04/17 20:24:18 Appears unnecessary. Removing. (It was in the ori
+
+#include <utility>
+#include <vector>
+
+class BookmarkNode;
+
+struct BookmarkMatch {
+ // Each MatchPosition is the [begin, end) positions of a match within a
+ // string.
+ typedef std::pair<size_t, size_t> MatchPosition;
+ typedef std::vector<MatchPosition> MatchPositions;
+
+ BookmarkMatch();
+ ~BookmarkMatch();
+
+ // Extracts and returns the offsets from |match_positions|.
+ static std::vector<size_t> OffsetsFromMatchPositions(
+ const MatchPositions& match_positions);
+
+ // Replaces the offsets in |match_positions| with those given in |offsets|,
+ // deleting any which are npos, and returns the updated list of match
+ // positions.
+ static MatchPositions ReplaceOffsetsInMatchPositions(
+ const MatchPositions& match_positions,
+ const std::vector<size_t>& offsets);
+
+ // The matching node of a query.
+ const BookmarkNode* node;
+
+ // Location of the matching words in the title of the node.
+ MatchPositions title_match_positions;
+
+ // Location of the matching words in the URL of the node.
+ MatchPositions url_match_positions;
+};
+
+#endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_MATCH_H_

Powered by Google App Engine
This is Rietveld 408576698