OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/sync_sessions/sessions_sync_manager.h" | 5 #include "components/sync_sessions/sessions_sync_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 SyncedTabDelegate* const tab_delegate, | 492 SyncedTabDelegate* const tab_delegate, |
493 sync_pb::SessionSpecifics* session_specifics) { | 493 sync_pb::SessionSpecifics* session_specifics) { |
494 sync_pb::SessionTab* tab_specifics = session_specifics->mutable_tab(); | 494 sync_pb::SessionTab* tab_specifics = session_specifics->mutable_tab(); |
495 // Index in the whole navigations of the tab. | 495 // Index in the whole navigations of the tab. |
496 int current_navigation_index = tab_delegate->GetCurrentEntryIndex(); | 496 int current_navigation_index = tab_delegate->GetCurrentEntryIndex(); |
497 // Index in the tab_specifics, where the navigations is a -6/+6 window | 497 // Index in the tab_specifics, where the navigations is a -6/+6 window |
498 int current_index_in_tab_specifics = | 498 int current_index_in_tab_specifics = |
499 tab_specifics->current_navigation_index(); | 499 tab_specifics->current_navigation_index(); |
500 int64_t current_navigation_global_id = | 500 int64_t current_navigation_global_id = |
501 tab_specifics->navigation(current_index_in_tab_specifics).global_id(); | 501 tab_specifics->navigation(current_index_in_tab_specifics).global_id(); |
502 SessionID::id_type source_tab_id = tab_delegate->GetSourceTabID(); | |
503 | 502 |
504 TabTasks* tab_tasks = | 503 TabTasks* tab_tasks = |
505 source_tab_id == kInvalidTabID | 504 task_tracker_->GetTabTasks(tab_delegate->GetSessionId()); |
506 ? task_tracker_->GetTabTasks(tab_delegate->GetSessionId()) | |
507 : task_tracker_->GetTabTasks(tab_delegate->GetSessionId(), | |
508 source_tab_id); | |
509 tab_tasks->UpdateWithNavigation( | 505 tab_tasks->UpdateWithNavigation( |
510 current_navigation_index, | 506 current_navigation_index, |
511 tab_delegate->GetTransitionAtIndex(current_navigation_index), | 507 tab_delegate->GetTransitionAtIndex(current_navigation_index), |
512 current_navigation_global_id); | 508 current_navigation_global_id); |
513 | 509 |
514 for (int i = 0; i < tab_specifics->navigation_size(); i++) { | 510 for (int i = 0; i < tab_specifics->navigation_size(); i++) { |
515 // Excluding blocked navigations, which are appended at tail. | 511 // Excluding blocked navigations, which are appended at tail. |
516 if (tab_specifics->navigation(i).blocked_state() == | 512 if (tab_specifics->navigation(i).blocked_state() == |
517 sync_pb::TabNavigation::STATE_BLOCKED) { | 513 sync_pb::TabNavigation::STATE_BLOCKED) { |
518 break; | 514 break; |
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1294 } | 1290 } |
1295 | 1291 |
1296 // static | 1292 // static |
1297 std::string SessionsSyncManager::TagHashFromSpecifics( | 1293 std::string SessionsSyncManager::TagHashFromSpecifics( |
1298 const sync_pb::SessionSpecifics& specifics) { | 1294 const sync_pb::SessionSpecifics& specifics) { |
1299 return syncer::GenerateSyncableHash(syncer::SESSIONS, | 1295 return syncer::GenerateSyncableHash(syncer::SESSIONS, |
1300 TagFromSpecifics(specifics)); | 1296 TagFromSpecifics(specifics)); |
1301 } | 1297 } |
1302 | 1298 |
1303 }; // namespace sync_sessions | 1299 }; // namespace sync_sessions |
OLD | NEW |