Index: chrome/browser/android/tab_android.cc |
diff --git a/chrome/browser/android/tab_android.cc b/chrome/browser/android/tab_android.cc |
index 3fb802787434a78b513ed22084f8ff6a5213843d..0128a4979de3e0d4c7be4648ca8149331c1cda54 100644 |
--- a/chrome/browser/android/tab_android.cc |
+++ b/chrome/browser/android/tab_android.cc |
@@ -23,6 +23,8 @@ |
#include "chrome/browser/sync/glue/synced_tab_delegate_android.h" |
#include "chrome/browser/translate/translate_tab_helper.h" |
#include "chrome/browser/ui/alternate_error_tab_observer.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/android/window_android_helper.h" |
#include "chrome/browser/ui/autofill/tab_autofill_manager_delegate.h" |
#include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" |
@@ -238,6 +240,17 @@ void TabAndroid::InitWebContents(JNIEnv* env, |
synced_tab_delegate_->SetWebContents(web_contents()); |
+ // Set the window ID if there is a valid TabModel. |
+ TabModel* model = TabModelList::GetTabModelWithProfile(GetProfile()); |
+ if (model) { |
+ SessionID window_id; |
+ window_id.set_id(model->GetSessionId()); |
+ |
+ SessionTabHelper* session_tab_helper = |
+ SessionTabHelper::FromWebContents(web_contents()); |
+ session_tab_helper->SetWindowID(window_id); |
+ } |
+ |
// Verify that the WebContents this tab represents matches the expected |
// off the record state. |
CHECK_EQ(GetProfile()->IsOffTheRecord(), incognito); |