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/app/main_controller.h" | 5 #import "ios/chrome/app/main_controller.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #import <CoreSpotlight/CoreSpotlight.h> | 10 #import <CoreSpotlight/CoreSpotlight.h> |
(...skipping 2211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2222 } | 2222 } |
2223 } | 2223 } |
2224 | 2224 |
2225 #pragma mark - Tab opening utility methods. | 2225 #pragma mark - Tab opening utility methods. |
2226 | 2226 |
2227 - (Tab*)openOrReuseTabInMode:(ApplicationMode)targetMode | 2227 - (Tab*)openOrReuseTabInMode:(ApplicationMode)targetMode |
2228 withURL:(const GURL&)URL | 2228 withURL:(const GURL&)URL |
2229 transition:(ui::PageTransition)transition { | 2229 transition:(ui::PageTransition)transition { |
2230 BrowserViewController* targetBVC = | 2230 BrowserViewController* targetBVC = |
2231 targetMode == ApplicationMode::NORMAL ? self.mainBVC : self.otrBVC; | 2231 targetMode == ApplicationMode::NORMAL ? self.mainBVC : self.otrBVC; |
2232 GURL currentURL; | |
2233 | 2232 |
2234 Tab* currentTabInTargetBVC = [[targetBVC tabModel] currentTab]; | 2233 Tab* currentTabInTargetBVC = [[targetBVC tabModel] currentTab]; |
2235 if (currentTabInTargetBVC) | 2234 if (!(currentTabInTargetBVC && IsURLNtp(currentTabInTargetBVC.visibleURL))) { |
kkhorimoto
2017/04/14 20:27:23
We want to return the current Tab if no navigation
Eugene But (OOO till 7-30)
2017/04/14 21:38:36
But NTP can not be pending, or transient, right? I
kkhorimoto
2017/05/31 23:02:08
If the visible URL is not the NTP URL, that means
| |
2236 currentURL = [currentTabInTargetBVC url]; | |
2237 | |
2238 if (!(currentTabInTargetBVC && IsURLNtp(currentURL))) { | |
2239 return [targetBVC addSelectedTabWithURL:URL | 2235 return [targetBVC addSelectedTabWithURL:URL |
2240 atIndex:NSNotFound | 2236 atIndex:NSNotFound |
2241 transition:transition]; | 2237 transition:transition]; |
2242 } | 2238 } |
2243 | 2239 |
2244 Tab* newTab = currentTabInTargetBVC; | 2240 Tab* newTab = currentTabInTargetBVC; |
2245 // Don't call loadWithParams for chrome://newtab, it's already loaded. | 2241 // Don't call loadWithParams for chrome://newtab, it's already loaded. |
2246 if (!(IsURLNtp(URL))) { | 2242 if (!(IsURLNtp(URL))) { |
2247 web::NavigationManager::WebLoadParams params(URL); | 2243 web::NavigationManager::WebLoadParams params(URL); |
2248 [newTab webState]->GetNavigationManager()->LoadURLWithParams(params); | 2244 [newTab webState]->GetNavigationManager()->LoadURLWithParams(params); |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2613 }; | 2609 }; |
2614 | 2610 |
2615 callbackCounter->IncrementCount(); | 2611 callbackCounter->IncrementCount(); |
2616 [self removeBrowsingDataFromBrowserState:_mainBrowserState | 2612 [self removeBrowsingDataFromBrowserState:_mainBrowserState |
2617 mask:removeAllMask | 2613 mask:removeAllMask |
2618 timePeriod:browsing_data::TimePeriod::ALL_TIME | 2614 timePeriod:browsing_data::TimePeriod::ALL_TIME |
2619 completionHandler:decrementCallbackCounterCount]; | 2615 completionHandler:decrementCallbackCounterCount]; |
2620 } | 2616 } |
2621 | 2617 |
2622 @end | 2618 @end |
OLD | NEW |