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

Unified Diff: android_webview/browser/aw_certificate_error_handler_base.cc

Issue 12091111: Implement Webviewclient.onReceivedSslError (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: code review from joth Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: android_webview/browser/aw_certificate_error_handler_base.cc
diff --git a/android_webview/browser/aw_certificate_error_handler_base.cc b/android_webview/browser/aw_certificate_error_handler_base.cc
new file mode 100644
index 0000000000000000000000000000000000000000..87d037741abc003444a405599afe58447609814c
--- /dev/null
+++ b/android_webview/browser/aw_certificate_error_handler_base.cc
@@ -0,0 +1,53 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "android_webview/browser/aw_certificate_error_handler_base.h"
+
+#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/render_view_host.h"
+#include "content/public/browser/web_contents.h"
+
+using content::BrowserThread;
+using content::WebContents;
+
+namespace android_webview {
+
+const void*
+AwCertificateErrorHandlerBase::UserData::kAwCertificateErrorHandlerBase =
+ &kAwCertificateErrorHandlerBase;
+
+AwCertificateErrorHandlerBase::UserData::UserData(
+ AwCertificateErrorHandlerBase* ptr)
+ : contents_(ptr) {
+}
+
+// static
+AwCertificateErrorHandlerBase*
+AwCertificateErrorHandlerBase::UserData::GetContents(
+ WebContents* web_contents) {
+ if (!web_contents)
+ return NULL;
+ UserData* data = reinterpret_cast<UserData*>(
+ web_contents->GetUserData(kAwCertificateErrorHandlerBase));
+ return data ? data->contents_ : NULL;
+}
+
+// static
+AwCertificateErrorHandlerBase* AwCertificateErrorHandlerBase::FromID(
+ int render_process_id,
+ int render_view_id) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ const content::RenderViewHost* rvh =
+ content::RenderViewHost::FromID(render_process_id, render_view_id);
+ if (!rvh) return NULL;
+ content::WebContents* web_contents =
+ content::WebContents::FromRenderViewHost(rvh);
+ if (!web_contents) return NULL;
joth 2013/02/22 23:12:41 nit: you already have this check into GetContents.
sgurun-gerrit only 2013/02/23 00:16:14 Done.
+ return UserData::GetContents(web_contents);
+}
+
+AwCertificateErrorHandlerBase::~AwCertificateErrorHandlerBase() {
+}
+
+} // namespace android_webview

Powered by Google App Engine
This is Rietveld 408576698