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

Side by Side Diff: android_webview/native/aw_contents_statics.cc

Issue 412143009: Moved data reduction proxy initialization logic to ProfileImplIOData (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added suggestion from sgurun Created 6 years, 4 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 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 "android_webview/native/aw_contents_statics.h" 5 #include "android_webview/native/aw_contents_statics.h"
6 6
7 #include "android_webview/browser/aw_browser_context.h" 7 #include "android_webview/browser/aw_browser_context.h"
8 #include "android_webview/browser/net/aw_url_request_context_getter.h"
8 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
9 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
10 #include "base/callback.h" 11 #include "base/callback.h"
11 #include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_requ est_handler.h" 12 #include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_requ est_handler.h"
12 #include "content/public/browser/android/synchronous_compositor.h" 13 #include "content/public/browser/android/synchronous_compositor.h"
13 #include "content/public/browser/browser_thread.h" 14 #include "content/public/browser/browser_thread.h"
14 #include "content/public/common/url_constants.h" 15 #include "content/public/common/url_constants.h"
15 #include "jni/AwContentsStatics_jni.h" 16 #include "jni/AwContentsStatics_jni.h"
16 #include "net/cert/cert_database.h" 17 #include "net/cert/cert_database.h"
17 18
(...skipping 29 matching lines...) Expand all
47 BrowserThread::IO, 48 BrowserThread::IO,
48 FROM_HERE, 49 FROM_HERE,
49 base::Bind(&NotifyClientCertificatesChanged), 50 base::Bind(&NotifyClientCertificatesChanged),
50 base::Bind(&ClientCertificatesCleared, base::Owned(j_callback))); 51 base::Bind(&ClientCertificatesCleared, base::Owned(j_callback)));
51 } 52 }
52 53
53 // static 54 // static
54 void SetDataReductionProxyKey(JNIEnv* env, jclass, jstring key) { 55 void SetDataReductionProxyKey(JNIEnv* env, jclass, jstring key) {
55 AwBrowserContext* browser_context = AwBrowserContext::GetDefault(); 56 AwBrowserContext* browser_context = AwBrowserContext::GetDefault();
56 DCHECK(browser_context); 57 DCHECK(browser_context);
57 DataReductionProxyAuthRequestHandler* drp_auth_request_handler = 58 DCHECK(browser_context->GetRequestContext());
58 browser_context->GetDataReductionProxyAuthRequestHandler(); 59 AwURLRequestContextGetter* aw_url_request_context_getter =
59 if (drp_auth_request_handler) 60 static_cast<AwURLRequestContextGetter*>(
60 drp_auth_request_handler->SetKey( 61 browser_context->GetRequestContext());
62 DataReductionProxyAuthRequestHandler* auth_request_handler =
63 aw_url_request_context_getter->GetDataReductionProxyAuthRequestHandler();
64 if (auth_request_handler) {
65 auth_request_handler->SetKeyOnUI(
61 ConvertJavaStringToUTF8(env, key), 66 ConvertJavaStringToUTF8(env, key),
62 data_reduction_proxy::kClientAndroidWebview, 67 data_reduction_proxy::kClientAndroidWebview,
63 data_reduction_proxy::kProtocolVersion); 68 data_reduction_proxy::kProtocolVersion);
69 } else {
70 DLOG(ERROR) << "Data reduction proxy auth request handler does not exist";
71 }
64 } 72 }
65 73
66 // static 74 // static
67 void SetDataReductionProxyEnabled(JNIEnv* env, jclass, jboolean enabled) { 75 void SetDataReductionProxyEnabled(JNIEnv* env, jclass, jboolean enabled) {
68 AwBrowserContext::SetDataReductionProxyEnabled(enabled); 76 AwBrowserContext::SetDataReductionProxyEnabled(enabled);
69 } 77 }
70 78
71 // static 79 // static
72 jstring GetUnreachableWebDataUrl(JNIEnv* env, jclass) { 80 jstring GetUnreachableWebDataUrl(JNIEnv* env, jclass) {
73 return base::android::ConvertUTF8ToJavaString( 81 return base::android::ConvertUTF8ToJavaString(
74 env, content::kUnreachableWebDataURL).Release(); 82 env, content::kUnreachableWebDataURL).Release();
75 } 83 }
76 84
77 // static 85 // static
78 void SetRecordFullDocument(JNIEnv* env, jclass, jboolean record_full_document) { 86 void SetRecordFullDocument(JNIEnv* env, jclass, jboolean record_full_document) {
79 content::SynchronousCompositor::SetRecordFullDocument(record_full_document); 87 content::SynchronousCompositor::SetRecordFullDocument(record_full_document);
80 } 88 }
81 89
82 bool RegisterAwContentsStatics(JNIEnv* env) { 90 bool RegisterAwContentsStatics(JNIEnv* env) {
83 return RegisterNativesImpl(env); 91 return RegisterNativesImpl(env);
84 } 92 }
85 93
86 } // namespace android_webview 94 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698