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

Unified Diff: android_webview/common/aw_content_client.cc

Issue 11017024: Implement AwContentsClient and remove dependency on chrome/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: android_webview/common/aw_content_client.cc
diff --git a/android_webview/common/aw_content_client.cc b/android_webview/common/aw_content_client.cc
new file mode 100644
index 0000000000000000000000000000000000000000..adddde7386a6612f18079334290d755a0504c97f
--- /dev/null
+++ b/android_webview/common/aw_content_client.cc
@@ -0,0 +1,76 @@
+// Copyright (c) 2012 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.
+
+#include "android_webview/common/aw_content_client.h"
+
+#include "base/basictypes.h"
+#include "ui/base/l10n/l10n_util.h"
+#include "ui/base/resource/resource_bundle.h"
+#include "webkit/user_agent/user_agent_util.h"
+
+namespace android_webview {
+
+void AwContentClient::SetActiveURL(const GURL& url) {
+ // TODO(boliu): Implement. This method is used set the url that is used in
+ // crash reporting in case this process crashes.
+}
+
+void AwContentClient::SetGpuInfo(const content::GPUInfo& gpu_info) {
+ // No-op. Android WebView does not have gpu process.
+}
+
joth 2012/10/09 02:00:47 on the general point - it's by design that the con
boliu 2012/10/09 18:01:47 Removes all no-op or default behavior methods from
+void AwContentClient::AddPepperPlugins(
+ std::vector<content::PepperPluginInfo>* plugins) {
+ // No-op. Android Webview does not support plugins.
+}
+
+void AwContentClient::AddNPAPIPlugins(
+ webkit::npapi::PluginList* plugin_list) {
+ // No-op. Android Webview does not support plugins.
+}
+
+void AwContentClient::AddAdditionalSchemes(
+ std::vector<std::string>* standard_schemes,
+ std::vector<std::string>* savable_schemes) {
+ // TODO(boliu): Implement. Maybe register things like content:// and app
+ // asset files here?
joth 2012/10/09 02:00:47 assets etc, get bundled under the file: scheme so
mnaganov (inactive) 2012/10/09 08:57:20 I agree, I don't see any clear benefit of having c
boliu 2012/10/09 18:01:47 No-op, so removing.
+}
+
+bool AwContentClient::HasWebUIScheme(const GURL& url) const {
+ // Android WebView does not use WebUIs.
+ return false;
+}
+
+bool AwContentClient::CanHandleWhileSwappedOut(const IPC::Message& message) {
+ // Android WebView is single process, so there is no swapped out renderer.
+ return false;
joth 2012/10/09 02:00:47 for thoroughness, we make an effort to implement t
boliu 2012/10/09 18:01:47 So this is only for embedder (ie aw) messages, and
+}
+
+std::string AwContentClient::GetProduct() const {
+ // Product part of user agent.
+ // TODO(boliu): Should we return a ChromeWebView/<version> or similar?
boliu 2012/10/08 22:43:43 This is not breaking any tests because webview use
joth 2012/10/09 02:00:47 certainly not ChromeWebiew - see b/6381306 for lo
mnaganov (inactive) 2012/10/09 08:57:20 In our implementation, we always supply user agent
boliu 2012/10/09 18:01:47 I see Version/4.0 is hardcoded in ContentSettings:
mnaganov (inactive) 2012/10/10 08:51:45 Looks fine, thanks!
+ return std::string();
+}
+
+std::string AwContentClient::GetUserAgent() const {
+ return webkit_glue::BuildUserAgentFromProduct(GetProduct());
+}
+
+string16 AwContentClient::GetLocalizedString(int message_id) const {
+ // TODO(boliu): Used only by WebKit, so only bundle those resources for
+ // Android WebView.
+ return l10n_util::GetStringUTF16(message_id);
+}
+
+base::StringPiece AwContentClient::GetDataResource(
+ int resource_id,
+ ui::ScaleFactor scale_factor) const {
+ // TODO(boliu): Used only by WebKit, so only bundle those resources for
+ // Android WebView.
+ return ResourceBundle::GetSharedInstance().GetRawDataResource(
+ resource_id, scale_factor);
+}
+
+} // namespace android_webview
+

Powered by Google App Engine
This is Rietveld 408576698