OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "components/sessions/core/tab_restore_service_helper.h" | 5 #include "components/sessions/core/tab_restore_service_helper.h" |
6 | 6 |
7 #include <inttypes.h> | 7 #include <inttypes.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 context = client_->CreateLiveTabContext(window.app_name); | 202 context = client_->CreateLiveTabContext(window.app_name); |
203 for (size_t tab_i = 0; tab_i < window.tabs.size(); ++tab_i) { | 203 for (size_t tab_i = 0; tab_i < window.tabs.size(); ++tab_i) { |
204 const Tab& tab = *window.tabs[tab_i]; | 204 const Tab& tab = *window.tabs[tab_i]; |
205 LiveTab* restored_tab = context->AddRestoredTab( | 205 LiveTab* restored_tab = context->AddRestoredTab( |
206 tab.navigations, context->GetTabCount(), | 206 tab.navigations, context->GetTabCount(), |
207 tab.current_navigation_index, tab.extension_app_id, | 207 tab.current_navigation_index, tab.extension_app_id, |
208 static_cast<int>(tab_i) == window.selected_tab_index, tab.pinned, | 208 static_cast<int>(tab_i) == window.selected_tab_index, tab.pinned, |
209 tab.from_last_session, tab.platform_data.get(), | 209 tab.from_last_session, tab.platform_data.get(), |
210 tab.user_agent_override); | 210 tab.user_agent_override); |
211 if (restored_tab) { | 211 if (restored_tab) { |
212 restored_tab->LoadIfNecessary(); | |
213 client_->OnTabRestored( | 212 client_->OnTabRestored( |
214 tab.navigations.at(tab.current_navigation_index).virtual_url()); | 213 tab.navigations.at(tab.current_navigation_index).virtual_url()); |
215 live_tabs.push_back(restored_tab); | 214 live_tabs.push_back(restored_tab); |
216 } | 215 } |
217 } | 216 } |
218 // All the window's tabs had the same former browser_id. | 217 // All the window's tabs had the same former browser_id. |
219 if (auto browser_id = window.tabs[0]->browser_id) { | 218 if (auto browser_id = window.tabs[0]->browser_id) { |
220 UpdateTabBrowserIDs(browser_id, context->GetSessionID().id()); | 219 UpdateTabBrowserIDs(browser_id, context->GetSessionID().id()); |
221 } | 220 } |
222 } else { | 221 } else { |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 disposition != WindowOpenDisposition::UNKNOWN) { | 469 disposition != WindowOpenDisposition::UNKNOWN) { |
471 tab_index = context->GetTabCount(); | 470 tab_index = context->GetTabCount(); |
472 } | 471 } |
473 | 472 |
474 restored_tab = context->AddRestoredTab( | 473 restored_tab = context->AddRestoredTab( |
475 tab.navigations, tab_index, tab.current_navigation_index, | 474 tab.navigations, tab_index, tab.current_navigation_index, |
476 tab.extension_app_id, | 475 tab.extension_app_id, |
477 disposition != WindowOpenDisposition::NEW_BACKGROUND_TAB, tab.pinned, | 476 disposition != WindowOpenDisposition::NEW_BACKGROUND_TAB, tab.pinned, |
478 tab.from_last_session, tab.platform_data.get(), | 477 tab.from_last_session, tab.platform_data.get(), |
479 tab.user_agent_override); | 478 tab.user_agent_override); |
480 restored_tab->LoadIfNecessary(); | |
481 } | 479 } |
482 client_->OnTabRestored( | 480 client_->OnTabRestored( |
483 tab.navigations.at(tab.current_navigation_index).virtual_url()); | 481 tab.navigations.at(tab.current_navigation_index).virtual_url()); |
484 if (live_tab) | 482 if (live_tab) |
485 *live_tab = restored_tab; | 483 *live_tab = restored_tab; |
486 | 484 |
487 return context; | 485 return context; |
488 } | 486 } |
489 | 487 |
490 bool TabRestoreServiceHelper::ValidateTab(const Tab& tab) { | 488 bool TabRestoreServiceHelper::ValidateTab(const Tab& tab) { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 tab.browser_id = new_id; | 549 tab.browser_id = new_id; |
552 } | 550 } |
553 } | 551 } |
554 } | 552 } |
555 | 553 |
556 base::Time TabRestoreServiceHelper::TimeNow() const { | 554 base::Time TabRestoreServiceHelper::TimeNow() const { |
557 return time_factory_ ? time_factory_->TimeNow() : base::Time::Now(); | 555 return time_factory_ ? time_factory_->TimeNow() : base::Time::Now(); |
558 } | 556 } |
559 | 557 |
560 } // namespace sessions | 558 } // namespace sessions |
OLD | NEW |