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

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

Issue 1223643002: android_webview: Replace usage of GetActiveEntry by GetLastCommittedEntry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « no previous file | android_webview/native/permission/permission_request_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 } 684 }
685 685
686 void AwContents::OnReceivedIcon(const GURL& icon_url, const SkBitmap& bitmap) { 686 void AwContents::OnReceivedIcon(const GURL& icon_url, const SkBitmap& bitmap) {
687 DCHECK_CURRENTLY_ON(BrowserThread::UI); 687 DCHECK_CURRENTLY_ON(BrowserThread::UI);
688 JNIEnv* env = AttachCurrentThread(); 688 JNIEnv* env = AttachCurrentThread();
689 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 689 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
690 if (obj.is_null()) 690 if (obj.is_null())
691 return; 691 return;
692 692
693 content::NavigationEntry* entry = 693 content::NavigationEntry* entry =
694 web_contents_->GetController().GetActiveEntry(); 694 web_contents_->GetController().GetLastCommittedEntry();
695 695
696 if (entry) { 696 if (entry) {
nasko 2015/07/03 10:00:59 Just a generic comment for the overall code struct
Torne 2015/07/03 10:12:59 Hm, possibly :/ File a bug and we can look into i
697 entry->GetFavicon().valid = true; 697 entry->GetFavicon().valid = true;
698 entry->GetFavicon().url = icon_url; 698 entry->GetFavicon().url = icon_url;
699 entry->GetFavicon().image = gfx::Image::CreateFrom1xBitmap(bitmap); 699 entry->GetFavicon().image = gfx::Image::CreateFrom1xBitmap(bitmap);
700 } 700 }
701 701
702 Java_AwContents_onReceivedIcon( 702 Java_AwContents_onReceivedIcon(
703 env, obj.obj(), gfx::ConvertToJavaBitmap(&bitmap).obj()); 703 env, obj.obj(), gfx::ConvertToJavaBitmap(&bitmap).obj());
704 } 704 }
705 705
706 void AwContents::OnReceivedTouchIconUrl(const std::string& url, 706 void AwContents::OnReceivedTouchIconUrl(const std::string& url,
(...skipping 29 matching lines...) Expand all
736 DCHECK_CURRENTLY_ON(BrowserThread::UI); 736 DCHECK_CURRENTLY_ON(BrowserThread::UI);
737 JNIEnv* env = AttachCurrentThread(); 737 JNIEnv* env = AttachCurrentThread();
738 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 738 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
739 if (!obj.is_null()) { 739 if (!obj.is_null()) {
740 devtools_instrumentation::ScopedEmbedderCallbackTask embedder_callback( 740 devtools_instrumentation::ScopedEmbedderCallbackTask embedder_callback(
741 "onNewPicture"); 741 "onNewPicture");
742 Java_AwContents_onNewPicture(env, obj.obj()); 742 Java_AwContents_onNewPicture(env, obj.obj());
743 } 743 }
744 } 744 }
745 745
746 base::android::ScopedJavaLocalRef<jbyteArray> 746 base::android::ScopedJavaLocalRef<jbyteArray> AwContents::GetCertificate(
747 AwContents::GetCertificate(JNIEnv* env, 747 JNIEnv* env,
748 jobject obj) { 748 jobject obj) {
749 DCHECK_CURRENTLY_ON(BrowserThread::UI); 749 DCHECK_CURRENTLY_ON(BrowserThread::UI);
750 content::NavigationEntry* entry = 750 content::NavigationEntry* entry =
751 web_contents_->GetController().GetActiveEntry(); 751 web_contents_->GetController().GetLastCommittedEntry();
752 if (!entry) 752 if (!entry)
753 return ScopedJavaLocalRef<jbyteArray>(); 753 return ScopedJavaLocalRef<jbyteArray>();
754 // Get the certificate 754 // Get the certificate
755 int cert_id = entry->GetSSL().cert_id; 755 int cert_id = entry->GetSSL().cert_id;
756 scoped_refptr<net::X509Certificate> cert; 756 scoped_refptr<net::X509Certificate> cert;
757 bool ok = content::CertStore::GetInstance()->RetrieveCert(cert_id, &cert); 757 bool ok = content::CertStore::GetInstance()->RetrieveCert(cert_id, &cert);
758 if (!ok) 758 if (!ok)
759 return ScopedJavaLocalRef<jbyteArray>(); 759 return ScopedJavaLocalRef<jbyteArray>();
760 760
761 // Convert the certificate and return it 761 // Convert the certificate and return it
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 1189
1190 AwMessagePortServiceImpl::GetInstance()->CreateMessageChannel(env, ports, 1190 AwMessagePortServiceImpl::GetInstance()->CreateMessageChannel(env, ports,
1191 GetMessagePortMessageFilter()); 1191 GetMessagePortMessageFilter());
1192 } 1192 }
1193 1193
1194 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { 1194 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) {
1195 g_should_download_favicons = true; 1195 g_should_download_favicons = true;
1196 } 1196 }
1197 1197
1198 } // namespace android_webview 1198 } // namespace android_webview
OLDNEW
« no previous file with comments | « no previous file | android_webview/native/permission/permission_request_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698