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 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
86 // Type of device this session is from. | 86 // Type of device this session is from. |
87 DeviceType device_type; | 87 DeviceType device_type; |
88 | 88 |
89 // Last time this session was modified remotely. | 89 // Last time this session was modified remotely. |
90 base::Time modified_time; | 90 base::Time modified_time; |
91 | 91 |
92 // Map of windows that make up this session. Windowws are owned by the session | 92 // Map of windows that make up this session. Windowws are owned by the session |
93 // itself and free'd on destruction. | 93 // itself and free'd on destruction. |
94 SyncedWindowMap windows; | 94 SyncedWindowMap windows; |
95 | 95 |
96 // Converts the DeviceType enum value to a human readable string. This is used | |
97 // in the NTP handler for foreign sessions. | |
98 std::string DeviceTypeAsString() const { | |
99 switch (device_type) { | |
100 case SyncedSession::TYPE_WIN: | |
101 return "win"; | |
Nicolas Zea
2012/07/24 18:44:24
Not sure in what context these will be displayed,
nyquist
2012/07/24 20:18:38
They are used for matching an icon style on the NT
| |
102 case SyncedSession::TYPE_MACOSX: | |
103 return "macosx"; | |
104 case SyncedSession::TYPE_LINUX: | |
105 return "linux"; | |
106 case SyncedSession::TYPE_CHROMEOS: | |
107 return "chromeos"; | |
108 case SyncedSession::TYPE_OTHER: | |
109 return "other"; | |
110 case SyncedSession::TYPE_PHONE: | |
111 return "phone"; | |
112 case SyncedSession::TYPE_TABLET: | |
113 return "tablet"; | |
114 default: | |
115 return ""; | |
116 } | |
117 } | |
118 | |
96 private: | 119 private: |
97 DISALLOW_COPY_AND_ASSIGN(SyncedSession); | 120 DISALLOW_COPY_AND_ASSIGN(SyncedSession); |
98 }; | 121 }; |
99 | 122 |
100 // Control which foreign tabs we're interested in syncing/displaying. Checks | 123 // Control which foreign tabs we're interested in syncing/displaying. Checks |
101 // that the tab has navigations and contains at least one valid url. | 124 // that the tab has navigations and contains at least one valid url. |
102 // Note: chrome:// and file:// are not considered valid urls (for syncing). | 125 // Note: chrome:// and file:// are not considered valid urls (for syncing). |
103 bool ShouldSyncSessionTab(const SessionTab& tab); | 126 bool ShouldSyncSessionTab(const SessionTab& tab); |
104 | 127 |
105 // Checks whether the window has tabs to sync. If no tabs to sync, it returns | 128 // Checks whether the window has tabs to sync. If no tabs to sync, it returns |
106 // true, false otherwise. | 129 // true, false otherwise. |
107 bool SessionWindowHasNoTabsToSync(const SessionWindow& window); | 130 bool SessionWindowHasNoTabsToSync(const SessionWindow& window); |
108 | 131 |
109 } // namespace browser_sync | 132 } // namespace browser_sync |
110 | 133 |
111 #endif // CHROME_BROWSER_SYNC_GLUE_SYNCED_SESSION_H_ | 134 #endif // CHROME_BROWSER_SYNC_GLUE_SYNCED_SESSION_H_ |
OLD | NEW |