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

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: Updated comments 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 | « ios/web/web_state/ui/crw_web_controller.h ('k') | 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 // |CreateWebUI| will do nothing if |URL| is not a WebUI URL and then
3166 // |HasWebUI| will return false.
3165 _webStateImpl->CreateWebUI(URL); 3167 _webStateImpl->CreateWebUI(URL);
3166 _webUIManager.reset( 3168 bool isWebUIURL = _webStateImpl->HasWebUI();
3167 [[CRWWebUIManager alloc] initWithWebState:self.webStateImpl]); 3169 if (isWebUIURL) {
3170 _webUIManager.reset(
3171 [[CRWWebUIManager alloc] initWithWebState:_webStateImpl]);
3172 }
3168 } 3173 }
3169 3174
3170 - (void)clearWebUI { 3175 - (void)clearWebUI {
3171 _webStateImpl->ClearWebUI(); 3176 _webStateImpl->ClearWebUI();
3172 _webUIManager.reset(); 3177 _webUIManager.reset();
3173 } 3178 }
3174 3179
3175 #pragma mark - 3180 #pragma mark -
3176 #pragma mark Auth Challenge 3181 #pragma mark Auth Challenge
3177 3182
(...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after
4111 messageRouter:messageRouter 4116 messageRouter:messageRouter
4112 completionHandler:^(NSError* loadError) { 4117 completionHandler:^(NSError* loadError) {
4113 if (loadError) 4118 if (loadError)
4114 [self handleLoadError:loadError inMainFrame:YES forNavigation:nil]; 4119 [self handleLoadError:loadError inMainFrame:YES forNavigation:nil];
4115 else 4120 else
4116 self.webStateImpl->SetContentsMimeType("text/html"); 4121 self.webStateImpl->SetContentsMimeType("text/html");
4117 }]; 4122 }];
4118 } 4123 }
4119 4124
4120 - (void)loadHTML:(NSString*)HTML forURL:(const GURL&)URL { 4125 - (void)loadHTML:(NSString*)HTML forURL:(const GURL&)URL {
4126 DCHECK(HTML.length);
4121 // Remove the transient content view. 4127 // Remove the transient content view.
4122 [self clearTransientContentView]; 4128 [self clearTransientContentView];
4123 4129
4124 _loadPhase = web::LOAD_REQUESTED; 4130 _loadPhase = web::LOAD_REQUESTED;
4125 4131
4126 // Web View should not be created for App Specific URLs. 4132 // Web View should not be created for App Specific URLs.
4127 if (!web::GetWebClient()->IsAppSpecificURL(URL)) { 4133 if (!web::GetWebClient()->IsAppSpecificURL(URL)) {
4128 [self ensureWebViewCreated]; 4134 [self ensureWebViewCreated];
4129 DCHECK(_webView) << "_webView null while trying to load HTML"; 4135 DCHECK(_webView) << "_webView null while trying to load HTML";
4130 } 4136 }
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after
5164 - (NSUInteger)observerCount { 5170 - (NSUInteger)observerCount {
5165 DCHECK_EQ(_observerBridges.size(), [_observers count]); 5171 DCHECK_EQ(_observerBridges.size(), [_observers count]);
5166 return [_observers count]; 5172 return [_observers count];
5167 } 5173 }
5168 5174
5169 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action { 5175 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action {
5170 return [action.request valueForHTTPHeaderField:kReferrerHeaderName]; 5176 return [action.request valueForHTTPHeaderField:kReferrerHeaderName];
5171 } 5177 }
5172 5178
5173 @end 5179 @end
OLDNEW
« no previous file with comments | « ios/web/web_state/ui/crw_web_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698