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 <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
123 bool is_overriding_user_agent_; | 123 bool is_overriding_user_agent_; |
124 }; | 124 }; |
125 | 125 |
126 // SessionTab ---------------------------------------------------------------- | 126 // SessionTab ---------------------------------------------------------------- |
127 | 127 |
128 // SessionTab corresponds to a NavigationController. | 128 // SessionTab corresponds to a NavigationController. |
129 struct SessionTab { | 129 struct SessionTab { |
130 SessionTab(); | 130 SessionTab(); |
131 virtual ~SessionTab(); | 131 virtual ~SessionTab(); |
132 | 132 |
133 // Since the current_navigation_index can be larger than the index for number | |
134 // of navigations in the current sessions (chrome://newtab is not stored), we | |
135 // must perform bounds checking. | |
136 // Returns a normalized bounds-checked navigation_index. | |
137 int normalized_navigation_index() const { | |
138 return std::max(0, std::min( | |
139 this->current_navigation_index, | |
sky
2012/08/06 20:42:46
remove this-> here and 140.
| |
140 static_cast<int>(this->navigations.size() - 1))); | |
141 } | |
142 | |
133 // Unique id of the window. | 143 // Unique id of the window. |
134 SessionID window_id; | 144 SessionID window_id; |
135 | 145 |
136 // Unique if of the tab. | 146 // Unique if of the tab. |
137 SessionID tab_id; | 147 SessionID tab_id; |
138 | 148 |
139 // Visual index of the tab within its window. There may be gaps in these | 149 // Visual index of the tab within its window. There may be gaps in these |
140 // values. | 150 // values. |
141 // | 151 // |
142 // NOTE: this is really only useful for the SessionService during | 152 // NOTE: this is really only useful for the SessionService during |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
220 // Is the window maximized, minimized, or normal? | 230 // Is the window maximized, minimized, or normal? |
221 ui::WindowShowState show_state; | 231 ui::WindowShowState show_state; |
222 | 232 |
223 std::string app_name; | 233 std::string app_name; |
224 | 234 |
225 private: | 235 private: |
226 DISALLOW_COPY_AND_ASSIGN(SessionWindow); | 236 DISALLOW_COPY_AND_ASSIGN(SessionWindow); |
227 }; | 237 }; |
228 | 238 |
229 #endif // CHROME_BROWSER_SESSIONS_SESSION_TYPES_H_ | 239 #endif // CHROME_BROWSER_SESSIONS_SESSION_TYPES_H_ |
OLD | NEW |