Chromium Code Reviews| 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/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 Loading... | |
| 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 | |
| 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 // Set the user agent. | |
| 37 web_view.customUserAgent = base::SysUTF8ToNSString( | 47 web_view.customUserAgent = base::SysUTF8ToNSString( |
| 38 web::GetWebClient()->GetUserAgent(use_desktop_user_agent)); | 48 web::GetWebClient()->GetUserAgent(use_desktop_user_agent)); |
| 49 | |
| 39 return web_view; | 50 return web_view; |
| 40 } | 51 } |
| 41 | 52 |
| 42 WKWebView* CreateWKWebView(CGRect frame, | 53 WKWebView* CreateWKWebView(CGRect frame, |
| 43 WKWebViewConfiguration* configuration, | 54 WKWebViewConfiguration* configuration, |
| 44 BrowserState* browser_state) { | 55 BrowserState* browser_state) { |
| 45 VerifyWKWebViewCreationPreConditions(browser_state, configuration); | 56 return CreateWKWebView(frame, configuration, browser_state, NO); |
|
Eugene But (OOO till 7-30)
2016/07/13 05:28:57
Optional NIT: /* use_desktop_user_agent */ or crea
kkhorimoto
2016/07/13 17:54:53
Done.
| |
| 46 | |
| 47 GetWebClient()->PreWebViewCreation(); | |
| 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 return result; | |
| 56 } | 57 } |
| 57 | 58 |
| 58 } // namespace web | 59 } // namespace web |
| OLD | NEW |