Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2836)

Unified Diff: chrome/browser/sessions/session_types.h

Issue 10832080: Upstream session_backend_android. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/sessions/session_service_factory.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « chrome/browser/sessions/session_service_factory.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698