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 string. This is used |
| 97 // in the NTP handler for foreign sessions for matching session |
| 98 // types to an icon style. |
| 99 std::string DeviceTypeAsString() const { |
| 100 switch (device_type) { |
| 101 case SyncedSession::TYPE_WIN: |
| 102 return "win"; |
| 103 case SyncedSession::TYPE_MACOSX: |
| 104 return "macosx"; |
| 105 case SyncedSession::TYPE_LINUX: |
| 106 return "linux"; |
| 107 case SyncedSession::TYPE_CHROMEOS: |
| 108 return "chromeos"; |
| 109 case SyncedSession::TYPE_OTHER: |
| 110 return "other"; |
| 111 case SyncedSession::TYPE_PHONE: |
| 112 return "phone"; |
| 113 case SyncedSession::TYPE_TABLET: |
| 114 return "tablet"; |
| 115 default: |
| 116 return ""; |
| 117 } |
| 118 } |
| 119 |
96 private: | 120 private: |
97 DISALLOW_COPY_AND_ASSIGN(SyncedSession); | 121 DISALLOW_COPY_AND_ASSIGN(SyncedSession); |
98 }; | 122 }; |
99 | 123 |
100 // Control which foreign tabs we're interested in syncing/displaying. Checks | 124 // Control which foreign tabs we're interested in syncing/displaying. Checks |
101 // that the tab has navigations and contains at least one valid url. | 125 // that the tab has navigations and contains at least one valid url. |
102 // Note: chrome:// and file:// are not considered valid urls (for syncing). | 126 // Note: chrome:// and file:// are not considered valid urls (for syncing). |
103 bool ShouldSyncSessionTab(const SessionTab& tab); | 127 bool ShouldSyncSessionTab(const SessionTab& tab); |
104 | 128 |
105 // Checks whether the window has tabs to sync. If no tabs to sync, it returns | 129 // Checks whether the window has tabs to sync. If no tabs to sync, it returns |
106 // true, false otherwise. | 130 // true, false otherwise. |
107 bool SessionWindowHasNoTabsToSync(const SessionWindow& window); | 131 bool SessionWindowHasNoTabsToSync(const SessionWindow& window); |
108 | 132 |
109 } // namespace browser_sync | 133 } // namespace browser_sync |
110 | 134 |
111 #endif // CHROME_BROWSER_SYNC_GLUE_SYNCED_SESSION_H_ | 135 #endif // CHROME_BROWSER_SYNC_GLUE_SYNCED_SESSION_H_ |
OLD | NEW |