| 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 #import "ios/chrome/browser/tabs/tab_model_list.h" |
| 18 #import "ios/chrome/browser/web_state_list/web_state_list.h" | 18 #import "ios/chrome/browser/web_state_list/web_state_list.h" |
| 19 #import "ios/web/navigation/navigation_manager_impl.h" | 19 #import "ios/web/navigation/navigation_manager_impl.h" |
| 20 #include "ios/web/public/navigation_item.h" | 20 #include "ios/web/public/navigation_item.h" |
| 21 #import "ios/web/web_state/web_state_impl.h" | 21 #import "ios/web/web_state/web_state_impl.h" |
| 22 #import "net/base/mac/url_conversions.h" | 22 #import "net/base/mac/url_conversions.h" |
| 23 | 23 |
| 24 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 25 #error "This file requires ARC support." |
| 26 #endif |
| 27 |
| 24 TabRestoreServiceDelegateImplIOS::TabRestoreServiceDelegateImplIOS( | 28 TabRestoreServiceDelegateImplIOS::TabRestoreServiceDelegateImplIOS( |
| 25 ios::ChromeBrowserState* browser_state) | 29 ios::ChromeBrowserState* browser_state) |
| 26 : browser_state_(browser_state) {} | 30 : browser_state_(browser_state) {} |
| 27 | 31 |
| 28 TabRestoreServiceDelegateImplIOS::~TabRestoreServiceDelegateImplIOS() {} | 32 TabRestoreServiceDelegateImplIOS::~TabRestoreServiceDelegateImplIOS() {} |
| 29 | 33 |
| 30 TabModel* TabRestoreServiceDelegateImplIOS::tab_model() const { | 34 TabModel* TabRestoreServiceDelegateImplIOS::tab_model() const { |
| 31 return GetLastActiveTabModelForChromeBrowserState(browser_state_); | 35 return GetLastActiveTabModelForChromeBrowserState(browser_state_); |
| 32 } | 36 } |
| 33 | 37 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 Tab* tab = tab_model().currentTab; | 112 Tab* tab = tab_model().currentTab; |
| 109 [tab replaceHistoryWithNavigations:navigations | 113 [tab replaceHistoryWithNavigations:navigations |
| 110 currentIndex:selected_navigation]; | 114 currentIndex:selected_navigation]; |
| 111 return nullptr; | 115 return nullptr; |
| 112 } | 116 } |
| 113 | 117 |
| 114 void TabRestoreServiceDelegateImplIOS::CloseTab() { | 118 void TabRestoreServiceDelegateImplIOS::CloseTab() { |
| 115 WebStateList* web_state_list = [tab_model() webStateList]; | 119 WebStateList* web_state_list = [tab_model() webStateList]; |
| 116 web_state_list->CloseWebStateAt(web_state_list->active_index()); | 120 web_state_list->CloseWebStateAt(web_state_list->active_index()); |
| 117 } | 121 } |
| OLD | NEW |