Commit 7e2df8f4 authored by dtrainor@chromium.org's avatar dtrainor@chromium.org

Set the WindowId of the SessionTabHelper

- When initializing the WebContents for Android pull the
WindowId from the TabModel and push it to the SessionTabHelper.

BUG=277135
NOTRY=true

Review URL: https://chromiumcodereview.appspot.com/23792002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@221798 0039d316-1c4b-4281-b951-d872f2087c98
parent cc52dbc4
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
#include "chrome/browser/sync/glue/synced_tab_delegate_android.h" #include "chrome/browser/sync/glue/synced_tab_delegate_android.h"
#include "chrome/browser/translate/translate_tab_helper.h" #include "chrome/browser/translate/translate_tab_helper.h"
#include "chrome/browser/ui/alternate_error_tab_observer.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/android/window_android_helper.h"
#include "chrome/browser/ui/autofill/tab_autofill_manager_delegate.h" #include "chrome/browser/ui/autofill/tab_autofill_manager_delegate.h"
#include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h"
...@@ -238,6 +240,17 @@ void TabAndroid::InitWebContents(JNIEnv* env, ...@@ -238,6 +240,17 @@ void TabAndroid::InitWebContents(JNIEnv* env,
synced_tab_delegate_->SetWebContents(web_contents()); 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 // Verify that the WebContents this tab represents matches the expected
// off the record state. // off the record state.
CHECK_EQ(GetProfile()->IsOffTheRecord(), incognito); CHECK_EQ(GetProfile()->IsOffTheRecord(), incognito);
......
...@@ -50,8 +50,11 @@ TabModel* TabModelList::GetTabModelWithProfile( ...@@ -50,8 +50,11 @@ TabModel* TabModelList::GetTabModelWithProfile(
for (TabModelList::const_iterator i = TabModelList::begin(); for (TabModelList::const_iterator i = TabModelList::begin();
i != TabModelList::end(); ++i) { i != TabModelList::end(); ++i) {
if (profile->IsSameProfile((*i)->GetProfile())) Profile* model_profile = (*i)->GetProfile();
if (profile->IsSameProfile(model_profile) &&
profile->IsOffTheRecord() == model_profile->IsOffTheRecord()) {
return *i; return *i;
}
} }
return NULL; return NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment