| OLD | NEW |
| 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/shell/view_controller.h" | 5 #import "ios/web/shell/view_controller.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <utility> |
| 10 |
| 9 #include "base/mac/objc_property_releaser.h" | 11 #include "base/mac/objc_property_releaser.h" |
| 10 #import "base/mac/scoped_nsobject.h" | 12 #import "base/mac/scoped_nsobject.h" |
| 11 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/strings/sys_string_conversions.h" | 14 #include "base/strings/sys_string_conversions.h" |
| 13 #include "ios/net/cookies/cookie_store_ios.h" | 15 #include "ios/net/cookies/cookie_store_ios.h" |
| 14 #import "ios/net/crn_http_protocol_handler.h" | 16 #import "ios/net/crn_http_protocol_handler.h" |
| 15 #import "ios/net/empty_nsurlcache.h" | 17 #import "ios/net/empty_nsurlcache.h" |
| 16 #import "ios/web/navigation/crw_session_controller.h" | 18 #import "ios/web/navigation/crw_session_controller.h" |
| 17 #include "ios/web/navigation/web_load_params.h" | 19 #include "ios/web/navigation/web_load_params.h" |
| 18 #import "ios/web/net/crw_url_verifying_protocol_handler.h" | 20 #import "ios/web/net/crw_url_verifying_protocol_handler.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 [_toolbarView addSubview:forward]; | 121 [_toolbarView addSubview:forward]; |
| 120 [_toolbarView addSubview:field]; | 122 [_toolbarView addSubview:field]; |
| 121 | 123 |
| 122 // Set up the network stack before creating the WebState. | 124 // Set up the network stack before creating the WebState. |
| 123 [self setUpNetworkStack]; | 125 [self setUpNetworkStack]; |
| 124 | 126 |
| 125 scoped_ptr<web::WebStateImpl> webState(new web::WebStateImpl(_browserState)); | 127 scoped_ptr<web::WebStateImpl> webState(new web::WebStateImpl(_browserState)); |
| 126 webState->GetNavigationManagerImpl().InitializeSession(nil, nil, NO, 0); | 128 webState->GetNavigationManagerImpl().InitializeSession(nil, nil, NO, 0); |
| 127 web::WebViewType webViewType = | 129 web::WebViewType webViewType = |
| 128 UseWKWebView() ? web::WK_WEB_VIEW_TYPE : web::UI_WEB_VIEW_TYPE; | 130 UseWKWebView() ? web::WK_WEB_VIEW_TYPE : web::UI_WEB_VIEW_TYPE; |
| 129 _webController.reset(web::CreateWebController(webViewType, webState.Pass())); | 131 _webController.reset( |
| 132 web::CreateWebController(webViewType, std::move(webState))); |
| 130 [_webController setDelegate:self]; | 133 [_webController setDelegate:self]; |
| 131 [_webController setUIDelegate:self]; | 134 [_webController setUIDelegate:self]; |
| 132 [_webController setWebUsageEnabled:YES]; | 135 [_webController setWebUsageEnabled:YES]; |
| 133 | 136 |
| 134 [[_webController view] setFrame:[_containerView bounds]]; | 137 [[_webController view] setFrame:[_containerView bounds]]; |
| 135 [_containerView addSubview:[_webController view]]; | 138 [_containerView addSubview:[_webController view]]; |
| 136 | 139 |
| 137 web::WebLoadParams params(GURL("https://dev.chromium.org/")); | 140 web::WebLoadParams params(GURL("https://dev.chromium.org/")); |
| 138 params.transition_type = ui::PAGE_TRANSITION_TYPED; | 141 params.transition_type = ui::PAGE_TRANSITION_TYPED; |
| 139 [_webController loadWithParams:params]; | 142 [_webController loadWithParams:params]; |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 runAuthDialogForProtectionSpace:(NSURLProtectionSpace*)protectionSpace | 372 runAuthDialogForProtectionSpace:(NSURLProtectionSpace*)protectionSpace |
| 370 proposedCredential:(NSURLCredential*)credential | 373 proposedCredential:(NSURLCredential*)credential |
| 371 completionHandler: | 374 completionHandler: |
| 372 (void (^)(NSString* user, NSString* password))handler { | 375 (void (^)(NSString* user, NSString* password))handler { |
| 373 // Calling |handler| with nil objects is the same as not implemeting it. This | 376 // Calling |handler| with nil objects is the same as not implemeting it. This |
| 374 // method is implemented to make testing easier. | 377 // method is implemented to make testing easier. |
| 375 handler(nil, nil); | 378 handler(nil, nil); |
| 376 } | 379 } |
| 377 | 380 |
| 378 @end | 381 @end |
| OLD | NEW |