OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/extensions/api/sessions/sessions_api.h" | 5 #include "chrome/browser/extensions/api/sessions/sessions_api.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
221 results_ = GetRecentlyClosed::Results::Create(result); | 221 results_ = GetRecentlyClosed::Results::Create(result); |
222 return true; | 222 return true; |
223 } | 223 } |
224 | 224 |
225 scoped_ptr<tabs::Tab> SessionsGetDevicesFunction::CreateTabModel( | 225 scoped_ptr<tabs::Tab> SessionsGetDevicesFunction::CreateTabModel( |
226 const std::string& session_tag, | 226 const std::string& session_tag, |
227 const SessionTab& tab, | 227 const SessionTab& tab, |
228 int tab_index, | 228 int tab_index, |
229 int selected_index) { | 229 int selected_index) { |
230 std::string session_id = SessionId(session_tag, tab.tab_id.id()).ToString(); | 230 std::string session_id = SessionId(session_tag, tab.tab_id.id()).ToString(); |
231 int index_corrected = std::min(tab.current_navigation_index, | |
232 static_cast<int>(tab.navigations.size() - 1)); | |
231 return CreateTabModelHelper(GetProfile(), | 233 return CreateTabModelHelper(GetProfile(), |
232 tab.navigations[tab.current_navigation_index], | 234 tab.navigations[index_corrected], |
not at google - send to devlin
2014/03/07 21:21:45
it looks like you can use tab.normalized_navigatio
| |
233 session_id, | 235 session_id, |
234 tab_index, | 236 tab_index, |
235 tab.pinned, | 237 tab.pinned, |
236 selected_index, | 238 selected_index, |
237 GetExtension()); | 239 GetExtension()); |
238 } | 240 } |
239 | 241 |
240 scoped_ptr<windows::Window> SessionsGetDevicesFunction::CreateWindowModel( | 242 scoped_ptr<windows::Window> SessionsGetDevicesFunction::CreateWindowModel( |
241 const SessionWindow& window, const std::string& session_tag) { | 243 const SessionWindow& window, const std::string& session_tag) { |
242 DCHECK(!window.tabs.empty()); | 244 DCHECK(!window.tabs.empty()); |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
570 SetInvalidIdError(*params->session_id); | 572 SetInvalidIdError(*params->session_id); |
571 return false; | 573 return false; |
572 } | 574 } |
573 | 575 |
574 return session_id->IsForeign() ? | 576 return session_id->IsForeign() ? |
575 RestoreForeignSession(*session_id, browser) | 577 RestoreForeignSession(*session_id, browser) |
576 : RestoreLocalSession(*session_id, browser); | 578 : RestoreLocalSession(*session_id, browser); |
577 } | 579 } |
578 | 580 |
579 } // namespace extensions | 581 } // namespace extensions |
OLD | NEW |