OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/history/query_parser.h" | 5 #include "chrome/browser/history/query_parser.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/i18n/break_iterator.h" | 10 #include "base/i18n/break_iterator.h" |
11 #include "base/i18n/case_conversion.h" | 11 #include "base/i18n/case_conversion.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/stl_util-inl.h" | 13 #include "base/stl_util.h" |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 // Returns true if |mp1.first| is less than |mp2.first|. This is used to | 17 // Returns true if |mp1.first| is less than |mp2.first|. This is used to |
18 // sort match positions. | 18 // sort match positions. |
19 int CompareMatchPosition(const Snippet::MatchPosition& mp1, | 19 int CompareMatchPosition(const Snippet::MatchPosition& mp1, |
20 const Snippet::MatchPosition& mp2) { | 20 const Snippet::MatchPosition& mp2) { |
21 return mp1.first < mp2.first; | 21 return mp1.first < mp2.first; |
22 } | 22 } |
23 | 23 |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 if (iter.IsWord()) { | 407 if (iter.IsWord()) { |
408 string16 word = iter.GetString(); | 408 string16 word = iter.GetString(); |
409 if (!word.empty()) { | 409 if (!word.empty()) { |
410 words->push_back(QueryWord()); | 410 words->push_back(QueryWord()); |
411 words->back().word = word; | 411 words->back().word = word; |
412 words->back().position = iter.prev(); | 412 words->back().position = iter.prev(); |
413 } | 413 } |
414 } | 414 } |
415 } | 415 } |
416 } | 416 } |
OLD | NEW |