| 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 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 = TemplateURLService::GenerateSearchURL( |
| 470 template_service->GetDefaultSearchProvider()); | 470 template_service->GetDefaultSearchProvider(), |
| 471 template_service->search_terms_data()); |
| 471 url = url.GetOrigin().Resolve(deletion_url); | 472 url = url.GetOrigin().Resolve(deletion_url); |
| 472 if (url.is_valid()) { | 473 if (url.is_valid()) { |
| 473 match->RecordAdditionalInfo(BaseSearchProvider::kDeletionUrlKey, | 474 match->RecordAdditionalInfo(BaseSearchProvider::kDeletionUrlKey, |
| 474 url.spec()); | 475 url.spec()); |
| 475 match->deletable = true; | 476 match->deletable = true; |
| 476 } | 477 } |
| 477 } | 478 } |
| 478 | 479 |
| 479 // BaseSearchProvider --------------------------------------------------------- | 480 // BaseSearchProvider --------------------------------------------------------- |
| 480 | 481 |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 976 } | 977 } |
| 977 | 978 |
| 978 void BaseSearchProvider::OnDeletionComplete( | 979 void BaseSearchProvider::OnDeletionComplete( |
| 979 bool success, SuggestionDeletionHandler* handler) { | 980 bool success, SuggestionDeletionHandler* handler) { |
| 980 RecordDeletionResult(success); | 981 RecordDeletionResult(success); |
| 981 SuggestionDeletionHandlers::iterator it = std::find( | 982 SuggestionDeletionHandlers::iterator it = std::find( |
| 982 deletion_handlers_.begin(), deletion_handlers_.end(), handler); | 983 deletion_handlers_.begin(), deletion_handlers_.end(), handler); |
| 983 DCHECK(it != deletion_handlers_.end()); | 984 DCHECK(it != deletion_handlers_.end()); |
| 984 deletion_handlers_.erase(it); | 985 deletion_handlers_.erase(it); |
| 985 } | 986 } |
| OLD | NEW |