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

Side by Side Diff: ios/web/web_state/web_view_internal_creation_util.mm

Issue 2144933002: Fix the T-Rex easter egg on iOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 5 months 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
OLDNEW
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/web_state/web_view_internal_creation_util.h" 5 #import "ios/web/web_state/web_view_internal_creation_util.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/sys_string_conversions.h" 8 #include "base/strings/sys_string_conversions.h"
9 #include "ios/web/public/web_client.h" 9 #include "ios/web/public/web_client.h"
10 #import "ios/web/web_state/ui/wk_web_view_configuration_provider.h" 10 #import "ios/web/web_state/ui/wk_web_view_configuration_provider.h"
(...skipping 15 matching lines...) Expand all
26 DCHECK_EQ([config_provider.GetWebViewConfiguration() processPool], 26 DCHECK_EQ([config_provider.GetWebViewConfiguration() processPool],
27 [configuration processPool]); 27 [configuration processPool]);
28 } 28 }
29 29
30 } // namespace 30 } // namespace
31 31
32 WKWebView* CreateWKWebView(CGRect frame, 32 WKWebView* CreateWKWebView(CGRect frame,
33 WKWebViewConfiguration* configuration, 33 WKWebViewConfiguration* configuration,
34 BrowserState* browser_state, 34 BrowserState* browser_state,
35 BOOL use_desktop_user_agent) { 35 BOOL use_desktop_user_agent) {
36 WKWebView* web_view = CreateWKWebView(frame, configuration, browser_state); 36 VerifyWKWebViewCreationPreConditions(browser_state, configuration);
37 web_view.customUserAgent = base::SysUTF8ToNSString( 37
38 web::GetWebClient()->GetUserAgent(use_desktop_user_agent)); 38 GetWebClient()->PreWebViewCreation();
39 WKWebView* web_view =
40 [[WKWebView alloc] initWithFrame:frame configuration:configuration];
41
42 // By default the web view uses a very sluggish scroll speed. Set it to a more
43 // reasonable value.
44 web_view.scrollView.decelerationRate = UIScrollViewDecelerationRateNormal;
45
46 // Starting in iOS10, |allowsLinkPreview| defaults to YES. This should be
47 // disabled since the default implementation will open the link in Safari.
48 // TODO(crbug.com/622746): Remove once web// link preview implementation is
49 // created.
50 web_view.allowsLinkPreview = NO;
51
39 return web_view; 52 return web_view;
40 } 53 }
41 54
42 WKWebView* CreateWKWebView(CGRect frame, 55 WKWebView* CreateWKWebView(CGRect frame,
43 WKWebViewConfiguration* configuration, 56 WKWebViewConfiguration* configuration,
44 BrowserState* browser_state) { 57 BrowserState* browser_state) {
45 VerifyWKWebViewCreationPreConditions(browser_state, configuration); 58 BOOL use_desktop_user_agent = NO;
46 59 return CreateWKWebView(frame, configuration, browser_state,
47 GetWebClient()->PreWebViewCreation(); 60 use_desktop_user_agent);
48 WKWebView* result =
49 [[WKWebView alloc] initWithFrame:frame configuration:configuration];
50
51 // By default the web view uses a very sluggish scroll speed. Set it to a more
52 // reasonable value.
53 result.scrollView.decelerationRate = UIScrollViewDecelerationRateNormal;
54
55 // Starting in iOS10, |allowsLinkPreview| defaults to YES. This should be
56 // disabled since the default implementation will open the link in Safari.
57 // TODO(crbug.com/622746): Remove once web// link preview implementation is
58 // created.
59 result.allowsLinkPreview = NO;
60
61 return result;
62 } 61 }
63 62
64 } // namespace web 63 } // namespace web
OLDNEW
« components/neterror/resources/offline.js ('K') | « components/neterror/resources/offline.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698