| 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 "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/data_use_measurement/core/data_use_user_data.h" | |
| 11 #include "components/metrics/proto/omnibox_event.pb.h" | 10 #include "components/metrics/proto/omnibox_event.pb.h" |
| 12 #include "components/metrics/proto/omnibox_input_type.pb.h" | 11 #include "components/metrics/proto/omnibox_input_type.pb.h" |
| 13 #include "components/omnibox/browser/autocomplete_provider_client.h" | 12 #include "components/omnibox/browser/autocomplete_provider_client.h" |
| 14 #include "components/omnibox/browser/autocomplete_provider_listener.h" | 13 #include "components/omnibox/browser/autocomplete_provider_listener.h" |
| 15 #include "components/omnibox/browser/omnibox_field_trial.h" | 14 #include "components/omnibox/browser/omnibox_field_trial.h" |
| 16 #include "components/omnibox/browser/suggestion_answer.h" | 15 #include "components/omnibox/browser/suggestion_answer.h" |
| 17 #include "components/search_engines/template_url.h" | 16 #include "components/search_engines/template_url.h" |
| 18 #include "components/search_engines/template_url_prepopulate_data.h" | 17 #include "components/search_engines/template_url_prepopulate_data.h" |
| 19 #include "components/search_engines/template_url_service.h" | 18 #include "components/search_engines/template_url_service.h" |
| 20 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 19 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 SuggestionDeletionHandler::SuggestionDeletionHandler( | 52 SuggestionDeletionHandler::SuggestionDeletionHandler( |
| 54 const std::string& deletion_url, | 53 const std::string& deletion_url, |
| 55 net::URLRequestContextGetter* request_context, | 54 net::URLRequestContextGetter* request_context, |
| 56 const DeletionCompletedCallback& callback) : callback_(callback) { | 55 const DeletionCompletedCallback& callback) : callback_(callback) { |
| 57 GURL url(deletion_url); | 56 GURL url(deletion_url); |
| 58 DCHECK(url.is_valid()); | 57 DCHECK(url.is_valid()); |
| 59 | 58 |
| 60 deletion_fetcher_ = | 59 deletion_fetcher_ = |
| 61 net::URLFetcher::Create(BaseSearchProvider::kDeletionURLFetcherID, url, | 60 net::URLFetcher::Create(BaseSearchProvider::kDeletionURLFetcherID, url, |
| 62 net::URLFetcher::GET, this); | 61 net::URLFetcher::GET, this); |
| 63 data_use_measurement::DataUseUserData::AttachToFetcher( | |
| 64 deletion_fetcher_.get(), data_use_measurement::DataUseUserData::OMNIBOX); | |
| 65 deletion_fetcher_->SetRequestContext(request_context); | 62 deletion_fetcher_->SetRequestContext(request_context); |
| 66 deletion_fetcher_->Start(); | 63 deletion_fetcher_->Start(); |
| 67 } | 64 } |
| 68 | 65 |
| 69 SuggestionDeletionHandler::~SuggestionDeletionHandler() { | 66 SuggestionDeletionHandler::~SuggestionDeletionHandler() { |
| 70 } | 67 } |
| 71 | 68 |
| 72 void SuggestionDeletionHandler::OnURLFetchComplete( | 69 void SuggestionDeletionHandler::OnURLFetchComplete( |
| 73 const net::URLFetcher* source) { | 70 const net::URLFetcher* source) { |
| 74 DCHECK(source == deletion_fetcher_.get()); | 71 DCHECK(source == deletion_fetcher_.get()); |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 } | 476 } |
| 480 | 477 |
| 481 void BaseSearchProvider::OnDeletionComplete( | 478 void BaseSearchProvider::OnDeletionComplete( |
| 482 bool success, SuggestionDeletionHandler* handler) { | 479 bool success, SuggestionDeletionHandler* handler) { |
| 483 RecordDeletionResult(success); | 480 RecordDeletionResult(success); |
| 484 SuggestionDeletionHandlers::iterator it = std::find( | 481 SuggestionDeletionHandlers::iterator it = std::find( |
| 485 deletion_handlers_.begin(), deletion_handlers_.end(), handler); | 482 deletion_handlers_.begin(), deletion_handlers_.end(), handler); |
| 486 DCHECK(it != deletion_handlers_.end()); | 483 DCHECK(it != deletion_handlers_.end()); |
| 487 deletion_handlers_.erase(it); | 484 deletion_handlers_.erase(it); |
| 488 } | 485 } |
| OLD | NEW |