| 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 #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 virtual ~SyncedSessionTab(); |
| 57 |
| 58 std::vector<SyncedTabNavigation> synced_tab_navigations; |
| 59 }; |
| 60 |
| 20 // Defines a synced session for use by session sync. A synced session is a | 61 // 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 | 62 // list of windows along with a unique session identifer (tag) and meta-data |
| 22 // about the device being synced. | 63 // about the device being synced. |
| 23 struct SyncedSession { | 64 struct SyncedSession { |
| 24 typedef std::map<SessionID::id_type, SessionWindow*> SyncedWindowMap; | 65 typedef std::map<SessionID::id_type, SessionWindow*> SyncedWindowMap; |
| 25 | 66 |
| 26 // The type of device. | 67 // The type of device. |
| 27 enum DeviceType { | 68 enum DeviceType { |
| 28 TYPE_UNSET = 0, | 69 TYPE_UNSET = 0, |
| 29 TYPE_WIN = 1, | 70 TYPE_WIN = 1, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 // Note: chrome:// and file:// are not considered valid urls (for syncing). | 103 // Note: chrome:// and file:// are not considered valid urls (for syncing). |
| 63 bool ShouldSyncSessionTab(const SessionTab& tab); | 104 bool ShouldSyncSessionTab(const SessionTab& tab); |
| 64 | 105 |
| 65 // Checks whether the window has tabs to sync. If no tabs to sync, it returns | 106 // Checks whether the window has tabs to sync. If no tabs to sync, it returns |
| 66 // true, false otherwise. | 107 // true, false otherwise. |
| 67 bool SessionWindowHasNoTabsToSync(const SessionWindow& window); | 108 bool SessionWindowHasNoTabsToSync(const SessionWindow& window); |
| 68 | 109 |
| 69 } // namespace browser_sync | 110 } // namespace browser_sync |
| 70 | 111 |
| 71 #endif // CHROME_BROWSER_SYNC_GLUE_SYNCED_SESSION_H_ | 112 #endif // CHROME_BROWSER_SYNC_GLUE_SYNCED_SESSION_H_ |
| OLD | NEW |