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 "ios/chrome/browser/sessions/tab_restore_service_delegate_impl_ios.h" | 5 #include "ios/chrome/browser/sessions/tab_restore_service_delegate_impl_ios.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 int tab_index, | 72 int tab_index, |
73 int selected_navigation, | 73 int selected_navigation, |
74 const std::string& extension_app_id, | 74 const std::string& extension_app_id, |
75 bool select, | 75 bool select, |
76 bool pin, | 76 bool pin, |
77 bool from_last_session, | 77 bool from_last_session, |
78 const sessions::PlatformSpecificTabData* tab_platform_data, | 78 const sessions::PlatformSpecificTabData* tab_platform_data, |
79 const std::string& user_agent_override) { | 79 const std::string& user_agent_override) { |
80 DCHECK_LT(selected_navigation, static_cast<int>(navigations.size())); | 80 DCHECK_LT(selected_navigation, static_cast<int>(navigations.size())); |
81 | 81 |
82 std::unique_ptr<WebStateImpl> webState(new WebStateImpl(browser_state_)); | 82 web::WebState::CreateParams params(browser_state_); |
| 83 std::unique_ptr<WebStateImpl> webState(new WebStateImpl(params)); |
83 std::vector<std::unique_ptr<web::NavigationItem>> items = | 84 std::vector<std::unique_ptr<web::NavigationItem>> items = |
84 sessions::IOSSerializedNavigationBuilder::ToNavigationItems(navigations); | 85 sessions::IOSSerializedNavigationBuilder::ToNavigationItems(navigations); |
85 webState->GetNavigationManagerImpl().ReplaceSessionHistory( | 86 webState->GetNavigationManagerImpl().ReplaceSessionHistory( |
86 std::move(items), selected_navigation); | 87 std::move(items), selected_navigation); |
87 TabModel* tabModel = tab_model(); | 88 TabModel* tabModel = tab_model(); |
88 Tab* tab = | 89 Tab* tab = |
89 [tabModel insertTabWithWebState:std::move(webState) atIndex:tab_index]; | 90 [tabModel insertTabWithWebState:std::move(webState) atIndex:tab_index]; |
90 // TODO(crbug.com/661636): Handle tab-switch animation somehow... | 91 // TODO(crbug.com/661636): Handle tab-switch animation somehow... |
91 [tabModel setCurrentTab:tab]; | 92 [tabModel setCurrentTab:tab]; |
92 return nullptr; | 93 return nullptr; |
(...skipping 14 matching lines...) Expand all Loading... |
107 // to reload. | 108 // to reload. |
108 Tab* tab = tab_model().currentTab; | 109 Tab* tab = tab_model().currentTab; |
109 [tab replaceHistoryWithNavigations:navigations | 110 [tab replaceHistoryWithNavigations:navigations |
110 currentIndex:selected_navigation]; | 111 currentIndex:selected_navigation]; |
111 return nullptr; | 112 return nullptr; |
112 } | 113 } |
113 | 114 |
114 void TabRestoreServiceDelegateImplIOS::CloseTab() { | 115 void TabRestoreServiceDelegateImplIOS::CloseTab() { |
115 [[tab_model() currentTab] close]; | 116 [[tab_model() currentTab] close]; |
116 } | 117 } |
OLD | NEW |