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

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

Issue 2239773002: Annotates functions returning retained objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removes functions that are not in headers AND not in ios code. Created 4 years, 4 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 14 matching lines...) Expand all
25 WKWebViewConfigurationProvider::FromBrowserState(browser_state); 25 WKWebViewConfigurationProvider::FromBrowserState(browser_state);
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) NS_RETURNS_RETAINED {
36 VerifyWKWebViewCreationPreConditions(browser_state, configuration); 36 VerifyWKWebViewCreationPreConditions(browser_state, configuration);
37 37
38 GetWebClient()->PreWebViewCreation(); 38 GetWebClient()->PreWebViewCreation();
39 WKWebView* web_view = 39 WKWebView* web_view =
40 [[WKWebView alloc] initWithFrame:frame configuration:configuration]; 40 [[WKWebView alloc] initWithFrame:frame configuration:configuration];
41 41
42 // Set the user agent. 42 // Set the user agent.
43 web_view.customUserAgent = base::SysUTF8ToNSString( 43 web_view.customUserAgent = base::SysUTF8ToNSString(
44 web::GetWebClient()->GetUserAgent(use_desktop_user_agent)); 44 web::GetWebClient()->GetUserAgent(use_desktop_user_agent));
45 45
46 // By default the web view uses a very sluggish scroll speed. Set it to a more 46 // By default the web view uses a very sluggish scroll speed. Set it to a more
47 // reasonable value. 47 // reasonable value.
48 web_view.scrollView.decelerationRate = UIScrollViewDecelerationRateNormal; 48 web_view.scrollView.decelerationRate = UIScrollViewDecelerationRateNormal;
49 49
50 // Starting in iOS10, |allowsLinkPreview| defaults to YES. This should be 50 // Starting in iOS10, |allowsLinkPreview| defaults to YES. This should be
51 // disabled since the default implementation will open the link in Safari. 51 // disabled since the default implementation will open the link in Safari.
52 // TODO(crbug.com/622746): Remove once web// link preview implementation is 52 // TODO(crbug.com/622746): Remove once web// link preview implementation is
53 // created. 53 // created.
54 web_view.allowsLinkPreview = NO; 54 web_view.allowsLinkPreview = NO;
55 55
56 return web_view; 56 return web_view;
57 } 57 }
58 58
59 WKWebView* CreateWKWebView(CGRect frame, 59 WKWebView* CreateWKWebView(CGRect frame,
60 WKWebViewConfiguration* configuration, 60 WKWebViewConfiguration* configuration,
61 BrowserState* browser_state) { 61 BrowserState* browser_state) NS_RETURNS_RETAINED {
62 BOOL use_desktop_user_agent = NO; 62 BOOL use_desktop_user_agent = NO;
63 return CreateWKWebView(frame, configuration, browser_state, 63 return CreateWKWebView(frame, configuration, browser_state,
64 use_desktop_user_agent); 64 use_desktop_user_agent);
65 } 65 }
66 66
67 } // namespace web 67 } // namespace web
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698