| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #import "ios/web/public/test/test_web_client.h" |
| 6 |
| 7 #include "base/strings/sys_string_conversions.h" |
| 8 |
| 9 namespace web { |
| 10 |
| 11 TestWebClient::TestWebClient() |
| 12 : early_page_scripts_([[NSMutableDictionary alloc] init]) { |
| 13 } |
| 14 |
| 15 TestWebClient::~TestWebClient() { |
| 16 } |
| 17 |
| 18 std::string TestWebClient::GetUserAgent(bool desktop_user_agent) const { |
| 19 return desktop_user_agent ? desktop_user_agent_ : user_agent_; |
| 20 } |
| 21 |
| 22 void TestWebClient::SetUserAgent(const std::string& user_agent, |
| 23 bool is_desktop_user_agent) { |
| 24 if (is_desktop_user_agent) |
| 25 desktop_user_agent_ = user_agent; |
| 26 else |
| 27 user_agent_ = user_agent; |
| 28 } |
| 29 |
| 30 NSString* TestWebClient::GetEarlyPageScript( |
| 31 web::WebViewType web_view_type) const { |
| 32 NSString* result = [early_page_scripts_ objectForKey:@(web_view_type)]; |
| 33 return result ? result : @""; |
| 34 } |
| 35 |
| 36 void TestWebClient::SetEarlyPageScript(NSString* page_script, |
| 37 web::WebViewType web_view_type) { |
| 38 [early_page_scripts_ setObject:page_script forKey:@(web_view_type)]; |
| 39 } |
| 40 |
| 41 } // namespace web |
| OLD | NEW |