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