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

Side by Side Diff: chrome/browser/safe_browsing/srt_fetcher_win.cc

Issue 2510803003: Pass RapporService to content/browser/ (Closed)
Patch Set: Fix more compile errors in JNI files Created 4 years 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/safe_browsing/srt_fetcher_win.h" 5 #include "chrome/browser/safe_browsing/srt_fetcher_win.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 25 matching lines...) Expand all
36 #include "chrome/browser/safe_browsing/srt_global_error_win.h" 36 #include "chrome/browser/safe_browsing/srt_global_error_win.h"
37 #include "chrome/browser/ui/browser_finder.h" 37 #include "chrome/browser/ui/browser_finder.h"
38 #include "chrome/browser/ui/browser_list.h" 38 #include "chrome/browser/ui/browser_list.h"
39 #include "chrome/browser/ui/browser_list_observer.h" 39 #include "chrome/browser/ui/browser_list_observer.h"
40 #include "chrome/browser/ui/global_error/global_error_service.h" 40 #include "chrome/browser/ui/global_error/global_error_service.h"
41 #include "chrome/browser/ui/global_error/global_error_service_factory.h" 41 #include "chrome/browser/ui/global_error/global_error_service_factory.h"
42 #include "chrome/common/pref_names.h" 42 #include "chrome/common/pref_names.h"
43 #include "components/component_updater/pref_names.h" 43 #include "components/component_updater/pref_names.h"
44 #include "components/data_use_measurement/core/data_use_user_data.h" 44 #include "components/data_use_measurement/core/data_use_user_data.h"
45 #include "components/prefs/pref_service.h" 45 #include "components/prefs/pref_service.h"
46 #include "components/rappor/rappor_service.h" 46 #include "components/rappor/rappor_service_impl.h"
47 #include "components/safe_browsing_db/safe_browsing_prefs.h" 47 #include "components/safe_browsing_db/safe_browsing_prefs.h"
48 #include "components/variations/net/variations_http_headers.h" 48 #include "components/variations/net/variations_http_headers.h"
49 #include "components/version_info/version_info.h" 49 #include "components/version_info/version_info.h"
50 #include "content/public/browser/browser_thread.h" 50 #include "content/public/browser/browser_thread.h"
51 #include "net/base/load_flags.h" 51 #include "net/base/load_flags.h"
52 #include "net/http/http_status_code.h" 52 #include "net/http/http_status_code.h"
53 #include "net/url_request/url_fetcher.h" 53 #include "net/url_request/url_fetcher.h"
54 #include "net/url_request/url_fetcher_delegate.h" 54 #include "net/url_request/url_fetcher_delegate.h"
55 #include "net/url_request/url_request_context_getter.h" 55 #include "net/url_request/url_request_context_getter.h"
56 56
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 void ReportFoundUwS(bool use_rappor) const { 246 void ReportFoundUwS(bool use_rappor) const {
247 base::win::RegKey reporter_key; 247 base::win::RegKey reporter_key;
248 std::vector<base::string16> found_uws_strings; 248 std::vector<base::string16> found_uws_strings;
249 if (reporter_key.Open(HKEY_CURRENT_USER, registry_key_.c_str(), 249 if (reporter_key.Open(HKEY_CURRENT_USER, registry_key_.c_str(),
250 KEY_QUERY_VALUE | KEY_SET_VALUE) != ERROR_SUCCESS || 250 KEY_QUERY_VALUE | KEY_SET_VALUE) != ERROR_SUCCESS ||
251 reporter_key.ReadValues(kFoundUwsValueName, &found_uws_strings) != 251 reporter_key.ReadValues(kFoundUwsValueName, &found_uws_strings) !=
252 ERROR_SUCCESS) { 252 ERROR_SUCCESS) {
253 return; 253 return;
254 } 254 }
255 255
256 rappor::RapporService* rappor_service = nullptr; 256 rappor::RapporServiceImpl* rappor_service = nullptr;
257 if (use_rappor) 257 if (use_rappor)
258 rappor_service = g_browser_process->rappor_service(); 258 rappor_service = g_browser_process->rappor_service();
259 259
260 bool parse_error = false; 260 bool parse_error = false;
261 for (const base::string16& uws_string : found_uws_strings) { 261 for (const base::string16& uws_string : found_uws_strings) {
262 // All UwS ids are expected to be integers. 262 // All UwS ids are expected to be integers.
263 uint32_t uws_id = 0; 263 uint32_t uws_id = 0;
264 if (base::StringToUint(uws_string, &uws_id)) { 264 if (base::StringToUint(uws_string, &uws_id)) {
265 RecordSparseHistogram(kFoundUwsMetricName, uws_id); 265 RecordSparseHistogram(kFoundUwsMetricName, uws_id);
266 if (rappor_service) { 266 if (rappor_service) {
267 rappor_service->RecordSample(kFoundUwsMetricName, 267 rappor_service->RecordSampleString(kFoundUwsMetricName,
268 rappor::COARSE_RAPPOR_TYPE, 268 rappor::COARSE_RAPPOR_TYPE,
269 base::UTF16ToUTF8(uws_string)); 269 base::UTF16ToUTF8(uws_string));
270 } 270 }
271 } else { 271 } else {
272 parse_error = true; 272 parse_error = true;
273 } 273 }
274 274
275 // Clean up the old value. 275 // Clean up the old value.
276 reporter_key.DeleteValue(kFoundUwsValueName); 276 reporter_key.DeleteValue(kFoundUwsValueName);
277 277
278 RecordBooleanHistogram(kFoundUwsReadErrorMetricName, parse_error); 278 RecordBooleanHistogram(kFoundUwsReadErrorMetricName, parse_error);
279 } 279 }
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after
1093 return srt_cleaner_key.Open(HKEY_CURRENT_USER, cleaner_key_path.c_str(), 1093 return srt_cleaner_key.Open(HKEY_CURRENT_USER, cleaner_key_path.c_str(),
1094 KEY_QUERY_VALUE) == ERROR_SUCCESS && 1094 KEY_QUERY_VALUE) == ERROR_SUCCESS &&
1095 srt_cleaner_key.GetValueCount() > 0; 1095 srt_cleaner_key.GetValueCount() > 0;
1096 } 1096 }
1097 1097
1098 void SetSwReporterTestingDelegate(SwReporterTestingDelegate* delegate) { 1098 void SetSwReporterTestingDelegate(SwReporterTestingDelegate* delegate) {
1099 g_testing_delegate_ = delegate; 1099 g_testing_delegate_ = delegate;
1100 } 1100 }
1101 1101
1102 } // namespace safe_browsing 1102 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698