Index: chrome/browser/sessions/session_types.h |
diff --git a/chrome/browser/sessions/session_types.h b/chrome/browser/sessions/session_types.h |
index b8a23bf27d1d88e78780482296292e989de37ac7..580036473c35d2d5422dd1660ba0294cdc312264 100644 |
--- a/chrome/browser/sessions/session_types.h |
+++ b/chrome/browser/sessions/session_types.h |
@@ -130,6 +130,16 @@ struct SessionTab { |
SessionTab(); |
virtual ~SessionTab(); |
+ // Since the current_navigation_index can be larger than the index for number |
+ // of navigations in the current sessions (chrome://newtab is not stored), we |
+ // must perform bounds checking. |
+ // Returns a normalized bounds-checked navigation_index. |
+ int normalized_navigation_index() const { |
+ return std::max(0, std::min( |
+ this->current_navigation_index, |
sky
2012/08/06 20:42:46
remove this-> here and 140.
|
+ static_cast<int>(this->navigations.size() - 1))); |
+ } |
+ |
// Unique id of the window. |
SessionID window_id; |