| 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(TemplateURLService* template_url_service, |
| 85 TemplateURLService* template_url_service, | 85 AutocompleteProviderClient* client, |
| 86 scoped_ptr<AutocompleteProviderClient> client, | 86 AutocompleteProvider::Type type) |
| 87 AutocompleteProvider::Type type) | |
| 88 : AutocompleteProvider(type), | 87 : AutocompleteProvider(type), |
| 89 template_url_service_(template_url_service), | 88 template_url_service_(template_url_service), |
| 90 client_(client.Pass()), | 89 client_(client), |
| 91 field_trial_triggered_(false), | 90 field_trial_triggered_(false), |
| 92 field_trial_triggered_in_session_(false) { | 91 field_trial_triggered_in_session_(false) { |
| 93 } | 92 } |
| 94 | 93 |
| 95 // static | 94 // static |
| 96 bool BaseSearchProvider::ShouldPrefetch(const AutocompleteMatch& match) { | 95 bool BaseSearchProvider::ShouldPrefetch(const AutocompleteMatch& match) { |
| 97 return match.GetAdditionalInfo(kShouldPrefetchKey) == kTrue; | 96 return match.GetAdditionalInfo(kShouldPrefetchKey) == kTrue; |
| 98 } | 97 } |
| 99 | 98 |
| 100 // static | 99 // static |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 } | 473 } |
| 475 | 474 |
| 476 void BaseSearchProvider::OnDeletionComplete( | 475 void BaseSearchProvider::OnDeletionComplete( |
| 477 bool success, SuggestionDeletionHandler* handler) { | 476 bool success, SuggestionDeletionHandler* handler) { |
| 478 RecordDeletionResult(success); | 477 RecordDeletionResult(success); |
| 479 SuggestionDeletionHandlers::iterator it = std::find( | 478 SuggestionDeletionHandlers::iterator it = std::find( |
| 480 deletion_handlers_.begin(), deletion_handlers_.end(), handler); | 479 deletion_handlers_.begin(), deletion_handlers_.end(), handler); |
| 481 DCHECK(it != deletion_handlers_.end()); | 480 DCHECK(it != deletion_handlers_.end()); |
| 482 deletion_handlers_.erase(it); | 481 deletion_handlers_.erase(it); |
| 483 } | 482 } |
| OLD | NEW |