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

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: Rebase 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 : 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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698