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 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 } | 461 } |
462 | 462 |
463 void BaseSearchProvider::SetDeletionURL(const std::string& deletion_url, | 463 void BaseSearchProvider::SetDeletionURL(const std::string& deletion_url, |
464 AutocompleteMatch* match) { | 464 AutocompleteMatch* match) { |
465 if (deletion_url.empty()) | 465 if (deletion_url.empty()) |
466 return; | 466 return; |
467 TemplateURLService* template_service = | 467 TemplateURLService* template_service = |
468 TemplateURLServiceFactory::GetForProfile(profile_); | 468 TemplateURLServiceFactory::GetForProfile(profile_); |
469 if (!template_service) | 469 if (!template_service) |
470 return; | 470 return; |
471 GURL url = TemplateURLService::GenerateSearchURL( | 471 GURL url = template_service->GetDefaultSearchProvider()->GenerateSearchURL( |
472 template_service->GetDefaultSearchProvider(), | |
473 template_service->search_terms_data()); | 472 template_service->search_terms_data()); |
474 url = url.GetOrigin().Resolve(deletion_url); | 473 url = url.GetOrigin().Resolve(deletion_url); |
475 if (url.is_valid()) { | 474 if (url.is_valid()) { |
476 match->RecordAdditionalInfo(BaseSearchProvider::kDeletionUrlKey, | 475 match->RecordAdditionalInfo(BaseSearchProvider::kDeletionUrlKey, |
477 url.spec()); | 476 url.spec()); |
478 match->deletable = true; | 477 match->deletable = true; |
479 } | 478 } |
480 } | 479 } |
481 | 480 |
482 // BaseSearchProvider --------------------------------------------------------- | 481 // BaseSearchProvider --------------------------------------------------------- |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1007 } | 1006 } |
1008 | 1007 |
1009 void BaseSearchProvider::OnDeletionComplete( | 1008 void BaseSearchProvider::OnDeletionComplete( |
1010 bool success, SuggestionDeletionHandler* handler) { | 1009 bool success, SuggestionDeletionHandler* handler) { |
1011 RecordDeletionResult(success); | 1010 RecordDeletionResult(success); |
1012 SuggestionDeletionHandlers::iterator it = std::find( | 1011 SuggestionDeletionHandlers::iterator it = std::find( |
1013 deletion_handlers_.begin(), deletion_handlers_.end(), handler); | 1012 deletion_handlers_.begin(), deletion_handlers_.end(), handler); |
1014 DCHECK(it != deletion_handlers_.end()); | 1013 DCHECK(it != deletion_handlers_.end()); |
1015 deletion_handlers_.erase(it); | 1014 deletion_handlers_.erase(it); |
1016 } | 1015 } |
OLD | NEW |