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

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

Issue 1137143004: WebUI for WKWebView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
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/web_state/ui/crw_ui_web_view_web_controller.h" 5 #import "ios/web/web_state/ui/crw_ui_web_view_web_controller.h"
6 6
7 #import "base/ios/weak_nsobject.h" 7 #import "base/ios/weak_nsobject.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/json/string_escape.h" 9 #include "base/json/string_escape.h"
10 #include "base/mac/bind_objc_block.h" 10 #include "base/mac/bind_objc_block.h"
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 NSString* documentType = 524 NSString* documentType =
525 [_uiWebView stringByEvaluatingJavaScriptFromString: 525 [_uiWebView stringByEvaluatingJavaScriptFromString:
526 @"'' + document"]; 526 @"'' + document"];
527 if ([documentType isEqualToString:@"[object HTMLDocument]"]) 527 if ([documentType isEqualToString:@"[object HTMLDocument]"])
528 return web::WEB_VIEW_DOCUMENT_TYPE_HTML; 528 return web::WEB_VIEW_DOCUMENT_TYPE_HTML;
529 else if ([documentType isEqualToString:@"[object Document]"]) 529 else if ([documentType isEqualToString:@"[object Document]"])
530 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; 530 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC;
531 return web::WEB_VIEW_DOCUMENT_TYPE_UNKNOWN; 531 return web::WEB_VIEW_DOCUMENT_TYPE_UNKNOWN;
532 } 532 }
533 533
534 - (void)loadWebRequest:(NSURLRequest*)request { 534 - (void)loadRequest:(NSMutableURLRequest*)request {
535 DCHECK(web::GetWebClient());
536 GURL requestURL = net::GURLWithNSURL(request.URL);
537 // If the request is for WebUI, add information to let the network stack
538 // access the requestGroupID.
539 if (web::GetWebClient()->IsAppSpecificURL(requestURL)) {
540 // Sub requests of a chrome:// page will not contain the user agent.
541 // Instead use the username part of the URL to allow the network stack to
542 // associate a request to the correct tab.
543 request.URL = web::AddRequestGroupIDToURL(
544 request.URL, self.webStateImpl->GetRequestGroupID());
545 }
535 [_uiWebView loadRequest:request]; 546 [_uiWebView loadRequest:request];
536 } 547 }
537 548
538 - (void)loadWebHTMLString:(NSString*)html forURL:(const GURL&)URL { 549 - (void)loadWebHTMLString:(NSString*)html forURL:(const GURL&)URL {
539 [_uiWebView loadHTMLString:html baseURL:net::NSURLWithGURL(URL)]; 550 [_uiWebView loadHTMLString:html baseURL:net::NSURLWithGURL(URL)];
540 } 551 }
541 552
542 - (BOOL)scriptHasBeenInjectedForClass:(Class)jsInjectionManagerClass 553 - (BOOL)scriptHasBeenInjectedForClass:(Class)jsInjectionManagerClass
543 presenceBeacon:(NSString*)beacon { 554 presenceBeacon:(NSString*)beacon {
544 NSString* beaconCheckScript = [NSString stringWithFormat: 555 NSString* beaconCheckScript = [NSString stringWithFormat:
(...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after
1425 } 1436 }
1426 1437
1427 #pragma mark - 1438 #pragma mark -
1428 #pragma mark Testing methods 1439 #pragma mark Testing methods
1429 1440
1430 -(id<CRWRecurringTaskDelegate>)recurringTaskDelegate { 1441 -(id<CRWRecurringTaskDelegate>)recurringTaskDelegate {
1431 return _recurringTaskDelegate; 1442 return _recurringTaskDelegate;
1432 } 1443 }
1433 1444
1434 @end 1445 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698