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. | |
113 enum WindowType { | |
114 TYPE_TABBED = 0, | |
115 TYPE_POPUP = 1 | |
116 }; | |
117 | |
112 // Convert this object into its sync protocol buffer equivalent. Note that | 118 // 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 | 119 // not all fields are synced here, because they don't all make sense or |
114 // translate when restoring a SessionWindow on another device. | 120 // translate when restoring a SessionWindow on another device. |
115 sync_pb::SessionWindow ToSyncData() const; | 121 sync_pb::SessionWindow ToSyncData() const; |
116 | 122 |
117 // Identifier of the window. | 123 // Identifier of the window. |
118 SessionID window_id; | 124 SessionID window_id; |
119 | 125 |
120 // Bounds of the window. | 126 // Bounds of the window. |
121 gfx::Rect bounds; | 127 gfx::Rect bounds; |
122 | 128 |
123 // Index of the selected tab in tabs; -1 if no tab is selected. After restore | 129 // 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. | 130 // this value is guaranteed to be a valid index into tabs. |
125 // | 131 // |
126 // NOTE: when the service is creating SessionWindows, initially this | 132 // NOTE: when the service is creating SessionWindows, initially this |
127 // corresponds to SessionTab.tab_visual_index, not the index in | 133 // corresponds to SessionTab.tab_visual_index, not the index in |
128 // tabs. When done creating though, this is set to the index in | 134 // tabs. When done creating though, this is set to the index in |
129 // tabs. | 135 // tabs. |
130 int selected_tab_index; | 136 int selected_tab_index; |
131 | 137 |
132 // Type of the browser. Currently we only store browsers of type | 138 // Type of the window. Note: This type is used to determine if the window gets |
133 // TYPE_TABBED and TYPE_POPUP. | 139 // saved or not. |
134 // This would be Browser::Type, but that would cause a circular dependency. | 140 // This would be SessionCommands::WindowType, but as long as this does not |
Mr4D (OOO till 08-26)
2014/10/23 20:09:11
Converted this into WindowType - decoupling from B
| |
135 int type; | 141 // reside in a component, we keep it untyped. |
142 WindowType type; | |
136 | 143 |
137 // If true, the window is constrained. | 144 // If true, the window is constrained. |
138 // | 145 // |
139 // Currently SessionService prunes all constrained windows so that session | 146 // Currently SessionService prunes all constrained windows so that session |
140 // restore does not attempt to restore them. | 147 // restore does not attempt to restore them. |
141 bool is_constrained; | 148 bool is_constrained; |
142 | 149 |
143 // Timestamp for when this window was last modified. | 150 // Timestamp for when this window was last modified. |
144 base::Time timestamp; | 151 base::Time timestamp; |
145 | 152 |
146 // The tabs, ordered by visual order. | 153 // The tabs, ordered by visual order. |
147 std::vector<SessionTab*> tabs; | 154 std::vector<SessionTab*> tabs; |
148 | 155 |
149 // Is the window maximized, minimized, or normal? | 156 // Is the window maximized, minimized, or normal? |
150 ui::WindowShowState show_state; | 157 ui::WindowShowState show_state; |
151 | 158 |
152 std::string app_name; | 159 std::string app_name; |
153 | 160 |
154 private: | 161 private: |
155 DISALLOW_COPY_AND_ASSIGN(SessionWindow); | 162 DISALLOW_COPY_AND_ASSIGN(SessionWindow); |
156 }; | 163 }; |
157 | 164 |
158 #endif // CHROME_BROWSER_SESSIONS_SESSION_TYPES_H_ | 165 #endif // CHROME_BROWSER_SESSIONS_SESSION_TYPES_H_ |
OLD | NEW |