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

Unified Diff: chrome/browser/sessions/session_restore_android.cc

Issue 36473002: Foreign session pages now load into current tab. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moar owners Created 7 years, 1 month 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
« chrome/browser/sessions/OWNERS ('K') | « chrome/browser/sessions/OWNERS ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sessions/session_restore_android.cc
diff --git a/chrome/browser/sessions/session_restore_android.cc b/chrome/browser/sessions/session_restore_android.cc
index 9261700eff7049665b447ce0e03fcd0efcef1f71..7843c6fc3d70f9364e2fb82c1e7b60f257841ecc 100644
--- a/chrome/browser/sessions/session_restore_android.cc
+++ b/chrome/browser/sessions/session_restore_android.cc
@@ -6,12 +6,13 @@
#include <vector>
+#include "chrome/browser/android/tab_android.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sessions/session_types.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/android/tab_model/tab_model.h"
#include "chrome/browser/ui/android/tab_model/tab_model_list.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/web_contents.h"
@@ -37,7 +38,15 @@ content::WebContents* SessionRestore::RestoreForeignSessionTab(
selected_index,
content::NavigationController::RESTORE_LAST_SESSION_EXITED_CLEANLY,
&entries);
- tab_model->CreateTab(new_web_contents);
+
+ if (disposition == CURRENT_TAB) {
+ TabAndroid* current_tab = TabAndroid::FromWebContents(web_contents);
+ DCHECK(current_tab);
+ current_tab->SwapTabContents(web_contents, new_web_contents);
Yaron 2013/11/04 18:48:37 looks like you're leaking the old web_contents. Fr
apiccion 2013/11/04 19:43:52 Deleted the object here. Added a comment in .h fil
+ } else {
+ DCHECK(disposition == NEW_FOREGROUND_TAB);
Yaron 2013/11/04 18:48:37 DCHECK_EQ
apiccion 2013/11/04 19:43:52 Done.
+ tab_model->CreateTab(new_web_contents);
+ }
return new_web_contents;
}
« chrome/browser/sessions/OWNERS ('K') | « chrome/browser/sessions/OWNERS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698