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

Side by Side Diff: chrome/browser/android/feedback/connectivity_checker.cc

Issue 2375773002: Add data usage tracking for feedback uploader, crash uploader, dom distiller (Closed)
Patch Set: Change to TRACING_UPLOADER Created 4 years, 2 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
« no previous file with comments | « no previous file | chrome/browser/tracing/crash_service_uploader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/android/feedback/connectivity_checker.h" 5 #include "chrome/browser/android/feedback/connectivity_checker.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/android/scoped_java_ref.h" 9 #include "base/android/scoped_java_ref.h"
10 #include "base/location.h" 10 #include "base/location.h"
11 #include "base/single_thread_task_runner.h" 11 #include "base/single_thread_task_runner.h"
12 #include "base/threading/thread_task_runner_handle.h" 12 #include "base/threading/thread_task_runner_handle.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "base/timer/timer.h" 14 #include "base/timer/timer.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/profiles/profile_android.h" 16 #include "chrome/browser/profiles/profile_android.h"
17 #include "components/data_use_measurement/core/data_use_user_data.h"
17 #include "jni/ConnectivityChecker_jni.h" 18 #include "jni/ConnectivityChecker_jni.h"
18 #include "net/base/load_flags.h" 19 #include "net/base/load_flags.h"
19 #include "net/http/http_status_code.h" 20 #include "net/http/http_status_code.h"
20 #include "net/url_request/url_fetcher.h" 21 #include "net/url_request/url_fetcher.h"
21 #include "net/url_request/url_fetcher_delegate.h" 22 #include "net/url_request/url_fetcher_delegate.h"
22 #include "net/url_request/url_request_context_getter.h" 23 #include "net/url_request/url_request_context_getter.h"
23 #include "net/url_request/url_request_status.h" 24 #include "net/url_request/url_request_status.h"
24 #include "url/gurl.h" 25 #include "url/gurl.h"
25 26
26 using base::android::JavaParamRef; 27 using base::android::JavaParamRef;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 const base::android::JavaRef<jobject>& java_callback) 135 const base::android::JavaRef<jobject>& java_callback)
135 : request_context_(profile->GetRequestContext()), 136 : request_context_(profile->GetRequestContext()),
136 url_(url), 137 url_(url),
137 timeout_(timeout), 138 timeout_(timeout),
138 java_callback_(java_callback), 139 java_callback_(java_callback),
139 is_being_destroyed_(false) { 140 is_being_destroyed_(false) {
140 } 141 }
141 142
142 void ConnectivityChecker::StartAsyncCheck() { 143 void ConnectivityChecker::StartAsyncCheck() {
143 url_fetcher_ = net::URLFetcher::Create(url_, net::URLFetcher::GET, this); 144 url_fetcher_ = net::URLFetcher::Create(url_, net::URLFetcher::GET, this);
145 data_use_measurement::DataUseUserData::AttachToFetcher(
146 url_fetcher_.get(),
147 data_use_measurement::DataUseUserData::FEEDBACK_UPLOADER);
144 url_fetcher_->SetRequestContext(request_context_); 148 url_fetcher_->SetRequestContext(request_context_);
145 url_fetcher_->SetStopOnRedirect(true); 149 url_fetcher_->SetStopOnRedirect(true);
146 url_fetcher_->SetAutomaticallyRetryOn5xx(false); 150 url_fetcher_->SetAutomaticallyRetryOn5xx(false);
147 url_fetcher_->SetAutomaticallyRetryOnNetworkChanges(0); 151 url_fetcher_->SetAutomaticallyRetryOnNetworkChanges(0);
148 url_fetcher_->SetLoadFlags(net::LOAD_BYPASS_CACHE | net::LOAD_DISABLE_CACHE | 152 url_fetcher_->SetLoadFlags(net::LOAD_BYPASS_CACHE | net::LOAD_DISABLE_CACHE |
149 net::LOAD_DO_NOT_SAVE_COOKIES | 153 net::LOAD_DO_NOT_SAVE_COOKIES |
150 net::LOAD_DO_NOT_SEND_COOKIES | 154 net::LOAD_DO_NOT_SEND_COOKIES |
151 net::LOAD_DO_NOT_SEND_AUTH_DATA); 155 net::LOAD_DO_NOT_SEND_AUTH_DATA);
152 url_fetcher_->Start(); 156 url_fetcher_->Start();
153 expiration_timer_.reset(new base::OneShotTimer()); 157 expiration_timer_.reset(new base::OneShotTimer());
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 GURL url(base::android::ConvertJavaStringToUTF8(env, j_url)); 200 GURL url(base::android::ConvertJavaStringToUTF8(env, j_url));
197 return url.is_valid(); 201 return url.is_valid();
198 } 202 }
199 203
200 bool RegisterConnectivityChecker(JNIEnv* env) { 204 bool RegisterConnectivityChecker(JNIEnv* env) {
201 return RegisterNativesImpl(env); 205 return RegisterNativesImpl(env);
202 } 206 }
203 207
204 } // namespace android 208 } // namespace android
205 } // namespace chrome 209 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/tracing/crash_service_uploader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698