OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/sync/glue/session_change_processor.h" | 5 #include "chrome/browser/sync/glue/session_change_processor.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 for (sync_api::ChangeRecordList::const_iterator it = | 257 for (sync_api::ChangeRecordList::const_iterator it = |
258 changes.Get().begin(); it != changes.Get().end(); ++it) { | 258 changes.Get().begin(); it != changes.Get().end(); ++it) { |
259 const sync_api::ChangeRecord& change = *it; | 259 const sync_api::ChangeRecord& change = *it; |
260 sync_api::ChangeRecord::Action action(change.action); | 260 sync_api::ChangeRecord::Action action(change.action); |
261 if (sync_api::ChangeRecord::ACTION_DELETE == action) { | 261 if (sync_api::ChangeRecord::ACTION_DELETE == action) { |
262 // Deletions are all or nothing (since we only ever delete entire | 262 // Deletions are all or nothing (since we only ever delete entire |
263 // sessions). Therefore we don't care if it's a tab node or meta node, | 263 // sessions). Therefore we don't care if it's a tab node or meta node, |
264 // and just ensure we've disassociated. | 264 // and just ensure we've disassociated. |
265 DCHECK_EQ(syncable::GetModelTypeFromSpecifics(it->specifics), | 265 DCHECK_EQ(syncable::GetModelTypeFromSpecifics(it->specifics), |
266 syncable::SESSIONS); | 266 syncable::SESSIONS); |
267 const sync_pb::SessionSpecifics& specifics = | 267 const sync_pb::SessionSpecifics& specifics = it->specifics.session(); |
268 it->specifics.GetExtension(sync_pb::session); | |
269 session_model_associator_->DisassociateForeignSession( | 268 session_model_associator_->DisassociateForeignSession( |
270 specifics.session_tag()); | 269 specifics.session_tag()); |
271 continue; | 270 continue; |
272 } | 271 } |
273 | 272 |
274 // Handle an update or add. | 273 // Handle an update or add. |
275 sync_api::ReadNode sync_node(trans); | 274 sync_api::ReadNode sync_node(trans); |
276 if (!sync_node.InitByIdLookup(change.id)) { | 275 if (!sync_node.InitByIdLookup(change.id)) { |
277 error_handler()->OnSingleDatatypeUnrecoverableError(FROM_HERE, | 276 error_handler()->OnSingleDatatypeUnrecoverableError(FROM_HERE, |
278 "Session node lookup failed."); | 277 "Session node lookup failed."); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 content::NotificationService::AllBrowserContextsAndSources()); | 342 content::NotificationService::AllBrowserContextsAndSources()); |
344 } | 343 } |
345 | 344 |
346 void SessionChangeProcessor::StopObserving() { | 345 void SessionChangeProcessor::StopObserving() { |
347 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 346 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
348 DCHECK(profile_); | 347 DCHECK(profile_); |
349 notification_registrar_.RemoveAll(); | 348 notification_registrar_.RemoveAll(); |
350 } | 349 } |
351 | 350 |
352 } // namespace browser_sync | 351 } // namespace browser_sync |
OLD | NEW |