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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" | 130 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" |
131 #include "ios/public/provider/chrome/browser/distribution/app_distribution_provi
der.h" | 131 #include "ios/public/provider/chrome/browser/distribution/app_distribution_provi
der.h" |
132 #import "ios/public/provider/chrome/browser/native_app_launcher/native_app_white
list_manager.h" | 132 #import "ios/public/provider/chrome/browser/native_app_launcher/native_app_white
list_manager.h" |
133 #include "ios/public/provider/chrome/browser/signin/chrome_identity_service.h" | 133 #include "ios/public/provider/chrome/browser/signin/chrome_identity_service.h" |
134 #import "ios/public/provider/chrome/browser/user_feedback/user_feedback_provider
.h" | 134 #import "ios/public/provider/chrome/browser/user_feedback/user_feedback_provider
.h" |
135 #import "ios/third_party/material_components_ios/src/components/Typography/src/M
aterialTypography.h" | 135 #import "ios/third_party/material_components_ios/src/components/Typography/src/M
aterialTypography.h" |
136 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF
ontLoader.h" | 136 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF
ontLoader.h" |
137 #include "ios/web/net/request_tracker_factory_impl.h" | 137 #include "ios/web/net/request_tracker_factory_impl.h" |
138 #include "ios/web/net/request_tracker_impl.h" | 138 #include "ios/web/net/request_tracker_impl.h" |
139 #include "ios/web/net/web_http_protocol_handler_delegate.h" | 139 #include "ios/web/net/web_http_protocol_handler_delegate.h" |
| 140 #import "ios/web/public/navigation_manager.h" |
140 #include "ios/web/public/web_capabilities.h" | 141 #include "ios/web/public/web_capabilities.h" |
141 #include "ios/web/public/web_state/web_state.h" | 142 #include "ios/web/public/web_state/web_state.h" |
142 #import "ios/web/public/web_view_creation_util.h" | 143 #import "ios/web/public/web_view_creation_util.h" |
143 #include "ios/web/public/webui/web_ui_ios_controller_factory.h" | 144 #include "ios/web/public/webui/web_ui_ios_controller_factory.h" |
144 #import "ios/web/web_state/ui/crw_web_controller.h" | |
145 #include "mojo/edk/embedder/embedder.h" | 145 #include "mojo/edk/embedder/embedder.h" |
146 #import "net/base/mac/url_conversions.h" | 146 #import "net/base/mac/url_conversions.h" |
147 #include "net/url_request/url_request_context.h" | 147 #include "net/url_request/url_request_context.h" |
148 #include "ui/base/l10n/l10n_util.h" | 148 #include "ui/base/l10n/l10n_util.h" |
149 | 149 |
150 namespace { | 150 namespace { |
151 | 151 |
152 // Preference key used to store which profile is current. | 152 // Preference key used to store which profile is current. |
153 NSString* kIncognitoCurrentKey = @"IncognitoActive"; | 153 NSString* kIncognitoCurrentKey = @"IncognitoActive"; |
154 | 154 |
(...skipping 2155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2310 [self lastIncognitoTabClosed]; | 2310 [self lastIncognitoTabClosed]; |
2311 } else { | 2311 } else { |
2312 [self lastRegularTabClosed]; | 2312 [self lastRegularTabClosed]; |
2313 } | 2313 } |
2314 } | 2314 } |
2315 } | 2315 } |
2316 | 2316 |
2317 #pragma mark - Tab opening utility methods. | 2317 #pragma mark - Tab opening utility methods. |
2318 | 2318 |
2319 - (Tab*)openOrReuseTabInMode:(ApplicationMode)targetMode | 2319 - (Tab*)openOrReuseTabInMode:(ApplicationMode)targetMode |
2320 withURL:(const GURL&)url | 2320 withURL:(const GURL&)URL |
2321 transition:(ui::PageTransition)transition { | 2321 transition:(ui::PageTransition)transition { |
2322 BrowserViewController* targetBVC = | 2322 BrowserViewController* targetBVC = |
2323 targetMode == ApplicationMode::NORMAL ? self.mainBVC : self.otrBVC; | 2323 targetMode == ApplicationMode::NORMAL ? self.mainBVC : self.otrBVC; |
2324 GURL currentURL; | 2324 GURL currentURL; |
2325 | 2325 |
2326 Tab* currentTabInTargetBVC = [[targetBVC tabModel] currentTab]; | 2326 Tab* currentTabInTargetBVC = [[targetBVC tabModel] currentTab]; |
2327 if (currentTabInTargetBVC) | 2327 if (currentTabInTargetBVC) |
2328 currentURL = [currentTabInTargetBVC url]; | 2328 currentURL = [currentTabInTargetBVC url]; |
2329 | 2329 |
2330 if (!(currentTabInTargetBVC && IsURLNtp(currentURL))) { | 2330 if (!(currentTabInTargetBVC && IsURLNtp(currentURL))) { |
2331 return [targetBVC addSelectedTabWithURL:url | 2331 return [targetBVC addSelectedTabWithURL:URL |
2332 atIndex:NSNotFound | 2332 atIndex:NSNotFound |
2333 transition:transition]; | 2333 transition:transition]; |
2334 } | 2334 } |
2335 | 2335 |
2336 Tab* newTab = currentTabInTargetBVC; | 2336 Tab* newTab = currentTabInTargetBVC; |
2337 // Don't call loadWithParams for chrome://newtab, it's already loaded. | 2337 // Don't call loadWithParams for chrome://newtab, it's already loaded. |
2338 if (!(IsURLNtp(url))) { | 2338 if (!(IsURLNtp(URL))) { |
2339 web::NavigationManager::WebLoadParams params(url); | 2339 web::NavigationManager::WebLoadParams params(URL); |
2340 [[newTab webController] loadWithParams:params]; | 2340 [newTab webState]->GetNavigationManager()->LoadURLWithParams(params); |
2341 } | 2341 } |
2342 return newTab; | 2342 return newTab; |
2343 } | 2343 } |
2344 | 2344 |
2345 - (Tab*)openSelectedTabInMode:(ApplicationMode)targetMode | 2345 - (Tab*)openSelectedTabInMode:(ApplicationMode)targetMode |
2346 withURL:(const GURL&)url | 2346 withURL:(const GURL&)url |
2347 transition:(ui::PageTransition)transition { | 2347 transition:(ui::PageTransition)transition { |
2348 BrowserViewController* targetBVC = | 2348 BrowserViewController* targetBVC = |
2349 targetMode == ApplicationMode::NORMAL ? self.mainBVC : self.otrBVC; | 2349 targetMode == ApplicationMode::NORMAL ? self.mainBVC : self.otrBVC; |
2350 NSUInteger tabIndex = NSNotFound; | 2350 NSUInteger tabIndex = NSNotFound; |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2696 }; | 2696 }; |
2697 | 2697 |
2698 callbackCounter->IncrementCount(); | 2698 callbackCounter->IncrementCount(); |
2699 [self removeBrowsingDataFromBrowserState:_mainBrowserState | 2699 [self removeBrowsingDataFromBrowserState:_mainBrowserState |
2700 mask:removeAllMask | 2700 mask:removeAllMask |
2701 timePeriod:browsing_data::ALL_TIME | 2701 timePeriod:browsing_data::ALL_TIME |
2702 completionHandler:decrementCallbackCounterCount]; | 2702 completionHandler:decrementCallbackCounterCount]; |
2703 } | 2703 } |
2704 | 2704 |
2705 @end | 2705 @end |
OLD | NEW |