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 |