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

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

Issue 2027733003: [ios Mojo] Enabled Mojo WebUI by default. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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') | ios/web/webui/web_ui_mojo_inttest.mm » ('j') | 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 996 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 const NSTimeInterval kSnapshotOverlayTransition = 0.5; 1007 const NSTimeInterval kSnapshotOverlayTransition = 0.5;
1008 1008
1009 } // namespace 1009 } // namespace
1010 1010
1011 @implementation CRWWebController 1011 @implementation CRWWebController
1012 1012
1013 @synthesize webUsageEnabled = _webUsageEnabled; 1013 @synthesize webUsageEnabled = _webUsageEnabled;
1014 @synthesize usePlaceholderOverlay = _usePlaceholderOverlay; 1014 @synthesize usePlaceholderOverlay = _usePlaceholderOverlay;
1015 @synthesize loadPhase = _loadPhase; 1015 @synthesize loadPhase = _loadPhase;
1016 @synthesize shouldSuppressDialogs = _shouldSuppressDialogs; 1016 @synthesize shouldSuppressDialogs = _shouldSuppressDialogs;
1017 @synthesize useMojoForWebUI = _useMojoForWebUI;
1018 1017
1019 - (instancetype)initWithWebState:(WebStateImpl*)webState { 1018 - (instancetype)initWithWebState:(WebStateImpl*)webState {
1020 self = [super init]; 1019 self = [super init];
1021 if (self) { 1020 if (self) {
1022 _webStateImpl = webState; 1021 _webStateImpl = webState;
1023 DCHECK(_webStateImpl); 1022 DCHECK(_webStateImpl);
1024 _webStateImpl->InitializeRequestTracker(self); 1023 _webStateImpl->InitializeRequestTracker(self);
1025 // Load phase when no WebView present is 'loaded' because this represents 1024 // Load phase when no WebView present is 'loaded' because this represents
1026 // the idle state. 1025 // the idle state.
1027 _loadPhase = web::PAGE_LOADED; 1026 _loadPhase = web::PAGE_LOADED;
(...skipping 3845 matching lines...) Expand 10 before | Expand all | Expand 10 after
4873 } 4872 }
4874 } 4873 }
4875 4874
4876 - (void)webView:(WKWebView*)webView 4875 - (void)webView:(WKWebView*)webView
4877 runJavaScriptTextInputPanelWithPrompt:(NSString*)prompt 4876 runJavaScriptTextInputPanelWithPrompt:(NSString*)prompt
4878 defaultText:(NSString*)defaultText 4877 defaultText:(NSString*)defaultText
4879 initiatedByFrame:(WKFrameInfo*)frame 4878 initiatedByFrame:(WKFrameInfo*)frame
4880 completionHandler: 4879 completionHandler:
4881 (void (^)(NSString* result))completionHandler { 4880 (void (^)(NSString* result))completionHandler {
4882 GURL origin(web::GURLOriginWithWKSecurityOrigin(frame.securityOrigin)); 4881 GURL origin(web::GURLOriginWithWKSecurityOrigin(frame.securityOrigin));
4883 if (self.useMojoForWebUI && web::GetWebClient()->IsAppSpecificURL(origin) && 4882 if (web::GetWebClient()->IsAppSpecificURL(origin) && _webUIManager) {
4884 _webUIManager) {
4885 std::string mojoResponse = 4883 std::string mojoResponse =
4886 self.mojoFacade->HandleMojoMessage(base::SysNSStringToUTF8(prompt)); 4884 self.mojoFacade->HandleMojoMessage(base::SysNSStringToUTF8(prompt));
4887 completionHandler(base::SysUTF8ToNSString(mojoResponse)); 4885 completionHandler(base::SysUTF8ToNSString(mojoResponse));
4888 return; 4886 return;
4889 } 4887 }
4890 4888
4891 if (self.shouldSuppressDialogs) { 4889 if (self.shouldSuppressDialogs) {
4892 [self didSuppressDialog]; 4890 [self didSuppressDialog];
4893 completionHandler(nil); 4891 completionHandler(nil);
4894 return; 4892 return;
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
5587 } 5585 }
5588 5586
5589 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; 5587 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC;
5590 } 5588 }
5591 5589
5592 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { 5590 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action {
5593 return [action.request valueForHTTPHeaderField:@"Referer"]; 5591 return [action.request valueForHTTPHeaderField:@"Referer"];
5594 } 5592 }
5595 5593
5596 @end 5594 @end
OLDNEW
« no previous file with comments | « ios/web/web_state/ui/crw_web_controller.h ('k') | ios/web/webui/web_ui_mojo_inttest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698