| 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 "chrome/browser/sync/sessions/sessions_sync_manager.h" | 5 #include "chrome/browser/sync/sessions/sessions_sync_manager.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/sync/glue/synced_tab_delegate.h" | 9 #include "chrome/browser/sync/glue/synced_tab_delegate.h" |
| 10 #include "chrome/browser/sync/glue/synced_window_delegate.h" | 10 #include "chrome/browser/sync/glue/synced_window_delegate.h" |
| (...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 void SessionsSyncManager::BuildSyncedSessionFromSpecifics( | 733 void SessionsSyncManager::BuildSyncedSessionFromSpecifics( |
| 734 const std::string& session_tag, | 734 const std::string& session_tag, |
| 735 const sync_pb::SessionWindow& specifics, | 735 const sync_pb::SessionWindow& specifics, |
| 736 base::Time mtime, | 736 base::Time mtime, |
| 737 SessionWindow* session_window) { | 737 SessionWindow* session_window) { |
| 738 if (specifics.has_window_id()) | 738 if (specifics.has_window_id()) |
| 739 session_window->window_id.set_id(specifics.window_id()); | 739 session_window->window_id.set_id(specifics.window_id()); |
| 740 if (specifics.has_selected_tab_index()) | 740 if (specifics.has_selected_tab_index()) |
| 741 session_window->selected_tab_index = specifics.selected_tab_index(); | 741 session_window->selected_tab_index = specifics.selected_tab_index(); |
| 742 if (specifics.has_browser_type()) { | 742 if (specifics.has_browser_type()) { |
| 743 // TODO(skuhne): Sync data writes |BrowserType| not |
| 744 // |SessionWindow::WindowType|. This should get changed. |
| 743 if (specifics.browser_type() == | 745 if (specifics.browser_type() == |
| 744 sync_pb::SessionWindow_BrowserType_TYPE_TABBED) { | 746 sync_pb::SessionWindow_BrowserType_TYPE_TABBED) { |
| 745 session_window->type = 1; | 747 session_window->type = SessionWindow::TYPE_TABBED; |
| 746 } else { | 748 } else { |
| 747 session_window->type = 2; | 749 session_window->type = SessionWindow::TYPE_POPUP; |
| 748 } | 750 } |
| 749 } | 751 } |
| 750 session_window->timestamp = mtime; | 752 session_window->timestamp = mtime; |
| 751 session_window->tabs.resize(specifics.tab_size(), NULL); | 753 session_window->tabs.resize(specifics.tab_size(), NULL); |
| 752 for (int i = 0; i < specifics.tab_size(); i++) { | 754 for (int i = 0; i < specifics.tab_size(); i++) { |
| 753 SessionID::id_type tab_id = specifics.tab(i); | 755 SessionID::id_type tab_id = specifics.tab(i); |
| 754 session_tracker_.PutTabInWindow(session_tag, | 756 session_tracker_.PutTabInWindow(session_tag, |
| 755 session_window->window_id.id(), | 757 session_window->window_id.id(), |
| 756 tab_id, | 758 tab_id, |
| 757 i); | 759 i); |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1037 << " with age " << session_age_in_days << ", deleting."; | 1039 << " with age " << session_age_in_days << ", deleting."; |
| 1038 DeleteForeignSessionInternal(session_tag, &changes); | 1040 DeleteForeignSessionInternal(session_tag, &changes); |
| 1039 } | 1041 } |
| 1040 } | 1042 } |
| 1041 | 1043 |
| 1042 if (!changes.empty()) | 1044 if (!changes.empty()) |
| 1043 sync_processor_->ProcessSyncChanges(FROM_HERE, changes); | 1045 sync_processor_->ProcessSyncChanges(FROM_HERE, changes); |
| 1044 } | 1046 } |
| 1045 | 1047 |
| 1046 }; // namespace browser_sync | 1048 }; // namespace browser_sync |
| OLD | NEW |