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

Side by Side Diff: components/query_parser/query_parser.h

Issue 184663002: Omnibox: Make URLs of Bookmarks Searchable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Peter's comments 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
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_QUERY_PARSER_QUERY_PARSER_H_ 5 #ifndef COMPONENTS_QUERY_PARSER_QUERY_PARSER_H_
6 #define COMPONENTS_QUERY_PARSER_QUERY_PARSER_H_ 6 #define COMPONENTS_QUERY_PARSER_QUERY_PARSER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 96
97 // Returns true if all of the |words| match the query |nodes| created by a 97 // Returns true if all of the |words| match the query |nodes| created by a
98 // call to ParseQuery. 98 // call to ParseQuery.
99 bool DoesQueryMatch(const std::vector<QueryWord>& words, 99 bool DoesQueryMatch(const std::vector<QueryWord>& words,
100 const std::vector<QueryNode*>& nodes); 100 const std::vector<QueryNode*>& nodes);
101 101
102 // Extracts the words from |text|, placing each word into |words|. 102 // Extracts the words from |text|, placing each word into |words|.
103 void ExtractQueryWords(const base::string16& text, 103 void ExtractQueryWords(const base::string16& text,
104 std::vector<QueryWord>* words); 104 std::vector<QueryWord>* words);
105 105
106 // Sorts the match positions in |matches| by their first index, then
107 // coalesces any match positions that intersect each other.
108 static void SortAndCoalesceMatchPositions(Snippet::MatchPositions* matches);
109
106 private: 110 private:
107 // Does the work of parsing |query|; creates nodes in |root| as appropriate. 111 // Does the work of parsing |query|; creates nodes in |root| as appropriate.
108 // This is invoked from both of the ParseQuery methods. 112 // This is invoked from both of the ParseQuery methods.
109 bool ParseQueryImpl(const base::string16& query, QueryNodeList* root); 113 bool ParseQueryImpl(const base::string16& query, QueryNodeList* root);
110 114
111 DISALLOW_COPY_AND_ASSIGN(QueryParser); 115 DISALLOW_COPY_AND_ASSIGN(QueryParser);
112 }; 116 };
113 117
114 } // namespace query_parser 118 } // namespace query_parser
115 119
116 #endif // COMPONENTS_QUERY_PARSER_QUERY_PARSER_H_ 120 #endif // COMPONENTS_QUERY_PARSER_QUERY_PARSER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698