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

Side by Side Diff: ios/web_view/internal/web_view_web_client.mm

Issue 2894483003: Initialize ios/web_view translate with a system-wide URLRequestContext. (Closed)
Patch Set: Cleanup. Created 3 years, 6 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_view/internal/web_view_web_client.h" 5 #import "ios/web_view/internal/web_view_web_client.h"
6 6
7 #include "base/strings/sys_string_conversions.h" 7 #include "base/strings/sys_string_conversions.h"
8 #include "ios/web/public/user_agent.h" 8 #include "ios/web/public/user_agent.h"
9 #include "ios/web_view/internal/web_view_browser_state.h" 9 #include "ios/web_view/internal/web_view_browser_state.h"
10 #import "ios/web_view/internal/web_view_early_page_script_provider.h" 10 #import "ios/web_view/internal/web_view_early_page_script_provider.h"
11 #import "ios/web_view/internal/web_view_web_main_parts.h" 11 #import "ios/web_view/internal/web_view_web_main_parts.h"
12 #include "ios/web_view/public/cwv_web_view.h" 12 #include "ios/web_view/public/cwv_web_view.h"
13 13
14 #if !defined(__has_feature) || !__has_feature(objc_arc) 14 #if !defined(__has_feature) || !__has_feature(objc_arc)
15 #error "This file requires ARC support." 15 #error "This file requires ARC support."
16 #endif 16 #endif
17 17
18 namespace ios_web_view { 18 namespace ios_web_view {
19 19
20 WebViewWebClient::WebViewWebClient() : web_main_parts_(nullptr) {} 20 WebViewWebClient::WebViewWebClient() {}
21 21
22 WebViewWebClient::~WebViewWebClient() = default; 22 WebViewWebClient::~WebViewWebClient() = default;
23 23
24 web::WebMainParts* WebViewWebClient::CreateWebMainParts() { 24 web::WebMainParts* WebViewWebClient::CreateWebMainParts() {
25 web_main_parts_ = new WebViewWebMainParts(); 25 return new WebViewWebMainParts();
26 return web_main_parts_;
27 } 26 }
28 27
29 std::string WebViewWebClient::GetProduct() const { 28 std::string WebViewWebClient::GetProduct() const {
30 return base::SysNSStringToUTF8([CWVWebView userAgentProduct]); 29 return base::SysNSStringToUTF8([CWVWebView userAgentProduct]);
31 } 30 }
32 31
33 std::string WebViewWebClient::GetUserAgent(web::UserAgentType type) const { 32 std::string WebViewWebClient::GetUserAgent(web::UserAgentType type) const {
34 return web::BuildUserAgentFromProduct(GetProduct()); 33 return web::BuildUserAgentFromProduct(GetProduct());
35 } 34 }
36 35
37 NSString* WebViewWebClient::GetEarlyPageScript( 36 NSString* WebViewWebClient::GetEarlyPageScript(
38 web::BrowserState* browser_state) const { 37 web::BrowserState* browser_state) const {
39 return WebViewEarlyPageScriptProvider::FromBrowserState(browser_state) 38 return WebViewEarlyPageScriptProvider::FromBrowserState(browser_state)
40 .GetScript(); 39 .GetScript();
41 } 40 }
42 41
43 } // namespace ios_web_view 42 } // namespace ios_web_view
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698