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 "chrome/browser/autocomplete/base_search_provider.h" | 5 #include "chrome/browser/autocomplete/base_search_provider.h" |
6 | 6 |
7 #include "base/i18n/case_conversion.h" | 7 #include "base/i18n/case_conversion.h" |
8 #include "base/i18n/icu_string_conversions.h" | 8 #include "base/i18n/icu_string_conversions.h" |
9 #include "base/json/json_string_value_serializer.h" | 9 #include "base/json/json_string_value_serializer.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 } | 459 } |
460 | 460 |
461 void BaseSearchProvider::SetDeletionURL(const std::string& deletion_url, | 461 void BaseSearchProvider::SetDeletionURL(const std::string& deletion_url, |
462 AutocompleteMatch* match) { | 462 AutocompleteMatch* match) { |
463 if (deletion_url.empty()) | 463 if (deletion_url.empty()) |
464 return; | 464 return; |
465 TemplateURLService* template_service = | 465 TemplateURLService* template_service = |
466 TemplateURLServiceFactory::GetForProfile(profile_); | 466 TemplateURLServiceFactory::GetForProfile(profile_); |
467 if (!template_service) | 467 if (!template_service) |
468 return; | 468 return; |
469 GURL url = TemplateURLService::GenerateSearchURL( | 469 GURL url = template_service->GetDefaultSearchProvider()->GenerateSearchURL( |
470 template_service->GetDefaultSearchProvider(), | |
471 template_service->search_terms_data()); | 470 template_service->search_terms_data()); |
472 url = url.GetOrigin().Resolve(deletion_url); | 471 url = url.GetOrigin().Resolve(deletion_url); |
473 if (url.is_valid()) { | 472 if (url.is_valid()) { |
474 match->RecordAdditionalInfo(BaseSearchProvider::kDeletionUrlKey, | 473 match->RecordAdditionalInfo(BaseSearchProvider::kDeletionUrlKey, |
475 url.spec()); | 474 url.spec()); |
476 match->deletable = true; | 475 match->deletable = true; |
477 } | 476 } |
478 } | 477 } |
479 | 478 |
480 // BaseSearchProvider --------------------------------------------------------- | 479 // BaseSearchProvider --------------------------------------------------------- |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
977 } | 976 } |
978 | 977 |
979 void BaseSearchProvider::OnDeletionComplete( | 978 void BaseSearchProvider::OnDeletionComplete( |
980 bool success, SuggestionDeletionHandler* handler) { | 979 bool success, SuggestionDeletionHandler* handler) { |
981 RecordDeletionResult(success); | 980 RecordDeletionResult(success); |
982 SuggestionDeletionHandlers::iterator it = std::find( | 981 SuggestionDeletionHandlers::iterator it = std::find( |
983 deletion_handlers_.begin(), deletion_handlers_.end(), handler); | 982 deletion_handlers_.begin(), deletion_handlers_.end(), handler); |
984 DCHECK(it != deletion_handlers_.end()); | 983 DCHECK(it != deletion_handlers_.end()); |
985 deletion_handlers_.erase(it); | 984 deletion_handlers_.erase(it); |
986 } | 985 } |
OLD | NEW |