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 #include "components/omnibox/base_search_provider.h" | 5 #include "components/omnibox/base_search_provider.h" |
6 | 6 |
7 #include "base/i18n/case_conversion.h" | 7 #include "base/i18n/case_conversion.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "components/metrics/proto/omnibox_event.pb.h" | 10 #include "components/metrics/proto/omnibox_event.pb.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 this); | 74 this); |
75 } | 75 } |
76 | 76 |
77 // BaseSearchProvider --------------------------------------------------------- | 77 // BaseSearchProvider --------------------------------------------------------- |
78 | 78 |
79 // static | 79 // static |
80 const int BaseSearchProvider::kDefaultProviderURLFetcherID = 1; | 80 const int BaseSearchProvider::kDefaultProviderURLFetcherID = 1; |
81 const int BaseSearchProvider::kKeywordProviderURLFetcherID = 2; | 81 const int BaseSearchProvider::kKeywordProviderURLFetcherID = 2; |
82 const int BaseSearchProvider::kDeletionURLFetcherID = 3; | 82 const int BaseSearchProvider::kDeletionURLFetcherID = 3; |
83 | 83 |
84 BaseSearchProvider::BaseSearchProvider( | 84 BaseSearchProvider::BaseSearchProvider(AutocompleteProvider::Type type, |
85 TemplateURLService* template_url_service, | 85 AutocompleteProviderClient* client, |
86 scoped_ptr<AutocompleteProviderClient> client, | 86 |
87 AutocompleteProvider::Type type) | 87 TemplateURLService* template_url_service) |
88 : AutocompleteProvider(type), | 88 : AutocompleteProvider(type), |
| 89 client_(client), |
89 template_url_service_(template_url_service), | 90 template_url_service_(template_url_service), |
90 client_(client.Pass()), | |
91 field_trial_triggered_(false), | 91 field_trial_triggered_(false), |
92 field_trial_triggered_in_session_(false) { | 92 field_trial_triggered_in_session_(false) { |
93 } | 93 } |
94 | 94 |
95 // static | 95 // static |
96 bool BaseSearchProvider::ShouldPrefetch(const AutocompleteMatch& match) { | 96 bool BaseSearchProvider::ShouldPrefetch(const AutocompleteMatch& match) { |
97 return match.GetAdditionalInfo(kShouldPrefetchKey) == kTrue; | 97 return match.GetAdditionalInfo(kShouldPrefetchKey) == kTrue; |
98 } | 98 } |
99 | 99 |
100 // static | 100 // static |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 } | 474 } |
475 | 475 |
476 void BaseSearchProvider::OnDeletionComplete( | 476 void BaseSearchProvider::OnDeletionComplete( |
477 bool success, SuggestionDeletionHandler* handler) { | 477 bool success, SuggestionDeletionHandler* handler) { |
478 RecordDeletionResult(success); | 478 RecordDeletionResult(success); |
479 SuggestionDeletionHandlers::iterator it = std::find( | 479 SuggestionDeletionHandlers::iterator it = std::find( |
480 deletion_handlers_.begin(), deletion_handlers_.end(), handler); | 480 deletion_handlers_.begin(), deletion_handlers_.end(), handler); |
481 DCHECK(it != deletion_handlers_.end()); | 481 DCHECK(it != deletion_handlers_.end()); |
482 deletion_handlers_.erase(it); | 482 deletion_handlers_.erase(it); |
483 } | 483 } |
OLD | NEW |