| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 // ====== New Architecture ===== | 5 // ====== New Architecture ===== |
| 6 // = This code is only used in the new iOS Chrome architecture. = | 6 // = This code is only used in the new iOS Chrome architecture. = |
| 7 // ============================================================================ | 7 // ============================================================================ |
| 8 | 8 |
| 9 #import "ios/clean/chrome/browser/ui/tab_grid/tab_grid_coordinator.h" | 9 #import "ios/clean/chrome/browser/ui/tab_grid/tab_grid_coordinator.h" |
| 10 | 10 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 [tabCoordinator start]; | 107 [tabCoordinator start]; |
| 108 _activeWebStateIndex = index; | 108 _activeWebStateIndex = index; |
| 109 } | 109 } |
| 110 | 110 |
| 111 - (void)closeTabAtIndexPath:(NSIndexPath*)indexPath { | 111 - (void)closeTabAtIndexPath:(NSIndexPath*)indexPath { |
| 112 size_t index = static_cast<size_t>(indexPath.item); | 112 size_t index = static_cast<size_t>(indexPath.item); |
| 113 DCHECK(index < _webStates.size()); | 113 DCHECK(index < _webStates.size()); |
| 114 _webStates.erase(_webStates.begin() + index); | 114 _webStates.erase(_webStates.begin() + index); |
| 115 } | 115 } |
| 116 | 116 |
| 117 - (void)createNewTabAtIndexPath:(NSIndexPath*)indexPath { |
| 118 web::WebState::CreateParams webStateCreateParams(self.browserState); |
| 119 std::unique_ptr<web::WebState> webState = |
| 120 web::WebState::Create(webStateCreateParams); |
| 121 _webStates.push_back(std::move(webState)); |
| 122 } |
| 123 |
| 117 #pragma mark - TabGridCommands | 124 #pragma mark - TabGridCommands |
| 118 | 125 |
| 119 - (void)showTabGrid { | 126 - (void)showTabGrid { |
| 120 // This object should only ever have at most one child. | 127 // This object should only ever have at most one child. |
| 121 DCHECK_LE(self.children.count, 1UL); | 128 DCHECK_LE(self.children.count, 1UL); |
| 122 BrowserCoordinator* child = [self.children anyObject]; | 129 BrowserCoordinator* child = [self.children anyObject]; |
| 123 [child stop]; | 130 [child stop]; |
| 124 [self removeChildCoordinator:child]; | 131 [self removeChildCoordinator:child]; |
| 125 } | 132 } |
| 126 | 133 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 152 activeWebState->GetNavigationManager()->LoadURLWithParams(params); | 159 activeWebState->GetNavigationManager()->LoadURLWithParams(params); |
| 153 if (!self.children.count) { | 160 if (!self.children.count) { |
| 154 [self showTabAtIndexPath:[NSIndexPath | 161 [self showTabAtIndexPath:[NSIndexPath |
| 155 indexPathForItem:static_cast<NSUInteger>( | 162 indexPathForItem:static_cast<NSUInteger>( |
| 156 _activeWebStateIndex) | 163 _activeWebStateIndex) |
| 157 inSection:0]]; | 164 inSection:0]]; |
| 158 } | 165 } |
| 159 } | 166 } |
| 160 | 167 |
| 161 @end | 168 @end |
| OLD | NEW |