summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sync
diff options
context:
space:
mode:
authorzea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-03 23:32:37 +0000
committerzea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-03 23:32:37 +0000
commitbdcf77a58ac680951fc6bf4f02b3b46f172ab01b (patch)
tree02a02361e8cb15db8641e71b0300c86d0a59c791 /chrome/browser/sync
parent184759dac1377658e78ea4a4db208020568b0bd0 (diff)
downloadchromium_src-bdcf77a58ac680951fc6bf4f02b3b46f172ab01b.zip
chromium_src-bdcf77a58ac680951fc6bf4f02b3b46f172ab01b.tar.gz
chromium_src-bdcf77a58ac680951fc6bf4f02b3b46f172ab01b.tar.bz2
[Sync] Fix the session info on NTP to properly set opacity. Fix bug in 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
Diffstat (limited to 'chrome/browser/sync')
-rw-r--r--chrome/browser/sync/glue/session_model_associator.cc14
-rw-r--r--chrome/browser/sync/glue/session_model_associator.h3
2 files changed, 10 insertions, 7 deletions
diff --git a/chrome/browser/sync/glue/session_model_associator.cc b/chrome/browser/sync/glue/session_model_associator.cc
index 20e3dbb..55caa37 100644
--- a/chrome/browser/sync/glue/session_model_associator.cc
+++ b/chrome/browser/sync/glue/session_model_associator.cc
@@ -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) {
@@ -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) {
diff --git a/chrome/browser/sync/glue/session_model_associator.h b/chrome/browser/sync/glue/session_model_associator.h
index caa3b1e..d8b16a4 100644
--- a/chrome/browser/sync/glue/session_model_associator.h
+++ b/chrome/browser/sync/glue/session_model_associator.h
@@ -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);