| 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/synced_session.h" | 5 #include "chrome/browser/sync/glue/synced_session.h" |
| 6 | 6 |
| 7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 #include "chrome/common/url_constants.h" | 8 #include "chrome/common/url_constants.h" |
| 9 #include "content/public/browser/navigation_entry.h" | 9 #include "content/public/browser/navigation_entry.h" |
| 10 | 10 |
| 11 namespace browser_sync { | 11 namespace browser_sync { |
| 12 | 12 |
| 13 SyncedTabNavigation::SyncedTabNavigation() : unique_id_(0) { | |
| 14 } | |
| 15 | |
| 16 SyncedTabNavigation::SyncedTabNavigation(const SyncedTabNavigation& tab) | |
| 17 : TabNavigation(tab), | |
| 18 unique_id_(tab.unique_id_), | |
| 19 timestamp_(tab.timestamp_) { | |
| 20 } | |
| 21 | |
| 22 SyncedTabNavigation::SyncedTabNavigation(int index, | |
| 23 const GURL& virtual_url, | |
| 24 const content::Referrer& referrer, | |
| 25 const string16& title, | |
| 26 const std::string& state, | |
| 27 content::PageTransition transition, | |
| 28 int unique_id, | |
| 29 const base::Time& timestamp) | |
| 30 : TabNavigation(index, virtual_url, referrer, title, state, transition), | |
| 31 unique_id_(unique_id), | |
| 32 timestamp_(timestamp) { | |
| 33 } | |
| 34 | |
| 35 SyncedTabNavigation::~SyncedTabNavigation() { | |
| 36 } | |
| 37 | |
| 38 void SyncedTabNavigation::set_unique_id(int unique_id) { | |
| 39 unique_id_ = unique_id; | |
| 40 } | |
| 41 | |
| 42 int SyncedTabNavigation::unique_id() const { | |
| 43 return unique_id_; | |
| 44 } | |
| 45 | |
| 46 void SyncedTabNavigation::set_timestamp(const base::Time& timestamp) { | |
| 47 timestamp_ = timestamp; | |
| 48 } | |
| 49 base::Time SyncedTabNavigation::timestamp() const { | |
| 50 return timestamp_; | |
| 51 } | |
| 52 | |
| 53 SyncedSessionTab::SyncedSessionTab() {} | |
| 54 SyncedSessionTab::~SyncedSessionTab() {} | |
| 55 | |
| 56 SyncedSession::SyncedSession() : session_tag("invalid"), | 13 SyncedSession::SyncedSession() : session_tag("invalid"), |
| 57 device_type(TYPE_UNSET) { | 14 device_type(TYPE_UNSET) { |
| 58 } | 15 } |
| 59 | 16 |
| 60 SyncedSession::~SyncedSession() { | 17 SyncedSession::~SyncedSession() { |
| 61 STLDeleteContainerPairSecondPointers(windows.begin(), windows.end()); | 18 STLDeleteContainerPairSecondPointers(windows.begin(), windows.end()); |
| 62 } | 19 } |
| 63 | 20 |
| 64 // Note: if you modify this, make sure you modify | 21 // Note: if you modify this, make sure you modify |
| 65 // SessionModelAssociator::ShouldSyncTab to ensure the logic matches. | 22 // SessionModelAssociator::ShouldSyncTab to ensure the logic matches. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 82 for (std::vector<SessionTab*>::const_iterator i = window.tabs.begin(); | 39 for (std::vector<SessionTab*>::const_iterator i = window.tabs.begin(); |
| 83 i != window.tabs.end(); ++i) { | 40 i != window.tabs.end(); ++i) { |
| 84 const SessionTab* tab = *i; | 41 const SessionTab* tab = *i; |
| 85 if (ShouldSyncSessionTab(*tab)) | 42 if (ShouldSyncSessionTab(*tab)) |
| 86 num_populated++; | 43 num_populated++; |
| 87 } | 44 } |
| 88 return (num_populated == 0); | 45 return (num_populated == 0); |
| 89 } | 46 } |
| 90 | 47 |
| 91 } // namespace browser_sync | 48 } // namespace browser_sync |
| OLD | NEW |