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

Side by Side Diff: ios/web_view/shell/shell_view_controller.m

Issue 2760143002: Update ios/web_view/shell UIDelegate implementation. (Closed)
Patch Set: Created 3 years, 9 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_view/internal/cwv_web_view.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_view/shell/shell_view_controller.h" 5 #import "ios/web_view/shell/shell_view_controller.h"
6 6
7 #import <MobileCoreServices/MobileCoreServices.h> 7 #import <MobileCoreServices/MobileCoreServices.h>
8 8
9 #import "ios/web_view/public/cwv.h" 9 #import "ios/web_view/public/cwv.h"
10 #import "ios/web_view/public/cwv_html_element.h" 10 #import "ios/web_view/public/cwv_html_element.h"
11 #import "ios/web_view/public/cwv_navigation_action.h"
11 #import "ios/web_view/public/cwv_navigation_delegate.h" 12 #import "ios/web_view/public/cwv_navigation_delegate.h"
12 #import "ios/web_view/public/cwv_ui_delegate.h" 13 #import "ios/web_view/public/cwv_ui_delegate.h"
13 #import "ios/web_view/public/cwv_web_view.h" 14 #import "ios/web_view/public/cwv_web_view.h"
14 #import "ios/web_view/shell/translate_controller.h" 15 #import "ios/web_view/shell/translate_controller.h"
15 16
16 #if !defined(__has_feature) || !__has_feature(objc_arc) 17 #if !defined(__has_feature) || !__has_feature(objc_arc)
17 #error "This file requires ARC support." 18 #error "This file requires ARC support."
18 #endif 19 #endif
19 20
20 // Externed accessibility identifier. 21 // Externed accessibility identifier.
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 action:@selector(stopLoading) 133 action:@selector(stopLoading)
133 forControlEvents:UIControlEventTouchUpInside]; 134 forControlEvents:UIControlEventTouchUpInside];
134 135
135 [_toolbar addSubview:back]; 136 [_toolbar addSubview:back];
136 [_toolbar addSubview:forward]; 137 [_toolbar addSubview:forward];
137 [_toolbar addSubview:stop]; 138 [_toolbar addSubview:stop];
138 [_toolbar addSubview:_field]; 139 [_toolbar addSubview:_field];
139 140
140 self.webView = [CWV webViewWithFrame:[_containerView bounds]]; 141 self.webView = [CWV webViewWithFrame:[_containerView bounds]];
141 _webView.navigationDelegate = self; 142 _webView.navigationDelegate = self;
143 _webView.UIDelegate = self;
142 _translateController = [[TranslateController alloc] init]; 144 _translateController = [[TranslateController alloc] init];
143 _webView.translationDelegate = _translateController; 145 _webView.translationDelegate = _translateController;
144 146
145 [_webView setAutoresizingMask:UIViewAutoresizingFlexibleWidth | 147 [_webView setAutoresizingMask:UIViewAutoresizingFlexibleWidth |
146 UIViewAutoresizingFlexibleHeight]; 148 UIViewAutoresizingFlexibleHeight];
147 [_containerView addSubview:_webView]; 149 [_containerView addSubview:_webView];
148 150
149 NSURLRequest* request = [NSURLRequest 151 NSURLRequest* request = [NSURLRequest
150 requestWithURL:[NSURL URLWithString:@"https://www.google.com/"]]; 152 requestWithURL:[NSURL URLWithString:@"https://www.google.com/"]];
151 [_webView loadRequest:request]; 153 [_webView loadRequest:request];
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 // Do not update the URL if the text field is currently being edited. 189 // Do not update the URL if the text field is currently being edited.
188 if ([_field isFirstResponder]) { 190 if ([_field isFirstResponder]) {
189 return; 191 return;
190 } 192 }
191 193
192 [_field setText:[[_webView visibleURL] absoluteString]]; 194 [_field setText:[[_webView visibleURL] absoluteString]];
193 } 195 }
194 196
195 #pragma mark CWVUIDelegate methods 197 #pragma mark CWVUIDelegate methods
196 198
199 - (CWVWebView*)webView:(CWVWebView*)webView
200 createWebViewWithConfiguration:(CWVWebViewConfiguration*)configuration
201 forNavigationAction:(CWVNavigationAction*)action {
202 NSLog(@"Create new CWVWebView for %@. User initiated? %@", action.request.URL,
203 action.userInitiated ? @"Yes" : @"No");
204 return nil;
205 }
206
207 - (void)webViewDidClose:(CWVWebView*)webView {
208 NSLog(@"webViewDidClose");
209 }
210
197 - (void)webView:(CWVWebView*)webView 211 - (void)webView:(CWVWebView*)webView
198 runContextMenuWithTitle:(NSString*)menuTitle 212 runContextMenuWithTitle:(NSString*)menuTitle
199 forHTMLElement:(CWVHTMLElement*)element 213 forHTMLElement:(CWVHTMLElement*)element
200 inView:(UIView*)view 214 inView:(UIView*)view
201 userGestureLocation:(CGPoint)location { 215 userGestureLocation:(CGPoint)location {
202 if (!element.hyperlink) { 216 if (!element.hyperlink) {
203 return; 217 return;
204 } 218 }
205 219
206 UIAlertController* alert = [UIAlertController 220 UIAlertController* alert = [UIAlertController
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 // TODO(crbug.com/679895): Add some visual indication that the page load has 348 // TODO(crbug.com/679895): Add some visual indication that the page load has
335 // finished. 349 // finished.
336 [self updateToolbar]; 350 [self updateToolbar];
337 } 351 }
338 352
339 - (void)webViewWebContentProcessDidTerminate:(CWVWebView*)webView { 353 - (void)webViewWebContentProcessDidTerminate:(CWVWebView*)webView {
340 NSLog(@"webViewWebContentProcessDidTerminate"); 354 NSLog(@"webViewWebContentProcessDidTerminate");
341 } 355 }
342 356
343 @end 357 @end
OLDNEW
« no previous file with comments | « ios/web_view/internal/cwv_web_view.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698