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