forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweb_view_creation_util.mm
35 lines (27 loc) · 1.17 KB
/
web_view_creation_util.mm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "ios/web/public/web_view_creation_util.h"
#include "base/logging.h"
#include "ios/web/public/user_agent.h"
#import "ios/web/web_state/ui/wk_web_view_configuration_provider.h"
#import "ios/web/web_state/web_view_internal_creation_util.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace web {
WKWebView* BuildWKWebView(CGRect frame, BrowserState* browser_state) {
return BuildWKWebViewWithCustomContextMenu(frame, browser_state, nil);
}
WKWebView* BuildWKWebViewWithCustomContextMenu(
CGRect frame,
BrowserState* browser_state,
id<CRWContextMenuDelegate> context_menu_delegate) {
DCHECK(browser_state);
WKWebViewConfigurationProvider& config_provider =
WKWebViewConfigurationProvider::FromBrowserState(browser_state);
return BuildWKWebView(frame, config_provider.GetWebViewConfiguration(),
browser_state, UserAgentType::MOBILE,
context_menu_delegate);
}
} // namespace web