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