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

Side by Side Diff: components/omnibox/browser/search_provider.cc

Issue 1339943003: Revert "Report data usage UMA for Chrome services" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/search_provider.h" 5 #include "components/omnibox/browser/search_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/i18n/break_iterator.h" 13 #include "base/i18n/break_iterator.h"
14 #include "base/i18n/case_conversion.h" 14 #include "base/i18n/case_conversion.h"
15 #include "base/json/json_string_value_serializer.h" 15 #include "base/json/json_string_value_serializer.h"
16 #include "base/metrics/histogram_macros.h" 16 #include "base/metrics/histogram_macros.h"
17 #include "base/metrics/user_metrics.h" 17 #include "base/metrics/user_metrics.h"
18 #include "base/rand_util.h" 18 #include "base/rand_util.h"
19 #include "base/strings/string_util.h" 19 #include "base/strings/string_util.h"
20 #include "base/strings/utf_string_conversions.h" 20 #include "base/strings/utf_string_conversions.h"
21 #include "components/data_use_measurement/core/data_use_user_data.h"
22 #include "components/history/core/browser/in_memory_database.h" 21 #include "components/history/core/browser/in_memory_database.h"
23 #include "components/history/core/browser/keyword_search_term.h" 22 #include "components/history/core/browser/keyword_search_term.h"
24 #include "components/metrics/proto/omnibox_input_type.pb.h" 23 #include "components/metrics/proto/omnibox_input_type.pb.h"
25 #include "components/omnibox/browser/autocomplete_provider_client.h" 24 #include "components/omnibox/browser/autocomplete_provider_client.h"
26 #include "components/omnibox/browser/autocomplete_provider_listener.h" 25 #include "components/omnibox/browser/autocomplete_provider_listener.h"
27 #include "components/omnibox/browser/autocomplete_result.h" 26 #include "components/omnibox/browser/autocomplete_result.h"
28 #include "components/omnibox/browser/keyword_provider.h" 27 #include "components/omnibox/browser/keyword_provider.h"
29 #include "components/omnibox/browser/omnibox_field_trial.h" 28 #include "components/omnibox/browser/omnibox_field_trial.h"
30 #include "components/omnibox/browser/suggestion_answer.h" 29 #include "components/omnibox/browser/suggestion_answer.h"
31 #include "components/omnibox/browser/url_prefix.h" 30 #include "components/omnibox/browser/url_prefix.h"
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 search_term_args.current_page_url = input.current_url().spec(); 856 search_term_args.current_page_url = input.current_url().spec();
858 // Create the suggest URL again with the current page URL. 857 // Create the suggest URL again with the current page URL.
859 suggest_url = GURL(template_url->suggestions_url_ref().ReplaceSearchTerms( 858 suggest_url = GURL(template_url->suggestions_url_ref().ReplaceSearchTerms(
860 search_term_args, template_url_service->search_terms_data())); 859 search_term_args, template_url_service->search_terms_data()));
861 } 860 }
862 861
863 LogOmniboxSuggestRequest(REQUEST_SENT); 862 LogOmniboxSuggestRequest(REQUEST_SENT);
864 863
865 scoped_ptr<net::URLFetcher> fetcher = 864 scoped_ptr<net::URLFetcher> fetcher =
866 net::URLFetcher::Create(id, suggest_url, net::URLFetcher::GET, this); 865 net::URLFetcher::Create(id, suggest_url, net::URLFetcher::GET, this);
867 data_use_measurement::DataUseUserData::AttachToFetcher(
868 fetcher.get(), data_use_measurement::DataUseUserData::OMNIBOX);
869 fetcher->SetRequestContext(client()->GetRequestContext()); 866 fetcher->SetRequestContext(client()->GetRequestContext());
870 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES); 867 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES);
871 // Add Chrome experiment state to the request headers. 868 // Add Chrome experiment state to the request headers.
872 net::HttpRequestHeaders headers; 869 net::HttpRequestHeaders headers;
873 variations::VariationsHttpHeaderProvider::GetInstance()->AppendHeaders( 870 variations::VariationsHttpHeaderProvider::GetInstance()->AppendHeaders(
874 fetcher->GetOriginalURL(), client()->IsOffTheRecord(), false, &headers); 871 fetcher->GetOriginalURL(), client()->IsOffTheRecord(), false, &headers);
875 fetcher->SetExtraRequestHeaders(headers.ToString()); 872 fetcher->SetExtraRequestHeaders(headers.ToString());
876 fetcher->Start(); 873 fetcher->Start();
877 return fetcher; 874 return fetcher;
878 } 875 }
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
1500 for (MatchMap::const_iterator i(map.begin()); i != map.end(); ++i) 1497 for (MatchMap::const_iterator i(map.begin()); i != map.end(); ++i)
1501 matches.push_back(i->second); 1498 matches.push_back(i->second);
1502 std::sort(matches.begin(), matches.end(), &AutocompleteMatch::MoreRelevant); 1499 std::sort(matches.begin(), matches.end(), &AutocompleteMatch::MoreRelevant);
1503 1500
1504 // If there is a top scoring entry, find the corresponding answer. 1501 // If there is a top scoring entry, find the corresponding answer.
1505 if (!matches.empty()) 1502 if (!matches.empty())
1506 return answers_cache_.GetTopAnswerEntry(matches[0].contents); 1503 return answers_cache_.GetTopAnswerEntry(matches[0].contents);
1507 1504
1508 return AnswersQueryData(); 1505 return AnswersQueryData();
1509 } 1506 }
OLDNEW
« no previous file with comments | « components/omnibox/browser/base_search_provider.cc ('k') | components/omnibox/browser/zero_suggest_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698