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

Side by Side Diff: chrome/browser/android/tab_android.cc

Issue 2327083002: Ntp: restore scroll position. (Closed)
Patch Set: Cleanups. Created 4 years, 3 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 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 "chrome/browser/android/tab_android.h" 5 #include "chrome/browser/android/tab_android.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "base/android/jni_string.h" 10 #include "base/android/jni_string.h"
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 std::string url; 653 std::string url;
654 if (jurl) 654 if (jurl)
655 url = base::android::ConvertJavaStringToUTF8(env, jurl); 655 url = base::android::ConvertJavaStringToUTF8(env, jurl);
656 656
657 content::NavigationEntry* entry = 657 content::NavigationEntry* entry =
658 web_contents()->GetController().GetVisibleEntry(); 658 web_contents()->GetController().GetVisibleEntry();
659 if (entry && url == entry->GetVirtualURL().spec()) 659 if (entry && url == entry->GetVirtualURL().spec())
660 entry->SetTitle(title); 660 entry->SetTitle(title);
661 } 661 }
662 662
663 void TabAndroid::SetLastCommittedNavigationEntryExtraData(
664 JNIEnv* env,
665 const JavaParamRef<jobject>& obj,
666 const JavaParamRef<jstring>& jkey,
667 const JavaParamRef<jstring>& jvalue) {
668 DCHECK(web_contents());
669
670 std::string key;
671 if (jkey)
Bernhard Bauer 2016/09/16 15:02:50 I don't think we expect either of these to be null
Michael van Ouwerkerk 2016/09/16 16:35:05 Done.
672 key = base::android::ConvertJavaStringToUTF8(env, jkey);
673
674 base::string16 value;
675 if (jvalue)
676 value = base::android::ConvertJavaStringToUTF16(env, jvalue);
677
678 content::NavigationEntry* entry =
679 web_contents()->GetController().GetLastCommittedEntry();
680 if (entry)
681 entry->SetExtraData(key, value);
682 }
683
663 bool TabAndroid::Print(JNIEnv* env, const JavaParamRef<jobject>& obj) { 684 bool TabAndroid::Print(JNIEnv* env, const JavaParamRef<jobject>& obj) {
664 if (!web_contents()) 685 if (!web_contents())
665 return false; 686 return false;
666 687
667 printing::PrintViewManagerBasic::CreateForWebContents(web_contents()); 688 printing::PrintViewManagerBasic::CreateForWebContents(web_contents());
668 printing::PrintViewManagerBasic* print_view_manager = 689 printing::PrintViewManagerBasic* print_view_manager =
669 printing::PrintViewManagerBasic::FromWebContents(web_contents()); 690 printing::PrintViewManagerBasic::FromWebContents(web_contents());
670 if (print_view_manager == NULL) 691 if (print_view_manager == NULL)
671 return false; 692 return false;
672 693
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
918 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { 939 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) {
919 TRACE_EVENT0("native", "TabAndroid::Init"); 940 TRACE_EVENT0("native", "TabAndroid::Init");
920 // This will automatically bind to the Java object and pass ownership there. 941 // This will automatically bind to the Java object and pass ownership there.
921 new TabAndroid(env, obj); 942 new TabAndroid(env, obj);
922 } 943 }
923 944
924 // static 945 // static
925 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { 946 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) {
926 return RegisterNativesImpl(env); 947 return RegisterNativesImpl(env);
927 } 948 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698