Skip to content

Commit

Permalink
[Sync] Fix the session info on NTP to properly set opacity. Fix bug i…
Browse files Browse the repository at this point in the history
…n association for dev console.

BUG=74771
TEST=Run with --enable-sync-sessions and --sync-url set to a server that supports sessions. Check that sessions are visible.

Review URL: http://codereview.chromium.org/6610008

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76832 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
zea@chromium.org committed Mar 3, 2011
1 parent 184759d commit bdcf77a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
2 changes: 2 additions & 0 deletions chrome/browser/resources/new_new_tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,10 @@ function layoutForeignSessions() {

if (parentSessEl.hasChildNodes()) {
sessionElement.classList.remove('disabled');
sessionElement.classList.remove('opaque');
} else {
sessionElement.classList.add('disabled');
sessionElement.classList.add('opaque');
}
}

Expand Down
14 changes: 8 additions & 6 deletions chrome/browser/sync/glue/session_model_associator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -227,15 +227,20 @@ void SessionModelAssociator::ReassociateTab(const TabContents& tab) {
void SessionModelAssociator::Associate(const TabContents* tab, int64 sync_id) {
DCHECK(CalledOnValidThread());
SessionID::id_type session_id = tab->controller().session_id().id();
Browser* browser = BrowserList::FindBrowserWithID(
tab->controller().window_id().id());
if (!browser) // Can happen for weird things like developer console.
return;

TabLinks t(sync_id, tab);
tab_map_[session_id] = t;

sync_api::WriteTransaction trans(sync_service_->GetUserShare());
WriteTabContentsToSyncModel(*tab, sync_id, &trans);
WriteTabContentsToSyncModel(*browser, *tab, sync_id, &trans);
}

bool SessionModelAssociator::WriteTabContentsToSyncModel(
const Browser& browser,
const TabContents& tab,
int64 sync_id,
sync_api::WriteTransaction* trans) {
Expand All @@ -259,12 +264,9 @@ bool SessionModelAssociator::WriteTabContentsToSyncModel(
const int max_index = std::min(current_index + max_sync_navigation_count,
tab.controller().entry_count());
const int pending_index = tab.controller().pending_entry_index();
Browser* browser = BrowserList::FindBrowserWithID(
tab.controller().window_id().id());
DCHECK(browser);
int index_in_window = browser->tabstrip_model()->GetWrapperIndex(&tab);
int index_in_window = browser.tabstrip_model()->GetWrapperIndex(&tab);
DCHECK(index_in_window != TabStripModel::kNoTab);
tab_s->set_pinned(browser->tabstrip_model()->IsTabPinned(index_in_window));
tab_s->set_pinned(browser.tabstrip_model()->IsTabPinned(index_in_window));
if (tab.extension_app())
tab_s->set_extension_app_id(tab.extension_app()->id());
for (int i = min_index; i < max_index; ++i) {
Expand Down
3 changes: 2 additions & 1 deletion chrome/browser/sync/glue/session_model_associator.h
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,8 @@ class SessionModelAssociator

// Fills a tab sync node with data from a TabContents object.
// (from a local navigation event)
bool WriteTabContentsToSyncModel(const TabContents& tab,
bool WriteTabContentsToSyncModel(const Browser& browser,
const TabContents& tab,
const int64 sync_id,
sync_api::WriteTransaction* trans);

Expand Down

0 comments on commit bdcf77a

Please sign in to comment.