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

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

Issue 235563005: Add client cert support to android_webview (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: code review phase 6 Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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.h" 5 #include "android_webview/native/aw_contents.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "android_webview/browser/aw_browser_context.h" 9 #include "android_webview/browser/aw_browser_context.h"
10 #include "android_webview/browser/aw_browser_main_parts.h" 10 #include "android_webview/browser/aw_browser_main_parts.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "content/public/browser/cert_store.h" 47 #include "content/public/browser/cert_store.h"
48 #include "content/public/browser/favicon_status.h" 48 #include "content/public/browser/favicon_status.h"
49 #include "content/public/browser/navigation_entry.h" 49 #include "content/public/browser/navigation_entry.h"
50 #include "content/public/browser/render_frame_host.h" 50 #include "content/public/browser/render_frame_host.h"
51 #include "content/public/browser/render_process_host.h" 51 #include "content/public/browser/render_process_host.h"
52 #include "content/public/browser/render_view_host.h" 52 #include "content/public/browser/render_view_host.h"
53 #include "content/public/browser/web_contents.h" 53 #include "content/public/browser/web_contents.h"
54 #include "content/public/common/renderer_preferences.h" 54 #include "content/public/common/renderer_preferences.h"
55 #include "content/public/common/ssl_status.h" 55 #include "content/public/common/ssl_status.h"
56 #include "jni/AwContents_jni.h" 56 #include "jni/AwContents_jni.h"
57 #include "net/cert/cert_database.h"
57 #include "net/cert/x509_certificate.h" 58 #include "net/cert/x509_certificate.h"
58 #include "third_party/skia/include/core/SkPicture.h" 59 #include "third_party/skia/include/core/SkPicture.h"
59 #include "ui/base/l10n/l10n_util_android.h" 60 #include "ui/base/l10n/l10n_util_android.h"
60 #include "ui/gfx/android/java_bitmap.h" 61 #include "ui/gfx/android/java_bitmap.h"
61 #include "ui/gfx/font_render_params_linux.h" 62 #include "ui/gfx/font_render_params_linux.h"
62 #include "ui/gfx/image/image.h" 63 #include "ui/gfx/image/image.h"
63 #include "ui/gfx/size.h" 64 #include "ui/gfx/size.h"
64 65
65 struct AwDrawSWFunctionTable; 66 struct AwDrawSWFunctionTable;
66 struct AwDrawGLFunctionTable; 67 struct AwDrawGLFunctionTable;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 } 159 }
159 } 160 }
160 161
161 void OnIoThreadClientReady(content::RenderFrameHost* rfh) { 162 void OnIoThreadClientReady(content::RenderFrameHost* rfh) {
162 int render_process_id = rfh->GetProcess()->GetID(); 163 int render_process_id = rfh->GetProcess()->GetID();
163 int render_frame_id = rfh->GetRoutingID(); 164 int render_frame_id = rfh->GetRoutingID();
164 AwResourceDispatcherHostDelegate::OnIoThreadClientReady( 165 AwResourceDispatcherHostDelegate::OnIoThreadClientReady(
165 render_process_id, render_frame_id); 166 render_process_id, render_frame_id);
166 } 167 }
167 168
169 void NotifyClientCertificatesChanged() {
170 DCHECK_CURRENTLY_ON(BrowserThread::IO);
171 net::CertDatabase::GetInstance()->OnAndroidKeyStoreChanged();
172 }
173
168 } // namespace 174 } // namespace
169 175
170 // static 176 // static
171 AwContents* AwContents::FromWebContents(WebContents* web_contents) { 177 AwContents* AwContents::FromWebContents(WebContents* web_contents) {
172 return AwContentsUserData::GetContents(web_contents); 178 return AwContentsUserData::GetContents(web_contents);
173 } 179 }
174 180
175 // static 181 // static
176 AwContents* AwContents::FromID(int render_process_id, int render_view_id) { 182 AwContents* AwContents::FromID(int render_process_id, int render_view_id) {
177 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 183 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
(...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 std::string extra_headers; 1037 std::string extra_headers;
1032 if (jextra_headers) 1038 if (jextra_headers)
1033 extra_headers = ConvertJavaStringToUTF8(env, jextra_headers); 1039 extra_headers = ConvertJavaStringToUTF8(env, jextra_headers);
1034 AwResourceContext* resource_context = static_cast<AwResourceContext*>( 1040 AwResourceContext* resource_context = static_cast<AwResourceContext*>(
1035 AwBrowserContext::FromWebContents(web_contents_.get())-> 1041 AwBrowserContext::FromWebContents(web_contents_.get())->
1036 GetResourceContext()); 1042 GetResourceContext());
1037 resource_context->SetExtraHeaders(GURL(ConvertJavaStringToUTF8(env, url)), 1043 resource_context->SetExtraHeaders(GURL(ConvertJavaStringToUTF8(env, url)),
1038 extra_headers); 1044 extra_headers);
1039 } 1045 }
1040 1046
1047 void AwContents::ClearClientCertPreferences(JNIEnv* env, jobject obj) {
1048 content::BrowserThread::PostTask(
1049 BrowserThread::IO,
1050 FROM_HERE,
1051 base::Bind(&NotifyClientCertificatesChanged));
1052 }
1053
1041 void AwContents::SetJsOnlineProperty(JNIEnv* env, 1054 void AwContents::SetJsOnlineProperty(JNIEnv* env,
1042 jobject obj, 1055 jobject obj,
1043 jboolean network_up) { 1056 jboolean network_up) {
1044 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1057 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1045 render_view_host_ext_->SetJsOnlineProperty(network_up); 1058 render_view_host_ext_->SetJsOnlineProperty(network_up);
1046 } 1059 }
1047 1060
1048 void AwContents::TrimMemoryOnRenderThread(JNIEnv* env, 1061 void AwContents::TrimMemoryOnRenderThread(JNIEnv* env,
1049 jobject obj, 1062 jobject obj,
1050 jint level, 1063 jint level,
(...skipping 10 matching lines...) Expand all
1061 1074
1062 void AwContents::ForceFakeComposite() { 1075 void AwContents::ForceFakeComposite() {
1063 browser_view_renderer_.ForceFakeCompositeSW(); 1076 browser_view_renderer_.ForceFakeCompositeSW();
1064 } 1077 }
1065 1078
1066 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { 1079 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) {
1067 g_should_download_favicons = true; 1080 g_should_download_favicons = true;
1068 } 1081 }
1069 1082
1070 } // namespace android_webview 1083 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698