| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/stl_util-inl.h" | 12 #include "base/stl_util-inl.h" |
| 13 #include "base/string16.h" | 13 #include "base/string16.h" |
| 14 #include "base/time.h" |
| 14 #include "chrome/browser/sessions/session_id.h" | 15 #include "chrome/browser/sessions/session_id.h" |
| 15 #include "chrome/common/page_transition_types.h" | 16 #include "chrome/common/page_transition_types.h" |
| 16 #include "gfx/rect.h" | 17 #include "gfx/rect.h" |
| 17 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
| 18 | 19 |
| 19 class NavigationEntry; | 20 class NavigationEntry; |
| 20 class Profile; | 21 class Profile; |
| 21 | 22 |
| 22 // TabNavigation ------------------------------------------------------------- | 23 // TabNavigation ------------------------------------------------------------- |
| 23 | 24 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 // restore, others can likely ignore this and use the order of the | 115 // restore, others can likely ignore this and use the order of the |
| 115 // tabs in SessionWindow.tabs. | 116 // tabs in SessionWindow.tabs. |
| 116 int tab_visual_index; | 117 int tab_visual_index; |
| 117 | 118 |
| 118 // Identifies the index of the current navigation in navigations. For | 119 // Identifies the index of the current navigation in navigations. For |
| 119 // example, if this is 2 it means the current navigation is navigations[2]. | 120 // example, if this is 2 it means the current navigation is navigations[2]. |
| 120 // | 121 // |
| 121 // NOTE: when the service is creating SessionTabs, initially this | 122 // NOTE: when the service is creating SessionTabs, initially this |
| 122 // corresponds to TabNavigation.index, not the index in navigations. When done | 123 // corresponds to TabNavigation.index, not the index in navigations. When done |
| 123 // creating though, this is set to the index in navigations. | 124 // creating though, this is set to the index in navigations. |
| 125 // |
| 126 // NOTE 2: this value can be larger than the size of |navigations|, due to |
| 127 // only valid url's being stored (ie chrome://newtab is not stored). Bounds |
| 128 // checking must be performed before indexing into |navigations|. |
| 124 int current_navigation_index; | 129 int current_navigation_index; |
| 125 | 130 |
| 126 // True if the tab is pinned. | 131 // True if the tab is pinned. |
| 127 bool pinned; | 132 bool pinned; |
| 128 | 133 |
| 129 // If non-empty, this tab is an app tab and this is the id of the extension. | 134 // If non-empty, this tab is an app tab and this is the id of the extension. |
| 130 std::string extension_app_id; | 135 std::string extension_app_id; |
| 131 | 136 |
| 137 // Timestamp for when this tab was last modified. |
| 138 base::Time timestamp; |
| 139 |
| 132 std::vector<TabNavigation> navigations; | 140 std::vector<TabNavigation> navigations; |
| 133 | 141 |
| 134 private: | 142 private: |
| 135 DISALLOW_COPY_AND_ASSIGN(SessionTab); | 143 DISALLOW_COPY_AND_ASSIGN(SessionTab); |
| 136 }; | 144 }; |
| 137 | 145 |
| 138 // SessionWindow ------------------------------------------------------------- | 146 // SessionWindow ------------------------------------------------------------- |
| 139 | 147 |
| 140 // Describes a saved window. | 148 // Describes a saved window. |
| 141 struct SessionWindow { | 149 struct SessionWindow { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 161 // TYPE_NORMAL and TYPE_POPUP. | 169 // TYPE_NORMAL and TYPE_POPUP. |
| 162 // This would be Browser::Type, but that would cause a circular dependency. | 170 // This would be Browser::Type, but that would cause a circular dependency. |
| 163 int type; | 171 int type; |
| 164 | 172 |
| 165 // If true, the window is constrained. | 173 // If true, the window is constrained. |
| 166 // | 174 // |
| 167 // Currently SessionService prunes all constrained windows so that session | 175 // Currently SessionService prunes all constrained windows so that session |
| 168 // restore does not attempt to restore them. | 176 // restore does not attempt to restore them. |
| 169 bool is_constrained; | 177 bool is_constrained; |
| 170 | 178 |
| 179 // Timestamp for when this window was last modified. |
| 180 base::Time timestamp; |
| 181 |
| 171 // The tabs, ordered by visual order. | 182 // The tabs, ordered by visual order. |
| 172 std::vector<SessionTab*> tabs; | 183 std::vector<SessionTab*> tabs; |
| 173 | 184 |
| 174 // Is the window maximized? | 185 // Is the window maximized? |
| 175 bool is_maximized; | 186 bool is_maximized; |
| 176 | 187 |
| 177 private: | 188 private: |
| 178 DISALLOW_COPY_AND_ASSIGN(SessionWindow); | 189 DISALLOW_COPY_AND_ASSIGN(SessionWindow); |
| 179 }; | 190 }; |
| 180 | 191 |
| 181 // Defines a foreign session for session sync. A foreign session is a session | 192 // Defines a foreign session for session sync. A foreign session is a session |
| 182 // on a remote chrome instance. | 193 // on a remote chrome instance. |
| 183 struct ForeignSession { | 194 struct ForeignSession { |
| 184 ForeignSession(); | 195 ForeignSession(); |
| 185 ~ForeignSession(); | 196 ~ForeignSession(); |
| 186 | 197 |
| 187 // Unique tag for each session. | 198 // Unique tag for each session. |
| 188 std::string foreign_session_tag; | 199 std::string foreign_session_tag; |
| 189 std::vector<SessionWindow*> windows; | 200 std::vector<SessionWindow*> windows; |
| 190 }; | 201 }; |
| 191 | 202 |
| 192 #endif // CHROME_BROWSER_SESSIONS_SESSION_TYPES_H_ | 203 #endif // CHROME_BROWSER_SESSIONS_SESSION_TYPES_H_ |
| OLD | NEW |