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

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

Issue 1864583006: Simplify BrowserContext by removing redundant methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 8 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 "android_webview/browser/net/aw_url_request_context_getter.h"
9 #include "android_webview/common/aw_version_info_values.h" 9 #include "android_webview/common/aw_version_info_values.h"
10 #include "android_webview/native/aw_contents_io_thread_client_impl.h" 10 #include "android_webview/native/aw_contents_io_thread_client_impl.h"
11 #include "base/android/jni_string.h" 11 #include "base/android/jni_string.h"
12 #include "base/android/scoped_java_ref.h" 12 #include "base/android/scoped_java_ref.h"
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "content/public/browser/browser_thread.h" 14 #include "content/public/browser/browser_thread.h"
15 #include "content/public/browser/storage_partition.h"
15 #include "content/public/common/url_constants.h" 16 #include "content/public/common/url_constants.h"
16 #include "jni/AwContentsStatics_jni.h" 17 #include "jni/AwContentsStatics_jni.h"
17 #include "net/cert/cert_database.h" 18 #include "net/cert/cert_database.h"
18 19
19 using base::android::AttachCurrentThread; 20 using base::android::AttachCurrentThread;
20 using base::android::ConvertJavaStringToUTF8; 21 using base::android::ConvertJavaStringToUTF8;
21 using base::android::ScopedJavaGlobalRef; 22 using base::android::ScopedJavaGlobalRef;
22 using content::BrowserThread; 23 using content::BrowserThread;
23 24
24 namespace android_webview { 25 namespace android_webview {
(...skipping 26 matching lines...) Expand all
51 base::Bind(&NotifyClientCertificatesChanged), 52 base::Bind(&NotifyClientCertificatesChanged),
52 base::Bind(&ClientCertificatesCleared, base::Owned(j_callback))); 53 base::Bind(&ClientCertificatesCleared, base::Owned(j_callback)));
53 } 54 }
54 55
55 // static 56 // static
56 void SetDataReductionProxyKey(JNIEnv* env, 57 void SetDataReductionProxyKey(JNIEnv* env,
57 const JavaParamRef<jclass>&, 58 const JavaParamRef<jclass>&,
58 const JavaParamRef<jstring>& key) { 59 const JavaParamRef<jstring>& key) {
59 AwBrowserContext* browser_context = AwBrowserContext::GetDefault(); 60 AwBrowserContext* browser_context = AwBrowserContext::GetDefault();
60 DCHECK(browser_context); 61 DCHECK(browser_context);
61 DCHECK(browser_context->GetRequestContext());
62 // The following call to GetRequestContext() could possibly be the first such 62 // The following call to GetRequestContext() could possibly be the first such
63 // call, which means AwURLRequestContextGetter::InitializeURLRequestContext 63 // call, which means AwURLRequestContextGetter::InitializeURLRequestContext
64 // will be called on IO thread as a result. 64 // will be called on IO thread as a result.
65 AwURLRequestContextGetter* aw_url_request_context_getter = 65 AwURLRequestContextGetter* aw_url_request_context_getter =
66 static_cast<AwURLRequestContextGetter*>( 66 static_cast<AwURLRequestContextGetter*>(
67 browser_context->GetRequestContext()); 67 content::BrowserContext::GetDefaultStoragePartition(browser_context)->
68 GetURLRequestContext());
69 DCHECK(aw_url_request_context_getter);
68 70
69 // This PostTask has to be called after GetRequestContext, because SetKeyOnIO 71 // This PostTask has to be called after GetRequestContext, because SetKeyOnIO
70 // needs a valid DataReductionProxyRequestOptions object. 72 // needs a valid DataReductionProxyRequestOptions object.
71 BrowserThread::PostTask(BrowserThread::IO, 73 BrowserThread::PostTask(BrowserThread::IO,
72 FROM_HERE, 74 FROM_HERE,
73 base::Bind(&AwURLRequestContextGetter::SetKeyOnIO, 75 base::Bind(&AwURLRequestContextGetter::SetKeyOnIO,
74 aw_url_request_context_getter, 76 aw_url_request_context_getter,
75 ConvertJavaStringToUTF8(env, key))); 77 ConvertJavaStringToUTF8(env, key)));
76 } 78 }
77 79
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 AwContentsIoThreadClientImpl::SetServiceWorkerIoThreadClient( 114 AwContentsIoThreadClientImpl::SetServiceWorkerIoThreadClient(
113 io_thread_client, browser_context); 115 io_thread_client, browser_context);
114 } 116 }
115 117
116 118
117 bool RegisterAwContentsStatics(JNIEnv* env) { 119 bool RegisterAwContentsStatics(JNIEnv* env) {
118 return RegisterNativesImpl(env); 120 return RegisterNativesImpl(env);
119 } 121 }
120 122
121 } // namespace android_webview 123 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/browser/net/token_binding_manager.cc ('k') | blimp/engine/common/blimp_browser_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698