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_SESSIONS_SESSION_TYPES_H_ | 5 #ifndef CHROME_BROWSER_SESSIONS_SESSION_TYPES_H_ |
6 #define CHROME_BROWSER_SESSIONS_SESSION_TYPES_H_ | 6 #define CHROME_BROWSER_SESSIONS_SESSION_TYPES_H_ |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 DISALLOW_COPY_AND_ASSIGN(SessionTab); | 102 DISALLOW_COPY_AND_ASSIGN(SessionTab); |
103 }; | 103 }; |
104 | 104 |
105 // SessionWindow ------------------------------------------------------------- | 105 // SessionWindow ------------------------------------------------------------- |
106 | 106 |
107 // Describes a saved window. | 107 // Describes a saved window. |
108 struct SessionWindow { | 108 struct SessionWindow { |
109 SessionWindow(); | 109 SessionWindow(); |
110 ~SessionWindow(); | 110 ~SessionWindow(); |
111 | 111 |
| 112 // Possible window types which can be stored here. Note that these values will |
| 113 // be written out to disc via session commands. |
| 114 enum WindowType { |
| 115 TYPE_TABBED = 0, |
| 116 TYPE_POPUP = 1 |
| 117 }; |
| 118 |
112 // Convert this object into its sync protocol buffer equivalent. Note that | 119 // Convert this object into its sync protocol buffer equivalent. Note that |
113 // not all fields are synced here, because they don't all make sense or | 120 // not all fields are synced here, because they don't all make sense or |
114 // translate when restoring a SessionWindow on another device. | 121 // translate when restoring a SessionWindow on another device. |
115 sync_pb::SessionWindow ToSyncData() const; | 122 sync_pb::SessionWindow ToSyncData() const; |
116 | 123 |
117 // Identifier of the window. | 124 // Identifier of the window. |
118 SessionID window_id; | 125 SessionID window_id; |
119 | 126 |
120 // Bounds of the window. | 127 // Bounds of the window. |
121 gfx::Rect bounds; | 128 gfx::Rect bounds; |
122 | 129 |
123 // Index of the selected tab in tabs; -1 if no tab is selected. After restore | 130 // Index of the selected tab in tabs; -1 if no tab is selected. After restore |
124 // this value is guaranteed to be a valid index into tabs. | 131 // this value is guaranteed to be a valid index into tabs. |
125 // | 132 // |
126 // NOTE: when the service is creating SessionWindows, initially this | 133 // NOTE: when the service is creating SessionWindows, initially this |
127 // corresponds to SessionTab.tab_visual_index, not the index in | 134 // corresponds to SessionTab.tab_visual_index, not the index in |
128 // tabs. When done creating though, this is set to the index in | 135 // tabs. When done creating though, this is set to the index in |
129 // tabs. | 136 // tabs. |
130 int selected_tab_index; | 137 int selected_tab_index; |
131 | 138 |
132 // Type of the browser. Currently we only store browsers of type | 139 // Type of the window. Note: This type is used to determine if the window gets |
133 // TYPE_TABBED and TYPE_POPUP. | 140 // saved or not. |
134 // This would be Browser::Type, but that would cause a circular dependency. | 141 WindowType type; |
135 int type; | |
136 | 142 |
137 // If true, the window is constrained. | 143 // If true, the window is constrained. |
138 // | 144 // |
139 // Currently SessionService prunes all constrained windows so that session | 145 // Currently SessionService prunes all constrained windows so that session |
140 // restore does not attempt to restore them. | 146 // restore does not attempt to restore them. |
141 bool is_constrained; | 147 bool is_constrained; |
142 | 148 |
143 // Timestamp for when this window was last modified. | 149 // Timestamp for when this window was last modified. |
144 base::Time timestamp; | 150 base::Time timestamp; |
145 | 151 |
146 // The tabs, ordered by visual order. | 152 // The tabs, ordered by visual order. |
147 std::vector<SessionTab*> tabs; | 153 std::vector<SessionTab*> tabs; |
148 | 154 |
149 // Is the window maximized, minimized, or normal? | 155 // Is the window maximized, minimized, or normal? |
150 ui::WindowShowState show_state; | 156 ui::WindowShowState show_state; |
151 | 157 |
152 std::string app_name; | 158 std::string app_name; |
153 | 159 |
154 private: | 160 private: |
155 DISALLOW_COPY_AND_ASSIGN(SessionWindow); | 161 DISALLOW_COPY_AND_ASSIGN(SessionWindow); |
156 }; | 162 }; |
157 | 163 |
158 #endif // CHROME_BROWSER_SESSIONS_SESSION_TYPES_H_ | 164 #endif // CHROME_BROWSER_SESSIONS_SESSION_TYPES_H_ |
OLD | NEW |