| 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 #ifndef CHROME_BROWSER_AUTOCOMPLETE_HISTORY_CONTENTS_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_HISTORY_CONTENTS_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_AUTOCOMPLETE_HISTORY_CONTENTS_PROVIDER_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_HISTORY_CONTENTS_PROVIDER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "chrome/browser/autocomplete/history_provider.h" | 9 #include "chrome/browser/autocomplete/history_provider.h" |
| 10 #include "chrome/browser/history/history.h" | 10 #include "chrome/browser/history/history.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 int CalculateRelevance(const history::URLResult& result); | 58 int CalculateRelevance(const history::URLResult& result); |
| 59 | 59 |
| 60 // Queries the bookmarks for any bookmarks whose title matches input. All | 60 // Queries the bookmarks for any bookmarks whose title matches input. All |
| 61 // matches are added directly to results_. | 61 // matches are added directly to results_. |
| 62 void QueryBookmarks(const AutocompleteInput& input); | 62 void QueryBookmarks(const AutocompleteInput& input); |
| 63 | 63 |
| 64 // Converts a BookmarkModel::TitleMatch to a QueryResult and adds it to | 64 // Converts a BookmarkModel::TitleMatch to a QueryResult and adds it to |
| 65 // results_. | 65 // results_. |
| 66 void AddBookmarkTitleMatchToResults(const bookmark_utils::TitleMatch& match); | 66 void AddBookmarkTitleMatchToResults(const bookmark_utils::TitleMatch& match); |
| 67 | 67 |
| 68 // Return true if the search term can be found in the title of |result|. |
| 69 bool MatchInTitle(const history::URLResult& result); |
| 70 |
| 68 CancelableRequestConsumerT<int, 0> request_consumer_; | 71 CancelableRequestConsumerT<int, 0> request_consumer_; |
| 69 | 72 |
| 70 // The number of times we're returned each different type of result. These are | 73 // The number of times we're returned each different type of result. These are |
| 71 // used by CalculateRelevance. Initialized in Start. | 74 // used by CalculateRelevance. Initialized in Start. |
| 72 int star_title_count_; | 75 int star_title_count_; |
| 73 int star_contents_count_; | 76 int star_contents_count_; |
| 74 int title_count_; | 77 int title_count_; |
| 75 int contents_count_; | 78 int contents_count_; |
| 76 | 79 |
| 77 // Current autocomplete input type. | 80 // Current autocomplete input type. |
| 78 AutocompleteInput::Type input_type_; | 81 AutocompleteInput::Type input_type_; |
| 79 | 82 |
| 80 // Whether we should match against the body text only (true) or also against | 83 // Whether we should match against the body text only (true) or also against |
| 81 // url and titles (false). | 84 // url and titles (false). |
| 85 // TODO(mrossetti): Remove body_only_ and MatchInTitle once body_only_ |
| 86 // becomes permanent. |
| 82 bool body_only_; | 87 bool body_only_; |
| 83 | 88 |
| 84 // Whether we should trim "http://" from results. | 89 // Whether we should trim "http://" from results. |
| 85 bool trim_http_; | 90 bool trim_http_; |
| 86 | 91 |
| 87 // Results from most recent query. These are cached so we don't have to | 92 // Results from most recent query. These are cached so we don't have to |
| 88 // re-issue queries for "minor changes" (which don't affect this provider). | 93 // re-issue queries for "minor changes" (which don't affect this provider). |
| 89 history::QueryResults results_; | 94 history::QueryResults results_; |
| 90 | 95 |
| 91 // Whether results_ is valid (so we can tell invalid apart from empty). | 96 // Whether results_ is valid (so we can tell invalid apart from empty). |
| 92 bool have_results_; | 97 bool have_results_; |
| 93 | 98 |
| 94 // Current query string. | 99 // Current query string. |
| 95 string16 query_; | 100 string16 query_; |
| 96 | 101 |
| 97 DISALLOW_COPY_AND_ASSIGN(HistoryContentsProvider); | 102 DISALLOW_COPY_AND_ASSIGN(HistoryContentsProvider); |
| 98 }; | 103 }; |
| 99 | 104 |
| 100 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_CONTENTS_PROVIDER_H_ | 105 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_CONTENTS_PROVIDER_H_ |
| OLD | NEW |