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

Side by Side Diff: ios/web/web_state/ui/crw_web_controller.mm

Issue 2888773003: Do not create CRWWebUIManager for non-WebUI URLs. (Closed)
Patch Set: Self review Created 3 years, 7 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 | « no previous file | no next file » | 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/web/web_state/ui/crw_web_controller.h" 5 #import "ios/web/web_state/ui/crw_web_controller.h"
6 6
7 #import <WebKit/WebKit.h> 7 #import <WebKit/WebKit.h>
8 8
9 #import <objc/runtime.h> 9 #import <objc/runtime.h>
10 #include <stddef.h> 10 #include <stddef.h>
(...skipping 3144 matching lines...) Expand 10 before | Expand all | Expand 10 after
3155 // Don't cancel NSURLErrorCancelled errors originating from navigation 3155 // Don't cancel NSURLErrorCancelled errors originating from navigation
3156 // as the WKWebView will automatically retry these loads. 3156 // as the WKWebView will automatically retry these loads.
3157 WKWebViewErrorSource source = WKWebViewErrorSourceFromError(error); 3157 WKWebViewErrorSource source = WKWebViewErrorSourceFromError(error);
3158 return source != NAVIGATION; 3158 return source != NAVIGATION;
3159 } 3159 }
3160 3160
3161 #pragma mark - 3161 #pragma mark -
3162 #pragma mark WebUI 3162 #pragma mark WebUI
3163 3163
3164 - (void)createWebUIForURL:(const GURL&)URL { 3164 - (void)createWebUIForURL:(const GURL&)URL {
3165 _webStateImpl->CreateWebUI(URL); 3165 _webStateImpl->CreateWebUI(URL);
PL 2017/05/17 00:04:26 For chrome://crash we would still run CreateWebUI
Eugene But (OOO till 7-30) 2017/05/17 14:49:26 That should not be a problem. Added explanation co
3166 _webUIManager.reset( 3166 bool isWebUIURL = _webStateImpl->HasWebUI();
3167 [[CRWWebUIManager alloc] initWithWebState:self.webStateImpl]); 3167 if (isWebUIURL) {
3168 _webUIManager.reset(
3169 [[CRWWebUIManager alloc] initWithWebState:_webStateImpl]);
3170 }
3168 } 3171 }
3169 3172
3170 - (void)clearWebUI { 3173 - (void)clearWebUI {
3171 _webStateImpl->ClearWebUI(); 3174 _webStateImpl->ClearWebUI();
3172 _webUIManager.reset(); 3175 _webUIManager.reset();
3173 } 3176 }
3174 3177
3175 #pragma mark - 3178 #pragma mark -
3176 #pragma mark Auth Challenge 3179 #pragma mark Auth Challenge
3177 3180
(...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after
4111 messageRouter:messageRouter 4114 messageRouter:messageRouter
4112 completionHandler:^(NSError* loadError) { 4115 completionHandler:^(NSError* loadError) {
4113 if (loadError) 4116 if (loadError)
4114 [self handleLoadError:loadError inMainFrame:YES forNavigation:nil]; 4117 [self handleLoadError:loadError inMainFrame:YES forNavigation:nil];
4115 else 4118 else
4116 self.webStateImpl->SetContentsMimeType("text/html"); 4119 self.webStateImpl->SetContentsMimeType("text/html");
4117 }]; 4120 }];
4118 } 4121 }
4119 4122
4120 - (void)loadHTML:(NSString*)HTML forURL:(const GURL&)URL { 4123 - (void)loadHTML:(NSString*)HTML forURL:(const GURL&)URL {
4124 DCHECK(HTML.length);
4121 // Remove the transient content view. 4125 // Remove the transient content view.
4122 [self clearTransientContentView]; 4126 [self clearTransientContentView];
4123 4127
4124 _loadPhase = web::LOAD_REQUESTED; 4128 _loadPhase = web::LOAD_REQUESTED;
4125 4129
4126 // Web View should not be created for App Specific URLs. 4130 // Web View should not be created for App Specific URLs.
4127 if (!web::GetWebClient()->IsAppSpecificURL(URL)) { 4131 if (!web::GetWebClient()->IsAppSpecificURL(URL)) {
4128 [self ensureWebViewCreated]; 4132 [self ensureWebViewCreated];
4129 DCHECK(_webView) << "_webView null while trying to load HTML"; 4133 DCHECK(_webView) << "_webView null while trying to load HTML";
4130 } 4134 }
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after
5164 - (NSUInteger)observerCount { 5168 - (NSUInteger)observerCount {
5165 DCHECK_EQ(_observerBridges.size(), [_observers count]); 5169 DCHECK_EQ(_observerBridges.size(), [_observers count]);
5166 return [_observers count]; 5170 return [_observers count];
5167 } 5171 }
5168 5172
5169 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action { 5173 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action {
5170 return [action.request valueForHTTPHeaderField:kReferrerHeaderName]; 5174 return [action.request valueForHTTPHeaderField:kReferrerHeaderName];
5171 } 5175 }
5172 5176
5173 @end 5177 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698