OLD | NEW |
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/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 const base::TimeDelta& timeout, | 129 const base::TimeDelta& timeout, |
130 const base::android::JavaRef<jobject>& java_callback) | 130 const base::android::JavaRef<jobject>& java_callback) |
131 : request_context_(profile->GetRequestContext()), | 131 : request_context_(profile->GetRequestContext()), |
132 url_(url), | 132 url_(url), |
133 timeout_(timeout), | 133 timeout_(timeout), |
134 java_callback_(java_callback), | 134 java_callback_(java_callback), |
135 is_being_destroyed_(false) { | 135 is_being_destroyed_(false) { |
136 } | 136 } |
137 | 137 |
138 void ConnectivityChecker::StartAsyncCheck() { | 138 void ConnectivityChecker::StartAsyncCheck() { |
139 url_fetcher_ = | 139 url_fetcher_ = net::URLFetcher::Create(url_, net::URLFetcher::GET, this); |
140 net::URLFetcher::Create(url_, net::URLFetcher::GET, this).Pass(); | |
141 url_fetcher_->SetRequestContext(request_context_); | 140 url_fetcher_->SetRequestContext(request_context_); |
142 url_fetcher_->SetStopOnRedirect(true); | 141 url_fetcher_->SetStopOnRedirect(true); |
143 url_fetcher_->SetAutomaticallyRetryOn5xx(false); | 142 url_fetcher_->SetAutomaticallyRetryOn5xx(false); |
144 url_fetcher_->SetAutomaticallyRetryOnNetworkChanges(0); | 143 url_fetcher_->SetAutomaticallyRetryOnNetworkChanges(0); |
145 url_fetcher_->SetLoadFlags(net::LOAD_BYPASS_CACHE | net::LOAD_DISABLE_CACHE | | 144 url_fetcher_->SetLoadFlags(net::LOAD_BYPASS_CACHE | net::LOAD_DISABLE_CACHE | |
146 net::LOAD_DO_NOT_SAVE_COOKIES | | 145 net::LOAD_DO_NOT_SAVE_COOKIES | |
147 net::LOAD_DO_NOT_SEND_COOKIES | | 146 net::LOAD_DO_NOT_SEND_COOKIES | |
148 net::LOAD_DO_NOT_SEND_AUTH_DATA); | 147 net::LOAD_DO_NOT_SEND_AUTH_DATA); |
149 url_fetcher_->Start(); | 148 url_fetcher_->Start(); |
150 expiration_timer_.reset(new base::OneShotTimer()); | 149 expiration_timer_.reset(new base::OneShotTimer()); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 GURL url(base::android::ConvertJavaStringToUTF8(env, j_url)); | 192 GURL url(base::android::ConvertJavaStringToUTF8(env, j_url)); |
194 return url.is_valid(); | 193 return url.is_valid(); |
195 } | 194 } |
196 | 195 |
197 bool RegisterConnectivityChecker(JNIEnv* env) { | 196 bool RegisterConnectivityChecker(JNIEnv* env) { |
198 return RegisterNativesImpl(env); | 197 return RegisterNativesImpl(env); |
199 } | 198 } |
200 | 199 |
201 } // namespace android | 200 } // namespace android |
202 } // namespace chrome | 201 } // namespace chrome |
OLD | NEW |