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(); |
502 | 503 |
503 TabTasks* tab_tasks = | 504 TabTasks* tab_tasks = |
504 task_tracker_->GetTabTasks(tab_delegate->GetSessionId()); | 505 source_tab_id == kInvalidTabID |
| 506 ? task_tracker_->GetTabTasks(tab_delegate->GetSessionId()) |
| 507 : task_tracker_->GetTabTasks(tab_delegate->GetSessionId(), |
| 508 source_tab_id); |
505 tab_tasks->UpdateWithNavigation( | 509 tab_tasks->UpdateWithNavigation( |
506 current_navigation_index, | 510 current_navigation_index, |
507 tab_delegate->GetTransitionAtIndex(current_navigation_index), | 511 tab_delegate->GetTransitionAtIndex(current_navigation_index), |
508 current_navigation_global_id); | 512 current_navigation_global_id); |
509 | 513 |
510 for (int i = 0; i < tab_specifics->navigation_size(); i++) { | 514 for (int i = 0; i < tab_specifics->navigation_size(); i++) { |
511 // Excluding blocked navigations, which are appended at tail. | 515 // Excluding blocked navigations, which are appended at tail. |
512 if (tab_specifics->navigation(i).blocked_state() == | 516 if (tab_specifics->navigation(i).blocked_state() == |
513 sync_pb::TabNavigation::STATE_BLOCKED) { | 517 sync_pb::TabNavigation::STATE_BLOCKED) { |
514 break; | 518 break; |
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1290 } | 1294 } |
1291 | 1295 |
1292 // static | 1296 // static |
1293 std::string SessionsSyncManager::TagHashFromSpecifics( | 1297 std::string SessionsSyncManager::TagHashFromSpecifics( |
1294 const sync_pb::SessionSpecifics& specifics) { | 1298 const sync_pb::SessionSpecifics& specifics) { |
1295 return syncer::GenerateSyncableHash(syncer::SESSIONS, | 1299 return syncer::GenerateSyncableHash(syncer::SESSIONS, |
1296 TagFromSpecifics(specifics)); | 1300 TagFromSpecifics(specifics)); |
1297 } | 1301 } |
1298 | 1302 |
1299 }; // namespace sync_sessions | 1303 }; // namespace sync_sessions |
OLD | NEW |