Commit d4e617ae authored by eugenebut's avatar eugenebut Committed by Commit bot

[ios] Do not use CRWWebController in MainController.

New code uses web::NavigationManager which is the same program flow.
Old code would tolerate nil CRWWebController, while the new code will
crash (which should not happen in practice).

BUG=616288

Review-Url: https://codereview.chromium.org/2600963002
Cr-Commit-Position: refs/heads/master@{#440854}
parent 8359e507
......@@ -37,8 +37,5 @@ specific_include_rules = {
"+ios/web/net/request_tracker_factory_impl.h",
"+ios/web/net/request_tracker_impl.h",
"+ios/web/net/web_http_protocol_handler_delegate.h",
# TODO(crbug.com/616288): Remove this exception.
"+ios/web/web_state/ui/crw_web_controller.h",
],
}
......@@ -137,11 +137,11 @@
#include "ios/web/net/request_tracker_factory_impl.h"
#include "ios/web/net/request_tracker_impl.h"
#include "ios/web/net/web_http_protocol_handler_delegate.h"
#import "ios/web/public/navigation_manager.h"
#include "ios/web/public/web_capabilities.h"
#include "ios/web/public/web_state/web_state.h"
#import "ios/web/public/web_view_creation_util.h"
#include "ios/web/public/webui/web_ui_ios_controller_factory.h"
#import "ios/web/web_state/ui/crw_web_controller.h"
#include "mojo/edk/embedder/embedder.h"
#import "net/base/mac/url_conversions.h"
#include "net/url_request/url_request_context.h"
......@@ -2317,7 +2317,7 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO };
#pragma mark - Tab opening utility methods.
- (Tab*)openOrReuseTabInMode:(ApplicationMode)targetMode
withURL:(const GURL&)url
withURL:(const GURL&)URL
transition:(ui::PageTransition)transition {
BrowserViewController* targetBVC =
targetMode == ApplicationMode::NORMAL ? self.mainBVC : self.otrBVC;
......@@ -2328,16 +2328,16 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO };
currentURL = [currentTabInTargetBVC url];
if (!(currentTabInTargetBVC && IsURLNtp(currentURL))) {
return [targetBVC addSelectedTabWithURL:url
return [targetBVC addSelectedTabWithURL:URL
atIndex:NSNotFound
transition:transition];
}
Tab* newTab = currentTabInTargetBVC;
// Don't call loadWithParams for chrome://newtab, it's already loaded.
if (!(IsURLNtp(url))) {
web::NavigationManager::WebLoadParams params(url);
[[newTab webController] loadWithParams:params];
if (!(IsURLNtp(URL))) {
web::NavigationManager::WebLoadParams params(URL);
[newTab webState]->GetNavigationManager()->LoadURLWithParams(params);
}
return newTab;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment