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

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: Fixed tests; 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/chrome/browser/autofill/form_suggestion_controller_unittest.mm ('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.
michaeldo 2017/05/17 15:17:31 Can you add to this something like "but must be ca
Eugene But (OOO till 7-30) 2017/05/17 18:36:41 Updated comment.
3165 _webStateImpl->CreateWebUI(URL); 3166 _webStateImpl->CreateWebUI(URL);
3166 _webUIManager.reset( 3167 bool isWebUIURL = _webStateImpl->HasWebUI();
3167 [[CRWWebUIManager alloc] initWithWebState:self.webStateImpl]); 3168 if (isWebUIURL) {
3169 _webUIManager.reset(
3170 [[CRWWebUIManager alloc] initWithWebState:_webStateImpl]);
3171 }
3168 } 3172 }
3169 3173
3170 - (void)clearWebUI { 3174 - (void)clearWebUI {
3171 _webStateImpl->ClearWebUI(); 3175 _webStateImpl->ClearWebUI();
3172 _webUIManager.reset(); 3176 _webUIManager.reset();
3173 } 3177 }
3174 3178
3175 #pragma mark - 3179 #pragma mark -
3176 #pragma mark Auth Challenge 3180 #pragma mark Auth Challenge
3177 3181
(...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after
4111 messageRouter:messageRouter 4115 messageRouter:messageRouter
4112 completionHandler:^(NSError* loadError) { 4116 completionHandler:^(NSError* loadError) {
4113 if (loadError) 4117 if (loadError)
4114 [self handleLoadError:loadError inMainFrame:YES forNavigation:nil]; 4118 [self handleLoadError:loadError inMainFrame:YES forNavigation:nil];
4115 else 4119 else
4116 self.webStateImpl->SetContentsMimeType("text/html"); 4120 self.webStateImpl->SetContentsMimeType("text/html");
4117 }]; 4121 }];
4118 } 4122 }
4119 4123
4120 - (void)loadHTML:(NSString*)HTML forURL:(const GURL&)URL { 4124 - (void)loadHTML:(NSString*)HTML forURL:(const GURL&)URL {
4125 DCHECK(HTML.length);
michaeldo 2017/05/17 15:17:31 Should we add a note to the comment for this metho
Eugene But (OOO till 7-30) 2017/05/17 18:36:41 Done.
4121 // Remove the transient content view. 4126 // Remove the transient content view.
4122 [self clearTransientContentView]; 4127 [self clearTransientContentView];
4123 4128
4124 _loadPhase = web::LOAD_REQUESTED; 4129 _loadPhase = web::LOAD_REQUESTED;
4125 4130
4126 // Web View should not be created for App Specific URLs. 4131 // Web View should not be created for App Specific URLs.
4127 if (!web::GetWebClient()->IsAppSpecificURL(URL)) { 4132 if (!web::GetWebClient()->IsAppSpecificURL(URL)) {
4128 [self ensureWebViewCreated]; 4133 [self ensureWebViewCreated];
4129 DCHECK(_webView) << "_webView null while trying to load HTML"; 4134 DCHECK(_webView) << "_webView null while trying to load HTML";
4130 } 4135 }
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after
5164 - (NSUInteger)observerCount { 5169 - (NSUInteger)observerCount {
5165 DCHECK_EQ(_observerBridges.size(), [_observers count]); 5170 DCHECK_EQ(_observerBridges.size(), [_observers count]);
5166 return [_observers count]; 5171 return [_observers count];
5167 } 5172 }
5168 5173
5169 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action { 5174 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action {
5170 return [action.request valueForHTTPHeaderField:kReferrerHeaderName]; 5175 return [action.request valueForHTTPHeaderField:kReferrerHeaderName];
5171 } 5176 }
5172 5177
5173 @end 5178 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/autofill/form_suggestion_controller_unittest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698