Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Side by Side Diff: ios/chrome/browser/tabs/tab_model.mm

Issue 2715753002: Convert TabModelTest to use the public API of TabModel. (Closed)
Patch Set: Rebase. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ios/chrome/browser/tabs/tab_model.h ('k') | ios/chrome/browser/tabs/tab_model_unittest.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « ios/chrome/browser/tabs/tab_model.h ('k') | ios/chrome/browser/tabs/tab_model_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698