OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "android_webview/common/aw_content_client.h" | 5 #include "android_webview/common/aw_content_client.h" |
6 | 6 |
7 #include "android_webview/common/aw_version_info_values.h" | 7 #include "android_webview/common/aw_version_info_values.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "content/public/common/content_switches.h" | 9 #include "content/public/common/content_switches.h" |
10 #include "content/public/common/user_agent.h" | 10 #include "content/public/common/user_agent.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 std::string AwContentClient::GetUserAgent() const { | 42 std::string AwContentClient::GetUserAgent() const { |
43 return android_webview::GetUserAgent(); | 43 return android_webview::GetUserAgent(); |
44 } | 44 } |
45 | 45 |
46 base::string16 AwContentClient::GetLocalizedString(int message_id) const { | 46 base::string16 AwContentClient::GetLocalizedString(int message_id) const { |
47 // TODO(boliu): Used only by WebKit, so only bundle those resources for | 47 // TODO(boliu): Used only by WebKit, so only bundle those resources for |
48 // Android WebView. | 48 // Android WebView. |
49 return l10n_util::GetStringUTF16(message_id); | 49 return l10n_util::GetStringUTF16(message_id); |
50 } | 50 } |
51 | 51 |
| 52 base::string16 AwContentClient::GetLocalizedStringF( |
| 53 int message_id, |
| 54 const base::string16& string0) const { |
| 55 return l10n_util::GetStringFUTF16(message_id, string0); |
| 56 } |
| 57 |
52 base::StringPiece AwContentClient::GetDataResource( | 58 base::StringPiece AwContentClient::GetDataResource( |
53 int resource_id, | 59 int resource_id, |
54 ui::ScaleFactor scale_factor) const { | 60 ui::ScaleFactor scale_factor) const { |
55 // TODO(boliu): Used only by WebKit, so only bundle those resources for | 61 // TODO(boliu): Used only by WebKit, so only bundle those resources for |
56 // Android WebView. | 62 // Android WebView. |
57 return ResourceBundle::GetSharedInstance().GetRawDataResourceForScale( | 63 return ResourceBundle::GetSharedInstance().GetRawDataResourceForScale( |
58 resource_id, scale_factor); | 64 resource_id, scale_factor); |
59 } | 65 } |
60 | 66 |
61 bool AwContentClient::CanSendWhileSwappedOut(const IPC::Message* message) { | 67 bool AwContentClient::CanSendWhileSwappedOut(const IPC::Message* message) { |
62 // For legacy API support we perform a few browser -> renderer synchronous IPC | 68 // For legacy API support we perform a few browser -> renderer synchronous IPC |
63 // messages that block the browser. However, the synchronous IPC replies might | 69 // messages that block the browser. However, the synchronous IPC replies might |
64 // be dropped by the renderer during a swap out, deadlocking the browser. | 70 // be dropped by the renderer during a swap out, deadlocking the browser. |
65 // Because of this we should never drop any synchronous IPC replies. | 71 // Because of this we should never drop any synchronous IPC replies. |
66 return message->type() == IPC_REPLY_ID; | 72 return message->type() == IPC_REPLY_ID; |
67 } | 73 } |
68 | 74 |
69 void AwContentClient::SetGpuInfo(const gpu::GPUInfo& gpu_info) { | 75 void AwContentClient::SetGpuInfo(const gpu::GPUInfo& gpu_info) { |
70 gpu_fingerprint_ = gpu_info.gl_version + '|' + gpu_info.gl_vendor + '|' + | 76 gpu_fingerprint_ = gpu_info.gl_version + '|' + gpu_info.gl_vendor + '|' + |
71 gpu_info.gl_renderer; | 77 gpu_info.gl_renderer; |
72 std::replace_if(gpu_fingerprint_.begin(), gpu_fingerprint_.end(), | 78 std::replace_if(gpu_fingerprint_.begin(), gpu_fingerprint_.end(), |
73 [](char c) { return !::isprint(c); }, '_'); | 79 [](char c) { return !::isprint(c); }, '_'); |
74 } | 80 } |
75 | 81 |
76 } // namespace android_webview | 82 } // namespace android_webview |
OLD | NEW |