| 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 #import "ios/chrome/browser/tabs/tab_model.h" | 5 #import "ios/chrome/browser/tabs/tab_model.h" |
| 6 | 6 |
| 7 #include <cstdint> | 7 #include <cstdint> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 966 } | 966 } |
| 967 | 967 |
| 968 // Called when UIApplicationWillEnterForegroundNotification is received. | 968 // Called when UIApplicationWillEnterForegroundNotification is received. |
| 969 - (void)applicationWillEnterForeground:(NSNotification*)notify { | 969 - (void)applicationWillEnterForeground:(NSNotification*)notify { |
| 970 if (_tabUsageRecorder) { | 970 if (_tabUsageRecorder) { |
| 971 _tabUsageRecorder->AppWillEnterForeground(); | 971 _tabUsageRecorder->AppWillEnterForeground(); |
| 972 } | 972 } |
| 973 } | 973 } |
| 974 | 974 |
| 975 @end | 975 @end |
| 976 | |
| 977 @implementation TabModel (PrivateForTestingOnly) | |
| 978 | |
| 979 - (Tab*)addTabWithURL:(const GURL&)URL referrer:(const web::Referrer&)referrer { | |
| 980 return [self insertTabWithURL:URL | |
| 981 referrer:referrer | |
| 982 opener:nil | |
| 983 atIndex:self.count]; | |
| 984 } | |
| 985 | |
| 986 - (Tab*)insertTabWithURL:(const GURL&)URL | |
| 987 referrer:(const web::Referrer&)referrer | |
| 988 opener:(Tab*)parentTab | |
| 989 atIndex:(NSUInteger)index { | |
| 990 DCHECK(_browserState); | |
| 991 base::scoped_nsobject<Tab> tab([[Tab alloc] initWithBrowserState:_browserState | |
| 992 opener:parentTab | |
| 993 openedByDOM:NO | |
| 994 model:self]); | |
| 995 web::NavigationManager::WebLoadParams params(URL); | |
| 996 params.referrer = referrer; | |
| 997 params.transition_type = ui::PAGE_TRANSITION_TYPED; | |
| 998 [[tab webController] loadWithParams:params]; | |
| 999 [tab webController].webUsageEnabled = webUsageEnabled_; | |
| 1000 [self insertTab:tab atIndex:index opener:parentTab]; | |
| 1001 return tab; | |
| 1002 } | |
| 1003 | |
| 1004 @end | |
| OLD | NEW |