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

Side by Side Diff: chrome/browser/sessions/session_types.cc

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 unified diff | Download patch
« no previous file with comments | « chrome/browser/sessions/session_types.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "chrome/browser/sessions/session_types.h" 5 #include "chrome/browser/sessions/session_types.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "content/public/browser/navigation_controller.h" 10 #include "content/public/browser/navigation_controller.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 122
123 SessionTab::SessionTab() 123 SessionTab::SessionTab()
124 : tab_visual_index(-1), 124 : tab_visual_index(-1),
125 current_navigation_index(-1), 125 current_navigation_index(-1),
126 pinned(false) { 126 pinned(false) {
127 } 127 }
128 128
129 SessionTab::~SessionTab() { 129 SessionTab::~SessionTab() {
130 } 130 }
131 131
132 int SessionTab::NormalizedNavigationIndex() const {
133 int selected_index = this->current_navigation_index;
134 // Bounds checking. Lowest value allowed is 0, so we need to check for max if
135 // navigations.size() == 0 or if selected_index is negative.
136 selected_index = std::max(
sky 2012/08/03 17:21:39 Combine all this into a single return, eg: return
felipeg 2012/08/06 16:54:53 Done.
137 0,
138 std::min(selected_index,
139 static_cast<int>(this->navigations.size() - 1)));
140 return selected_index;
141 }
142
132 // SessionWindow --------------------------------------------------------------- 143 // SessionWindow ---------------------------------------------------------------
133 144
134 SessionWindow::SessionWindow() 145 SessionWindow::SessionWindow()
135 : selected_tab_index(-1), 146 : selected_tab_index(-1),
136 type(Browser::TYPE_TABBED), 147 type(Browser::TYPE_TABBED),
137 is_constrained(true), 148 is_constrained(true),
138 show_state(ui::SHOW_STATE_DEFAULT) { 149 show_state(ui::SHOW_STATE_DEFAULT) {
139 } 150 }
140 151
141 SessionWindow::~SessionWindow() { 152 SessionWindow::~SessionWindow() {
142 STLDeleteElements(&tabs); 153 STLDeleteElements(&tabs);
143 } 154 }
OLDNEW
« no previous file with comments | « chrome/browser/sessions/session_types.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698