| 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" |
| 11 #include "base/strings/sys_string_conversions.h" | 11 #include "base/strings/sys_string_conversions.h" |
| 12 #include "components/sessions/core/session_types.h" | 12 #include "components/sessions/core/session_types.h" |
| 13 #include "components/sessions/ios/ios_serialized_navigation_builder.h" | 13 #include "components/sessions/ios/ios_serialized_navigation_builder.h" |
| 14 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 14 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
| 15 #import "ios/chrome/browser/tabs/tab.h" | 15 #import "ios/chrome/browser/tabs/tab.h" |
| 16 #import "ios/chrome/browser/tabs/tab_model.h" | 16 #import "ios/chrome/browser/tabs/tab_model.h" |
| 17 #import "ios/chrome/browser/tabs/tab_model_list.h" | 17 #include "ios/chrome/browser/ui/browser_ios.h" |
| 18 #include "ios/chrome/browser/ui/browser_list_ios.h" |
| 18 #import "ios/web/navigation/navigation_manager_impl.h" | 19 #import "ios/web/navigation/navigation_manager_impl.h" |
| 19 #include "ios/web/public/navigation_item.h" | 20 #include "ios/web/public/navigation_item.h" |
| 20 #import "ios/web/web_state/web_state_impl.h" | 21 #import "ios/web/web_state/web_state_impl.h" |
| 21 #import "net/base/mac/url_conversions.h" | 22 #import "net/base/mac/url_conversions.h" |
| 22 | 23 |
| 23 using web::WebStateImpl; | 24 using web::WebStateImpl; |
| 24 | 25 |
| 25 TabRestoreServiceDelegateImplIOS::TabRestoreServiceDelegateImplIOS( | 26 TabRestoreServiceDelegateImplIOS::TabRestoreServiceDelegateImplIOS( |
| 26 ios::ChromeBrowserState* browser_state) | 27 ios::ChromeBrowserState* browser_state) |
| 27 : browser_state_(browser_state) {} | 28 : browser_state_(browser_state) {} |
| 28 | 29 |
| 29 TabRestoreServiceDelegateImplIOS::~TabRestoreServiceDelegateImplIOS() {} | 30 TabRestoreServiceDelegateImplIOS::~TabRestoreServiceDelegateImplIOS() {} |
| 30 | 31 |
| 31 TabModel* TabRestoreServiceDelegateImplIOS::tab_model() const { | 32 TabModel* TabRestoreServiceDelegateImplIOS::tab_model() const { |
| 32 return GetLastActiveTabModelForChromeBrowserState(browser_state_); | 33 id<BrowserIOS> browser = |
| 34 BrowserListIOS::GetLastActiveWithBrowserState(browser_state_); |
| 35 return [browser tabModel]; |
| 33 } | 36 } |
| 34 | 37 |
| 35 void TabRestoreServiceDelegateImplIOS::ShowBrowserWindow() { | 38 void TabRestoreServiceDelegateImplIOS::ShowBrowserWindow() { |
| 36 // No need to do anything here, as the singleton browser "window" is already | 39 // No need to do anything here, as the singleton browser "window" is already |
| 37 // shown. | 40 // shown. |
| 38 } | 41 } |
| 39 | 42 |
| 40 const SessionID& TabRestoreServiceDelegateImplIOS::GetSessionID() const { | 43 const SessionID& TabRestoreServiceDelegateImplIOS::GetSessionID() const { |
| 41 return session_id_; | 44 return session_id_; |
| 42 } | 45 } |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 // to reload. | 110 // to reload. |
| 108 Tab* tab = tab_model().currentTab; | 111 Tab* tab = tab_model().currentTab; |
| 109 [tab replaceHistoryWithNavigations:navigations | 112 [tab replaceHistoryWithNavigations:navigations |
| 110 currentIndex:selected_navigation]; | 113 currentIndex:selected_navigation]; |
| 111 return nullptr; | 114 return nullptr; |
| 112 } | 115 } |
| 113 | 116 |
| 114 void TabRestoreServiceDelegateImplIOS::CloseTab() { | 117 void TabRestoreServiceDelegateImplIOS::CloseTab() { |
| 115 [[tab_model() currentTab] close]; | 118 [[tab_model() currentTab] close]; |
| 116 } | 119 } |
| OLD | NEW |