| 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/browser/base_search_provider.h" | 5 #include "components/omnibox/browser/base_search_provider.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/feature_list.h" | 10 #include "base/feature_list.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 void BaseSearchProvider::DeleteMatch(const AutocompleteMatch& match) { | 126 void BaseSearchProvider::DeleteMatch(const AutocompleteMatch& match) { |
| 127 DCHECK(match.deletable); | 127 DCHECK(match.deletable); |
| 128 if (!match.GetAdditionalInfo(BaseSearchProvider::kDeletionUrlKey).empty()) { | 128 if (!match.GetAdditionalInfo(BaseSearchProvider::kDeletionUrlKey).empty()) { |
| 129 deletion_handlers_.push_back(base::MakeUnique<SuggestionDeletionHandler>( | 129 deletion_handlers_.push_back(base::MakeUnique<SuggestionDeletionHandler>( |
| 130 match.GetAdditionalInfo(BaseSearchProvider::kDeletionUrlKey), | 130 match.GetAdditionalInfo(BaseSearchProvider::kDeletionUrlKey), |
| 131 client_->GetRequestContext(), | 131 client_->GetRequestContext(), |
| 132 base::Bind(&BaseSearchProvider::OnDeletionComplete, | 132 base::Bind(&BaseSearchProvider::OnDeletionComplete, |
| 133 base::Unretained(this)))); | 133 base::Unretained(this)))); |
| 134 } | 134 } |
| 135 | 135 |
| 136 TemplateURL* template_url = | 136 const TemplateURL* template_url = |
| 137 match.GetTemplateURL(client_->GetTemplateURLService(), false); | 137 match.GetTemplateURL(client_->GetTemplateURLService(), false); |
| 138 // This may be NULL if the template corresponding to the keyword has been | 138 // This may be NULL if the template corresponding to the keyword has been |
| 139 // deleted or there is no keyword set. | 139 // deleted or there is no keyword set. |
| 140 if (template_url != NULL) { | 140 if (template_url != NULL) { |
| 141 client_->DeleteMatchingURLsForKeywordFromHistory(template_url->id(), | 141 client_->DeleteMatchingURLsForKeywordFromHistory(template_url->id(), |
| 142 match.contents); | 142 match.contents); |
| 143 } | 143 } |
| 144 | 144 |
| 145 // Immediately update the list of matches to show the match was deleted, | 145 // Immediately update the list of matches to show the match was deleted, |
| 146 // regardless of whether the server request actually succeeds. | 146 // regardless of whether the server request actually succeeds. |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 | 482 |
| 483 void BaseSearchProvider::OnDeletionComplete( | 483 void BaseSearchProvider::OnDeletionComplete( |
| 484 bool success, SuggestionDeletionHandler* handler) { | 484 bool success, SuggestionDeletionHandler* handler) { |
| 485 RecordDeletionResult(success); | 485 RecordDeletionResult(success); |
| 486 deletion_handlers_.erase(std::remove_if( | 486 deletion_handlers_.erase(std::remove_if( |
| 487 deletion_handlers_.begin(), deletion_handlers_.end(), | 487 deletion_handlers_.begin(), deletion_handlers_.end(), |
| 488 [handler](const std::unique_ptr<SuggestionDeletionHandler>& elem) { | 488 [handler](const std::unique_ptr<SuggestionDeletionHandler>& elem) { |
| 489 return elem.get() == handler; | 489 return elem.get() == handler; |
| 490 })); | 490 })); |
| 491 } | 491 } |
| OLD | NEW |