Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Side by Side Diff: chrome/browser/sync/glue/synced_session.cc

Issue 10125002: [Sync] Add per-navigation timestamps/unique ids to tab sync. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 : 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
13 SyncedSession::SyncedSession() : session_tag("invalid"), 56 SyncedSession::SyncedSession() : session_tag("invalid"),
14 device_type(TYPE_UNSET) { 57 device_type(TYPE_UNSET) {
15 } 58 }
16 59
17 SyncedSession::~SyncedSession() { 60 SyncedSession::~SyncedSession() {
18 STLDeleteContainerPairSecondPointers(windows.begin(), windows.end()); 61 STLDeleteContainerPairSecondPointers(windows.begin(), windows.end());
19 } 62 }
20 63
21 // Note: if you modify this, make sure you modify 64 // Note: if you modify this, make sure you modify
22 // SessionModelAssociator::ShouldSyncTab to ensure the logic matches. 65 // SessionModelAssociator::ShouldSyncTab to ensure the logic matches.
(...skipping 16 matching lines...) Expand all
39 for (std::vector<SessionTab*>::const_iterator i = window.tabs.begin(); 82 for (std::vector<SessionTab*>::const_iterator i = window.tabs.begin();
40 i != window.tabs.end(); ++i) { 83 i != window.tabs.end(); ++i) {
41 const SessionTab* tab = *i; 84 const SessionTab* tab = *i;
42 if (ShouldSyncSessionTab(*tab)) 85 if (ShouldSyncSessionTab(*tab))
43 num_populated++; 86 num_populated++;
44 } 87 }
45 return (num_populated == 0); 88 return (num_populated == 0);
46 } 89 }
47 90
48 } // namespace browser_sync 91 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/synced_session.h ('k') | chrome/browser/sync/glue/synced_session_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698