summaryrefslogtreecommitdiffstats
path: root/android_webview/browser
diff options
context:
space:
mode:
Diffstat (limited to 'android_webview/browser')
-rw-r--r--android_webview/browser/aw_content_browser_client.cc14
-rw-r--r--android_webview/browser/aw_content_browser_client.h7
-rw-r--r--android_webview/browser/aw_web_preferences_populater.cc9
-rw-r--r--android_webview/browser/aw_web_preferences_populater.h27
-rw-r--r--android_webview/browser/jni_dependency_factory.h2
5 files changed, 59 insertions, 0 deletions
diff --git a/android_webview/browser/aw_content_browser_client.cc b/android_webview/browser/aw_content_browser_client.cc
index decdb73..97bdf1f 100644
--- a/android_webview/browser/aw_content_browser_client.cc
+++ b/android_webview/browser/aw_content_browser_client.cc
@@ -9,6 +9,7 @@
#include "android_webview/browser/aw_contents_client_bridge_base.h"
#include "android_webview/browser/aw_cookie_access_policy.h"
#include "android_webview/browser/aw_quota_permission_context.h"
+#include "android_webview/browser/aw_web_preferences_populater.h"
#include "android_webview/browser/jni_dependency_factory.h"
#include "android_webview/browser/net_disk_cache_remover.h"
#include "android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.h"
@@ -19,12 +20,14 @@
#include "content/public/browser/child_process_security_policy.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
+#include "content/public/browser/web_contents.h"
#include "content/public/common/url_constants.h"
#include "grit/ui_resources.h"
#include "net/android/network_library.h"
#include "net/ssl/ssl_info.h"
#include "ui/base/l10n/l10n_util_android.h"
#include "ui/base/resource/resource_bundle.h"
+#include "webkit/common/webpreferences.h"
namespace android_webview {
namespace {
@@ -387,4 +390,15 @@ bool AwContentBrowserClient::AllowPepperSocketAPI(
return false;
}
+void AwContentBrowserClient::OverrideWebkitPrefs(content::RenderViewHost* rvh,
+ const GURL& url,
+ WebPreferences* web_prefs) {
+ if (!preferences_populater_.get()) {
+ preferences_populater_ = make_scoped_ptr(native_factory_->
+ CreateWebPreferencesPopulater());
+ }
+ preferences_populater_->PopulateFor(
+ content::WebContents::FromRenderViewHost(rvh), web_prefs);
+}
+
} // namespace android_webview
diff --git a/android_webview/browser/aw_content_browser_client.h b/android_webview/browser/aw_content_browser_client.h
index 8321bcc..afa29cb 100644
--- a/android_webview/browser/aw_content_browser_client.h
+++ b/android_webview/browser/aw_content_browser_client.h
@@ -5,12 +5,15 @@
#ifndef ANDROID_WEBVIEW_LIB_AW_CONTENT_BROWSER_CLIENT_H_
#define ANDROID_WEBVIEW_LIB_AW_CONTENT_BROWSER_CLIENT_H_
+#include "android_webview/browser/aw_web_preferences_populater.h"
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "content/public/browser/content_browser_client.h"
#include "net/url_request/url_request_job_factory.h"
+struct WebPreferences;
+
namespace android_webview {
class AwBrowserContext;
@@ -150,11 +153,15 @@ class AwContentBrowserClient : public content::ContentBrowserClient {
const GURL& url,
bool private_api,
const content::SocketPermissionRequest* params) OVERRIDE;
+ virtual void OverrideWebkitPrefs(content::RenderViewHost* rvh,
+ const GURL& url,
+ WebPreferences* web_prefs) OVERRIDE;
private:
// Android WebView currently has a single global (non-off-the-record) browser
// context.
scoped_ptr<AwBrowserContext> browser_context_;
+ scoped_ptr<AwWebPreferencesPopulater> preferences_populater_;
JniDependencyFactory* native_factory_;
diff --git a/android_webview/browser/aw_web_preferences_populater.cc b/android_webview/browser/aw_web_preferences_populater.cc
new file mode 100644
index 0000000..5f37936
--- /dev/null
+++ b/android_webview/browser/aw_web_preferences_populater.cc
@@ -0,0 +1,9 @@
+// Copyright 2013 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/browser/aw_web_preferences_populater.h"
+
+namespace android_webview {
+AwWebPreferencesPopulater::~AwWebPreferencesPopulater() {}
+} // namespace android_webview
diff --git a/android_webview/browser/aw_web_preferences_populater.h b/android_webview/browser/aw_web_preferences_populater.h
new file mode 100644
index 0000000..4f50694
--- /dev/null
+++ b/android_webview/browser/aw_web_preferences_populater.h
@@ -0,0 +1,27 @@
+// Copyright 2013 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.
+
+#ifndef ANDROID_WEBVIEW_BROWSER_AW_WEB_PREFERENCES_POPULATER_H_
+#define ANDROID_WEBVIEW_BROWSER_AW_WEB_PREFERENCES_POPULATER_H_
+
+struct WebPreferences;
+
+namespace content {
+class WebContents;
+}
+
+namespace android_webview {
+
+// Empty base class so this can be destroyed by AwContentBrowserClient.
+class AwWebPreferencesPopulater {
+ public:
+ virtual ~AwWebPreferencesPopulater();
+
+ virtual void PopulateFor(content::WebContents* web_contents,
+ WebPreferences* web_prefs) = 0;
+};
+
+} // namespace android_webview
+
+#endif // ANDROID_WEBVIEW_BROWSER_AW_WEB_PREFERENCES_POPULATER_H_
diff --git a/android_webview/browser/jni_dependency_factory.h b/android_webview/browser/jni_dependency_factory.h
index 4adcc25..e6e0ea9 100644
--- a/android_webview/browser/jni_dependency_factory.h
+++ b/android_webview/browser/jni_dependency_factory.h
@@ -15,6 +15,7 @@ namespace android_webview {
class AwBrowserContext;
class AwQuotaManagerBridge;
+class AwWebPreferencesPopulater;
// Used to create instances of objects under native that are used in browser.
class JniDependencyFactory {
@@ -27,6 +28,7 @@ class JniDependencyFactory {
AwBrowserContext* browser_context) = 0;
virtual content::WebContentsViewDelegate* CreateViewDelegate(
content::WebContents* web_contents) = 0;
+ virtual AwWebPreferencesPopulater* CreateWebPreferencesPopulater() = 0;
};
} // namespace android_webview