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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 : is_off_the_record_(is_off_the_record) {} | 51 : is_off_the_record_(is_off_the_record) {} |
52 | 52 |
53 WKWebViewConfigurationProvider::~WKWebViewConfigurationProvider() { | 53 WKWebViewConfigurationProvider::~WKWebViewConfigurationProvider() { |
54 } | 54 } |
55 | 55 |
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_) { |
62 // WKWebsiteDataStore is iOS9 only. | |
63 [configuration_ | 62 [configuration_ |
64 setWebsiteDataStore:[WKWebsiteDataStore nonPersistentDataStore]]; | 63 setWebsiteDataStore:[WKWebsiteDataStore nonPersistentDataStore]]; |
65 } | 64 } |
66 // TODO(crbug.com/620878) Remove these guards after moving to iOS10 SDK. | 65 // 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 | 66 #if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 |
68 if (base::ios::IsRunningOnIOS10OrLater()) { | 67 if (base::ios::IsRunningOnIOS10OrLater()) { |
69 [configuration_ setDataDetectorTypes:WKDataDetectorTypeCalendarEvent | | 68 [configuration_ setDataDetectorTypes:WKDataDetectorTypeCalendarEvent | |
70 WKDataDetectorTypeFlightNumber | | 69 WKDataDetectorTypeFlightNumber | |
71 WKDataDetectorTypePhoneNumber]; | 70 WKDataDetectorTypePhoneNumber]; |
72 } | 71 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 configuration_.reset(); | 104 configuration_.reset(); |
106 router_.reset(); | 105 router_.reset(); |
107 // Make sure that no one retains configuration, router, processPool. | 106 // Make sure that no one retains configuration, router, processPool. |
108 DCHECK(!weak_configuration); | 107 DCHECK(!weak_configuration); |
109 DCHECK(!weak_router); | 108 DCHECK(!weak_router); |
110 // TODO(crbug.com/522672): Enable this DCHECK. | 109 // TODO(crbug.com/522672): Enable this DCHECK. |
111 // DCHECK(!weak_process_pool); | 110 // DCHECK(!weak_process_pool); |
112 } | 111 } |
113 | 112 |
114 } // namespace web | 113 } // namespace web |
OLD | NEW |