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

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

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 #ifndef CHROME_BROWSER_SYNC_GLUE_SYNCED_SESSION_H_ 5 #ifndef CHROME_BROWSER_SYNC_GLUE_SYNCED_SESSION_H_
6 #define CHROME_BROWSER_SYNC_GLUE_SYNCED_SESSION_H_ 6 #define CHROME_BROWSER_SYNC_GLUE_SYNCED_SESSION_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
11 11
12 #include "base/time.h" 12 #include "base/time.h"
13 #include "chrome/browser/sessions/session_id.h" 13 #include "chrome/browser/sessions/session_id.h"
14 #include "chrome/browser/sessions/session_types.h"
14 15
15 struct SessionTab; 16 namespace content {
16 struct SessionWindow; 17 class NavigationEntry;
18 }
17 19
18 namespace browser_sync { 20 namespace browser_sync {
19 21
22 // Sync-specific wrapper around a normal TabNavigation.
23 // Copy semantics supported.
24 class SyncedTabNavigation : public TabNavigation {
25 public:
26 SyncedTabNavigation();
27 SyncedTabNavigation(const SyncedTabNavigation& tab);
28 SyncedTabNavigation(int index,
29 const GURL& virtual_url,
30 const content::Referrer& referrer,
31 const string16& title,
32 const std::string& state,
33 content::PageTransition transition,
34 int unique_id,
35 const base::Time& timestamp);
36 virtual ~SyncedTabNavigation();
37
38 // Unique id for this navigation.
39 void set_unique_id(int unique_id);
40 int unique_id() const;
41
42 // Timestamp this navigation occurred.
43 void set_timestamp(const base::Time& timestamp);
44 base::Time timestamp() const;
45
46 private:
47 int unique_id_;
48 base::Time timestamp_;
49 };
50
51 // Sync-specific wrapper around a normal SessionTab to support using
52 // SyncedTabNavigation.
53 struct SyncedSessionTab : public SessionTab {
54 public:
55 SyncedSessionTab();
56 ~SyncedSessionTab();
57
58
59 std::vector<SyncedTabNavigation> synced_tab_navigations;
60 };
61
20 // Defines a synced session for use by session sync. A synced session is a 62 // Defines a synced session for use by session sync. A synced session is a
21 // list of windows along with a unique session identifer (tag) and meta-data 63 // list of windows along with a unique session identifer (tag) and meta-data
22 // about the device being synced. 64 // about the device being synced.
23 struct SyncedSession { 65 struct SyncedSession {
24 typedef std::map<SessionID::id_type, SessionWindow*> SyncedWindowMap; 66 typedef std::map<SessionID::id_type, SessionWindow*> SyncedWindowMap;
25 67
26 // The type of device. 68 // The type of device.
27 enum DeviceType { 69 enum DeviceType {
28 TYPE_UNSET = 0, 70 TYPE_UNSET = 0,
29 TYPE_WIN = 1, 71 TYPE_WIN = 1,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 // Note: chrome:// and file:// are not considered valid urls (for syncing). 104 // Note: chrome:// and file:// are not considered valid urls (for syncing).
63 bool ShouldSyncSessionTab(const SessionTab& tab); 105 bool ShouldSyncSessionTab(const SessionTab& tab);
64 106
65 // Checks whether the window has tabs to sync. If no tabs to sync, it returns 107 // Checks whether the window has tabs to sync. If no tabs to sync, it returns
66 // true, false otherwise. 108 // true, false otherwise.
67 bool SessionWindowHasNoTabsToSync(const SessionWindow& window); 109 bool SessionWindowHasNoTabsToSync(const SessionWindow& window);
68 110
69 } // namespace browser_sync 111 } // namespace browser_sync
70 112
71 #endif // CHROME_BROWSER_SYNC_GLUE_SYNCED_SESSION_H_ 113 #endif // CHROME_BROWSER_SYNC_GLUE_SYNCED_SESSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698