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 "base/mac/objc_property_releaser.h" | 7 #include "base/mac/objc_property_releaser.h" |
8 #import "base/mac/scoped_nsobject.h" | 8 #import "base/mac/scoped_nsobject.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
11 #include "ios/net/cookies/cookie_store_ios.h" | 11 #include "ios/net/cookies/cookie_store_ios.h" |
12 #import "ios/net/crn_http_protocol_handler.h" | 12 #import "ios/net/crn_http_protocol_handler.h" |
| 13 #import "ios/net/empty_nsurlcache.h" |
13 #import "ios/web/navigation/crw_session_controller.h" | 14 #import "ios/web/navigation/crw_session_controller.h" |
14 #include "ios/web/navigation/web_load_params.h" | 15 #include "ios/web/navigation/web_load_params.h" |
15 #import "ios/web/net/crw_url_verifying_protocol_handler.h" | 16 #import "ios/web/net/crw_url_verifying_protocol_handler.h" |
16 #include "ios/web/net/request_tracker_factory_impl.h" | 17 #include "ios/web/net/request_tracker_factory_impl.h" |
17 #import "ios/web/net/web_http_protocol_handler_delegate.h" | 18 #import "ios/web/net/web_http_protocol_handler_delegate.h" |
18 #include "ios/web/public/referrer.h" | 19 #include "ios/web/public/referrer.h" |
19 #import "ios/web/public/web_controller_factory.h" | 20 #import "ios/web/public/web_controller_factory.h" |
20 #include "ios/web/public/web_state/web_state.h" | 21 #include "ios/web/public/web_state/web_state.h" |
21 #include "ios/web/public/web_view_util.h" | 22 #include "ios/web/public/web_view_util.h" |
22 #include "ios/web/shell/shell_browser_state.h" | 23 #include "ios/web/shell/shell_browser_state.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 [[_webController view] setFrame:[_containerView bounds]]; | 124 [[_webController view] setFrame:[_containerView bounds]]; |
124 [_containerView addSubview:[_webController view]]; | 125 [_containerView addSubview:[_webController view]]; |
125 | 126 |
126 web::WebLoadParams params(GURL("https://dev.chromium.org/")); | 127 web::WebLoadParams params(GURL("https://dev.chromium.org/")); |
127 params.transition_type = ui::PAGE_TRANSITION_TYPED; | 128 params.transition_type = ui::PAGE_TRANSITION_TYPED; |
128 [_webController loadWithParams:params]; | 129 [_webController loadWithParams:params]; |
129 } | 130 } |
130 | 131 |
131 - (void)setUpNetworkStack { | 132 - (void)setUpNetworkStack { |
132 // Disable the default cache. | 133 // Disable the default cache. |
133 [NSURLCache setSharedURLCache:nil]; | 134 [NSURLCache setSharedURLCache:[EmptyNSURLCache emptyNSURLCache]]; |
134 | 135 |
135 _httpProtocolDelegate.reset(new web::WebHTTPProtocolHandlerDelegate( | 136 _httpProtocolDelegate.reset(new web::WebHTTPProtocolHandlerDelegate( |
136 _browserState->GetRequestContext())); | 137 _browserState->GetRequestContext())); |
137 net::HTTPProtocolHandlerDelegate::SetInstance(_httpProtocolDelegate.get()); | 138 net::HTTPProtocolHandlerDelegate::SetInstance(_httpProtocolDelegate.get()); |
138 BOOL success = [NSURLProtocol registerClass:[CRNHTTPProtocolHandler class]]; | 139 BOOL success = [NSURLProtocol registerClass:[CRNHTTPProtocolHandler class]]; |
139 DCHECK(success); | 140 DCHECK(success); |
140 // The CRWURLVerifyingProtocolHandler is used to verify URL in the | 141 // The CRWURLVerifyingProtocolHandler is used to verify URL in the |
141 // CRWWebController. It must be registered after the HttpProtocolHandler | 142 // CRWWebController. It must be registered after the HttpProtocolHandler |
142 // because handlers are called in the reverse order of declaration. | 143 // because handlers are called in the reverse order of declaration. |
143 success = | 144 success = |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 - (void)webDidPrepareForGoBack { | 326 - (void)webDidPrepareForGoBack { |
326 } | 327 } |
327 - (int)downloadImageAtUrl:(const GURL&)url | 328 - (int)downloadImageAtUrl:(const GURL&)url |
328 maxBitmapSize:(uint32_t)maxBitmapSize | 329 maxBitmapSize:(uint32_t)maxBitmapSize |
329 callback: | 330 callback: |
330 (const web::WebState::ImageDownloadCallback&)callback { | 331 (const web::WebState::ImageDownloadCallback&)callback { |
331 return -1; | 332 return -1; |
332 } | 333 } |
333 | 334 |
334 @end | 335 @end |
OLD | NEW |