| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/wk_web_view_configuration_provider.h" | 5 #import "ios/web/web_state/ui/wk_web_view_configuration_provider.h" |
| 6 | 6 |
| 7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
| 8 #import <WebKit/WebKit.h> | 8 #import <WebKit/WebKit.h> |
| 9 | 9 |
| 10 #include "base/ios/ios_util.h" | 10 #include "base/ios/ios_util.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 WKWebViewConfiguration* | 56 WKWebViewConfiguration* |
| 57 WKWebViewConfigurationProvider::GetWebViewConfiguration() { | 57 WKWebViewConfigurationProvider::GetWebViewConfiguration() { |
| 58 DCHECK([NSThread isMainThread]); | 58 DCHECK([NSThread isMainThread]); |
| 59 if (!configuration_) { | 59 if (!configuration_) { |
| 60 configuration_.reset([[WKWebViewConfiguration alloc] init]); | 60 configuration_.reset([[WKWebViewConfiguration alloc] init]); |
| 61 if (is_off_the_record_ && base::ios::IsRunningOnIOS9OrLater()) { | 61 if (is_off_the_record_ && base::ios::IsRunningOnIOS9OrLater()) { |
| 62 // WKWebsiteDataStore is iOS9 only. | 62 // WKWebsiteDataStore is iOS9 only. |
| 63 [configuration_ | 63 [configuration_ |
| 64 setWebsiteDataStore:[WKWebsiteDataStore nonPersistentDataStore]]; | 64 setWebsiteDataStore:[WKWebsiteDataStore nonPersistentDataStore]]; |
| 65 } | 65 } |
| 66 // TODO(crbug.com/620878) Remove these guards after moving to iOS10 SDK. |
| 67 #if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 |
| 68 if (base::ios::IsRunningOnIOS10OrLater()) { |
| 69 [configuration_ setDataDetectorTypes:WKDataDetectorTypePhoneNumber]; |
| 70 } |
| 71 #endif |
| 66 // setJavaScriptCanOpenWindowsAutomatically is required to support popups. | 72 // setJavaScriptCanOpenWindowsAutomatically is required to support popups. |
| 67 [[configuration_ preferences] setJavaScriptCanOpenWindowsAutomatically:YES]; | 73 [[configuration_ preferences] setJavaScriptCanOpenWindowsAutomatically:YES]; |
| 68 [[configuration_ userContentController] | 74 [[configuration_ userContentController] |
| 69 addUserScript:InternalGetEarlyPageScript()]; | 75 addUserScript:InternalGetEarlyPageScript()]; |
| 70 } | 76 } |
| 71 // Prevent callers from changing the internals of configuration. | 77 // Prevent callers from changing the internals of configuration. |
| 72 return [[configuration_ copy] autorelease]; | 78 return [[configuration_ copy] autorelease]; |
| 73 } | 79 } |
| 74 | 80 |
| 75 CRWWKScriptMessageRouter* | 81 CRWWKScriptMessageRouter* |
| (...skipping 18 matching lines...) Expand all Loading... |
| 94 configuration_.reset(); | 100 configuration_.reset(); |
| 95 router_.reset(); | 101 router_.reset(); |
| 96 // Make sure that no one retains configuration, router, processPool. | 102 // Make sure that no one retains configuration, router, processPool. |
| 97 DCHECK(!weak_configuration); | 103 DCHECK(!weak_configuration); |
| 98 DCHECK(!weak_router); | 104 DCHECK(!weak_router); |
| 99 // TODO(crbug.com/522672): Enable this DCHECK. | 105 // TODO(crbug.com/522672): Enable this DCHECK. |
| 100 // DCHECK(!weak_process_pool); | 106 // DCHECK(!weak_process_pool); |
| 101 } | 107 } |
| 102 | 108 |
| 103 } // namespace web | 109 } // namespace web |
| OLD | NEW |