| 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 WindowType type; |
| 135 int type; | |
| 136 | 141 |
| 137 // If true, the window is constrained. | 142 // If true, the window is constrained. |
| 138 // | 143 // |
| 139 // Currently SessionService prunes all constrained windows so that session | 144 // Currently SessionService prunes all constrained windows so that session |
| 140 // restore does not attempt to restore them. | 145 // restore does not attempt to restore them. |
| 141 bool is_constrained; | 146 bool is_constrained; |
| 142 | 147 |
| 143 // Timestamp for when this window was last modified. | 148 // Timestamp for when this window was last modified. |
| 144 base::Time timestamp; | 149 base::Time timestamp; |
| 145 | 150 |
| 146 // The tabs, ordered by visual order. | 151 // The tabs, ordered by visual order. |
| 147 std::vector<SessionTab*> tabs; | 152 std::vector<SessionTab*> tabs; |
| 148 | 153 |
| 149 // Is the window maximized, minimized, or normal? | 154 // Is the window maximized, minimized, or normal? |
| 150 ui::WindowShowState show_state; | 155 ui::WindowShowState show_state; |
| 151 | 156 |
| 152 std::string app_name; | 157 std::string app_name; |
| 153 | 158 |
| 154 private: | 159 private: |
| 155 DISALLOW_COPY_AND_ASSIGN(SessionWindow); | 160 DISALLOW_COPY_AND_ASSIGN(SessionWindow); |
| 156 }; | 161 }; |
| 157 | 162 |
| 158 #endif // CHROME_BROWSER_SESSIONS_SESSION_TYPES_H_ | 163 #endif // CHROME_BROWSER_SESSIONS_SESSION_TYPES_H_ |
| OLD | NEW |