Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(357)

Side by Side Diff: chrome/browser/autocomplete/base_search_provider.cc

Issue 354773002: Reduces dependency from AutocompleteMatch to Profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 if (!match.GetAdditionalInfo(BaseSearchProvider::kDeletionUrlKey).empty()) { 169 if (!match.GetAdditionalInfo(BaseSearchProvider::kDeletionUrlKey).empty()) {
170 deletion_handlers_.push_back(new SuggestionDeletionHandler( 170 deletion_handlers_.push_back(new SuggestionDeletionHandler(
171 match.GetAdditionalInfo(BaseSearchProvider::kDeletionUrlKey), 171 match.GetAdditionalInfo(BaseSearchProvider::kDeletionUrlKey),
172 profile_, 172 profile_,
173 base::Bind(&BaseSearchProvider::OnDeletionComplete, 173 base::Bind(&BaseSearchProvider::OnDeletionComplete,
174 base::Unretained(this)))); 174 base::Unretained(this))));
175 } 175 }
176 176
177 HistoryService* const history_service = 177 HistoryService* const history_service =
178 HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); 178 HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS);
179 TemplateURL* template_url = match.GetTemplateURL(profile_, false); 179 TemplateURLService* template_url_service =
180 TemplateURLServiceFactory::GetForProfile(profile_);
181 TemplateURL* template_url = match.GetTemplateURL(template_url_service, false);
180 // This may be NULL if the template corresponding to the keyword has been 182 // This may be NULL if the template corresponding to the keyword has been
181 // deleted or there is no keyword set. 183 // deleted or there is no keyword set.
182 if (template_url != NULL) { 184 if (template_url != NULL) {
183 history_service->DeleteMatchingURLsForKeyword(template_url->id(), 185 history_service->DeleteMatchingURLsForKeyword(template_url->id(),
184 match.contents); 186 match.contents);
185 } 187 }
186 188
187 // Immediately update the list of matches to show the match was deleted, 189 // Immediately update the list of matches to show the match was deleted,
188 // regardless of whether the server request actually succeeds. 190 // regardless of whether the server request actually succeeds.
189 DeleteMatchFromMatches(match); 191 DeleteMatchFromMatches(match);
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 } 1009 }
1008 1010
1009 void BaseSearchProvider::OnDeletionComplete( 1011 void BaseSearchProvider::OnDeletionComplete(
1010 bool success, SuggestionDeletionHandler* handler) { 1012 bool success, SuggestionDeletionHandler* handler) {
1011 RecordDeletionResult(success); 1013 RecordDeletionResult(success);
1012 SuggestionDeletionHandlers::iterator it = std::find( 1014 SuggestionDeletionHandlers::iterator it = std::find(
1013 deletion_handlers_.begin(), deletion_handlers_.end(), handler); 1015 deletion_handlers_.begin(), deletion_handlers_.end(), handler);
1014 DCHECK(it != deletion_handlers_.end()); 1016 DCHECK(it != deletion_handlers_.end());
1015 deletion_handlers_.erase(it); 1017 deletion_handlers_.erase(it);
1016 } 1018 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698