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

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

Issue 2088443003: Shortcut ctrl+shift+T added on android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: set window id for android into TabRestoreService::Tab.browser_id, to select the correct android tab… Created 4 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
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 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 const GURL& tab_url = web_contents->GetURL(); 701 const GURL& tab_url = web_contents->GetURL();
702 if (tab_url.SchemeIs(content::kChromeUIScheme) || 702 if (tab_url.SchemeIs(content::kChromeUIScheme) ||
703 tab_url.SchemeIs(chrome::kChromeNativeScheme) || 703 tab_url.SchemeIs(chrome::kChromeNativeScheme) ||
704 tab_url.SchemeIs(url::kAboutScheme)) { 704 tab_url.SchemeIs(url::kAboutScheme)) {
705 return; 705 return;
706 } 706 }
707 707
708 // TODO(jcivelli): is the index important? 708 // TODO(jcivelli): is the index important?
709 service->CreateHistoricalTab( 709 service->CreateHistoricalTab(
710 sessions::ContentLiveTab::GetForWebContents(web_contents), -1); 710 sessions::ContentLiveTab::GetForWebContents(web_contents), -1);
711
712 // write android tab window id into TabRestoreService::Tab.browser_id.
713 if (!service->entries().empty()) {
714 TabAndroid* tab_android = TabAndroid::FromWebContents(web_contents);
715 using RestoreTab = sessions::TabRestoreService::Tab;
716 RestoreTab* restore_tab =
717 static_cast<RestoreTab*>(service->GetMostRecentEntry());
718 restore_tab->browser_id = tab_android->window_id().id();
719 }
711 } 720 }
712 721
713 void TabAndroid::CreateHistoricalTab(JNIEnv* env, 722 void TabAndroid::CreateHistoricalTab(JNIEnv* env,
714 const JavaParamRef<jobject>& obj) { 723 const JavaParamRef<jobject>& obj) {
715 TabAndroid::CreateHistoricalTabFromContents(web_contents()); 724 TabAndroid::CreateHistoricalTabFromContents(web_contents());
716 } 725 }
717 726
718 void TabAndroid::UpdateTopControlsState(JNIEnv* env, 727 void TabAndroid::UpdateTopControlsState(JNIEnv* env,
719 const JavaParamRef<jobject>& obj, 728 const JavaParamRef<jobject>& obj,
720 jint constraints, 729 jint constraints,
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { 910 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) {
902 TRACE_EVENT0("native", "TabAndroid::Init"); 911 TRACE_EVENT0("native", "TabAndroid::Init");
903 // This will automatically bind to the Java object and pass ownership there. 912 // This will automatically bind to the Java object and pass ownership there.
904 new TabAndroid(env, obj); 913 new TabAndroid(env, obj);
905 } 914 }
906 915
907 // static 916 // static
908 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { 917 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) {
909 return RegisterNativesImpl(env); 918 return RegisterNativesImpl(env);
910 } 919 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698