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

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

Issue 2503033003: Remove all enabled data detectors. (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
Eugene But (OOO till 7-30) 2016/11/15 23:19:51 Do we still need this include?
michaeldo 2016/11/15 23:53:22 we don't!
11 #import "base/ios/weak_nsobject.h" 11 #import "base/ios/weak_nsobject.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "ios/web/public/browser_state.h" 13 #include "ios/web/public/browser_state.h"
14 #import "ios/web/web_state/js/page_script_util.h" 14 #import "ios/web/web_state/js/page_script_util.h"
15 #import "ios/web/web_state/ui/crw_wk_script_message_router.h" 15 #import "ios/web/web_state/ui/crw_wk_script_message_router.h"
16 16
17 namespace web { 17 namespace web {
18 18
19 namespace { 19 namespace {
20 // A key used to associate a WKWebViewConfigurationProvider with a BrowserState. 20 // A key used to associate a WKWebViewConfigurationProvider with a BrowserState.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_) { 61 if (is_off_the_record_) {
62 [configuration_ 62 [configuration_
63 setWebsiteDataStore:[WKWebsiteDataStore nonPersistentDataStore]]; 63 setWebsiteDataStore:[WKWebsiteDataStore nonPersistentDataStore]];
64 } 64 }
65 // TODO(crbug.com/620878) Remove these guards after moving to iOS10 SDK.
66 #if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
67 if (base::ios::IsRunningOnIOS10OrLater()) {
68 [configuration_ setDataDetectorTypes:WKDataDetectorTypeCalendarEvent |
69 WKDataDetectorTypeFlightNumber];
70 }
71 #endif
72 // API available on iOS 9, although doesn't appear to enable inline playback 65 // API available on iOS 9, although doesn't appear to enable inline playback
73 // Works as intended on iOS 10+ 66 // Works as intended on iOS 10+
74 [configuration_ setAllowsInlineMediaPlayback:YES]; 67 [configuration_ setAllowsInlineMediaPlayback:YES];
75 // setJavaScriptCanOpenWindowsAutomatically is required to support popups. 68 // setJavaScriptCanOpenWindowsAutomatically is required to support popups.
76 [[configuration_ preferences] setJavaScriptCanOpenWindowsAutomatically:YES]; 69 [[configuration_ preferences] setJavaScriptCanOpenWindowsAutomatically:YES];
77 [[configuration_ userContentController] 70 [[configuration_ userContentController]
78 addUserScript:InternalGetEarlyPageScript()]; 71 addUserScript:InternalGetEarlyPageScript()];
79 } 72 }
80 // Prevent callers from changing the internals of configuration. 73 // Prevent callers from changing the internals of configuration.
81 return [[configuration_ copy] autorelease]; 74 return [[configuration_ copy] autorelease];
(...skipping 21 matching lines...) Expand all
103 configuration_.reset(); 96 configuration_.reset();
104 router_.reset(); 97 router_.reset();
105 // Make sure that no one retains configuration, router, processPool. 98 // Make sure that no one retains configuration, router, processPool.
106 DCHECK(!weak_configuration); 99 DCHECK(!weak_configuration);
107 DCHECK(!weak_router); 100 DCHECK(!weak_router);
108 // TODO(crbug.com/522672): Enable this DCHECK. 101 // TODO(crbug.com/522672): Enable this DCHECK.
109 // DCHECK(!weak_process_pool); 102 // DCHECK(!weak_process_pool);
110 } 103 }
111 104
112 } // namespace web 105 } // namespace web
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698