| OLD | NEW |
| 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 // This class contains common functionality for search-based autocomplete | 5 // This class contains common functionality for search-based autocomplete |
| 6 // providers. Search provider and zero suggest provider both use it for common | 6 // providers. Search provider and zero suggest provider both use it for common |
| 7 // functionality. | 7 // functionality. |
| 8 | 8 |
| 9 #ifndef COMPONENTS_OMNIBOX_BROWSER_BASE_SEARCH_PROVIDER_H_ | 9 #ifndef COMPONENTS_OMNIBOX_BROWSER_BASE_SEARCH_PROVIDER_H_ |
| 10 #define COMPONENTS_OMNIBOX_BROWSER_BASE_SEARCH_PROVIDER_H_ | 10 #define COMPONENTS_OMNIBOX_BROWSER_BASE_SEARCH_PROVIDER_H_ |
| 11 | 11 |
| 12 #include <map> | 12 #include <map> |
| 13 #include <string> | 13 #include <string> |
| 14 #include <utility> | 14 #include <utility> |
| 15 #include <vector> | 15 #include <vector> |
| 16 | 16 |
| 17 #include "base/gtest_prod_util.h" | 17 #include "base/gtest_prod_util.h" |
| 18 #include "base/macros.h" | 18 #include "base/macros.h" |
| 19 #include "base/memory/scoped_vector.h" | 19 #include "base/memory/scoped_ptr.h" |
| 20 #include "base/strings/string16.h" | 20 #include "base/strings/string16.h" |
| 21 #include "components/metrics/proto/omnibox_event.pb.h" | 21 #include "components/metrics/proto/omnibox_event.pb.h" |
| 22 #include "components/omnibox/browser/autocomplete_input.h" | 22 #include "components/omnibox/browser/autocomplete_input.h" |
| 23 #include "components/omnibox/browser/autocomplete_match.h" | 23 #include "components/omnibox/browser/autocomplete_match.h" |
| 24 #include "components/omnibox/browser/autocomplete_provider.h" | 24 #include "components/omnibox/browser/autocomplete_provider.h" |
| 25 #include "components/omnibox/browser/search_suggestion_parser.h" | 25 #include "components/omnibox/browser/search_suggestion_parser.h" |
| 26 | 26 |
| 27 class AutocompleteProviderClient; | 27 class AutocompleteProviderClient; |
| 28 class GURL; | 28 class GURL; |
| 29 class SearchTermsData; | 29 class SearchTermsData; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 static const char kDeletionUrlKey[]; | 94 static const char kDeletionUrlKey[]; |
| 95 | 95 |
| 96 // These are the values for the above keys. | 96 // These are the values for the above keys. |
| 97 static const char kTrue[]; | 97 static const char kTrue[]; |
| 98 static const char kFalse[]; | 98 static const char kFalse[]; |
| 99 | 99 |
| 100 ~BaseSearchProvider() override; | 100 ~BaseSearchProvider() override; |
| 101 | 101 |
| 102 typedef std::pair<base::string16, std::string> MatchKey; | 102 typedef std::pair<base::string16, std::string> MatchKey; |
| 103 typedef std::map<MatchKey, AutocompleteMatch> MatchMap; | 103 typedef std::map<MatchKey, AutocompleteMatch> MatchMap; |
| 104 typedef ScopedVector<SuggestionDeletionHandler> SuggestionDeletionHandlers; | 104 typedef std::vector<scoped_ptr<SuggestionDeletionHandler>> |
| 105 SuggestionDeletionHandlers; |
| 105 | 106 |
| 106 // Returns an AutocompleteMatch with the given |autocomplete_provider| | 107 // Returns an AutocompleteMatch with the given |autocomplete_provider| |
| 107 // for the search |suggestion|, which represents a search via |template_url|. | 108 // for the search |suggestion|, which represents a search via |template_url|. |
| 108 // If |template_url| is NULL, returns a match with an invalid destination URL. | 109 // If |template_url| is NULL, returns a match with an invalid destination URL. |
| 109 // | 110 // |
| 110 // |input| is the original user input. Text in the input is used to highlight | 111 // |input| is the original user input. Text in the input is used to highlight |
| 111 // portions of the match contents to distinguish locally-typed text from | 112 // portions of the match contents to distinguish locally-typed text from |
| 112 // suggested text. | 113 // suggested text. |
| 113 // | 114 // |
| 114 // |input| is also necessary for various other details, like whether we should | 115 // |input| is also necessary for various other details, like whether we should |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 | 260 |
| 260 // Each deletion handler in this vector corresponds to an outstanding request | 261 // Each deletion handler in this vector corresponds to an outstanding request |
| 261 // that a server delete a personalized suggestion. Making this a ScopedVector | 262 // that a server delete a personalized suggestion. Making this a ScopedVector |
| 262 // causes us to auto-cancel all such requests on shutdown. | 263 // causes us to auto-cancel all such requests on shutdown. |
| 263 SuggestionDeletionHandlers deletion_handlers_; | 264 SuggestionDeletionHandlers deletion_handlers_; |
| 264 | 265 |
| 265 DISALLOW_COPY_AND_ASSIGN(BaseSearchProvider); | 266 DISALLOW_COPY_AND_ASSIGN(BaseSearchProvider); |
| 266 }; | 267 }; |
| 267 | 268 |
| 268 #endif // COMPONENTS_OMNIBOX_BROWSER_BASE_SEARCH_PROVIDER_H_ | 269 #endif // COMPONENTS_OMNIBOX_BROWSER_BASE_SEARCH_PROVIDER_H_ |
| OLD | NEW |