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/base_search_provider.h" | 5 #include "components/omnibox/base_search_provider.h" |
6 | 6 |
7 #include "base/i18n/case_conversion.h" | 7 #include "base/i18n/case_conversion.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "components/metrics/proto/omnibox_event.pb.h" | 10 #include "components/metrics/proto/omnibox_event.pb.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 DISALLOW_COPY_AND_ASSIGN(SuggestionDeletionHandler); | 49 DISALLOW_COPY_AND_ASSIGN(SuggestionDeletionHandler); |
50 }; | 50 }; |
51 | 51 |
52 SuggestionDeletionHandler::SuggestionDeletionHandler( | 52 SuggestionDeletionHandler::SuggestionDeletionHandler( |
53 const std::string& deletion_url, | 53 const std::string& deletion_url, |
54 net::URLRequestContextGetter* request_context, | 54 net::URLRequestContextGetter* request_context, |
55 const DeletionCompletedCallback& callback) : callback_(callback) { | 55 const DeletionCompletedCallback& callback) : callback_(callback) { |
56 GURL url(deletion_url); | 56 GURL url(deletion_url); |
57 DCHECK(url.is_valid()); | 57 DCHECK(url.is_valid()); |
58 | 58 |
59 deletion_fetcher_.reset(net::URLFetcher::Create( | 59 deletion_fetcher_ = |
60 BaseSearchProvider::kDeletionURLFetcherID, | 60 net::URLFetcher::Create(BaseSearchProvider::kDeletionURLFetcherID, url, |
61 url, | 61 net::URLFetcher::GET, this); |
62 net::URLFetcher::GET, | |
63 this)); | |
64 deletion_fetcher_->SetRequestContext(request_context); | 62 deletion_fetcher_->SetRequestContext(request_context); |
65 deletion_fetcher_->Start(); | 63 deletion_fetcher_->Start(); |
66 } | 64 } |
67 | 65 |
68 SuggestionDeletionHandler::~SuggestionDeletionHandler() { | 66 SuggestionDeletionHandler::~SuggestionDeletionHandler() { |
69 } | 67 } |
70 | 68 |
71 void SuggestionDeletionHandler::OnURLFetchComplete( | 69 void SuggestionDeletionHandler::OnURLFetchComplete( |
72 const net::URLFetcher* source) { | 70 const net::URLFetcher* source) { |
73 DCHECK(source == deletion_fetcher_.get()); | 71 DCHECK(source == deletion_fetcher_.get()); |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 } | 473 } |
476 | 474 |
477 void BaseSearchProvider::OnDeletionComplete( | 475 void BaseSearchProvider::OnDeletionComplete( |
478 bool success, SuggestionDeletionHandler* handler) { | 476 bool success, SuggestionDeletionHandler* handler) { |
479 RecordDeletionResult(success); | 477 RecordDeletionResult(success); |
480 SuggestionDeletionHandlers::iterator it = std::find( | 478 SuggestionDeletionHandlers::iterator it = std::find( |
481 deletion_handlers_.begin(), deletion_handlers_.end(), handler); | 479 deletion_handlers_.begin(), deletion_handlers_.end(), handler); |
482 DCHECK(it != deletion_handlers_.end()); | 480 DCHECK(it != deletion_handlers_.end()); |
483 deletion_handlers_.erase(it); | 481 deletion_handlers_.erase(it); |
484 } | 482 } |
OLD | NEW |