blob: 801448978ae27e436d7fbced0134c12791d402bd [file] [log] [blame]
[email protected]cbe55d22013-02-14 17:04:331// Copyright (c) 2013 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#ifndef ANDROID_WEBVIEW_NATIVE_AW_SETTINGS_H_
6#define ANDROID_WEBVIEW_NATIVE_AW_SETTINGS_H_
7
8#include <jni.h>
9
[email protected]6a718ab2014-04-23 20:01:2010#include "base/android/jni_weak_ref.h"
[email protected]cbe55d22013-02-14 17:04:3311#include "base/android/scoped_java_ref.h"
[email protected]693c1832013-04-25 15:10:0512#include "base/memory/scoped_ptr.h"
[email protected]cbe55d22013-02-14 17:04:3313#include "content/public/browser/web_contents_observer.h"
14
[email protected]b3a97b52014-07-09 06:25:0515namespace content{
[email protected]9f8797b2013-09-27 00:18:1316struct WebPreferences;
[email protected]b3a97b52014-07-09 06:25:0517}
[email protected]9f8797b2013-09-27 00:18:1318
[email protected]cbe55d22013-02-14 17:04:3319namespace android_webview {
20
[email protected]3f93980d2013-02-27 20:21:4521class AwRenderViewHostExt;
22
[email protected]cbe55d22013-02-14 17:04:3323class AwSettings : public content::WebContentsObserver {
24 public:
[email protected]9f8797b2013-09-27 00:18:1325 static AwSettings* FromWebContents(content::WebContents* web_contents);
26
dtrainor25ee0c3f2015-01-27 20:15:5327 AwSettings(JNIEnv* env, jobject obj, content::WebContents* web_contents);
dcheng9b4dd1aa2015-02-04 02:56:5428 ~AwSettings() override;
[email protected]cbe55d22013-02-14 17:04:3329
[email protected]ff022ac2013-05-10 12:45:5230 // Called from Java. Methods with "Locked" suffix require that the settings
31 // access lock is held during their execution.
torne5728d852015-12-04 14:10:1132 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj);
33 void PopulateWebPreferencesLocked(
34 JNIEnv* env,
35 const base::android::JavaParamRef<jobject>& obj,
36 jlong web_prefs);
37 void ResetScrollAndScaleState(
38 JNIEnv* env,
39 const base::android::JavaParamRef<jobject>& obj);
40 void UpdateEverythingLocked(JNIEnv* env,
41 const base::android::JavaParamRef<jobject>& obj);
42 void UpdateInitialPageScaleLocked(
43 JNIEnv* env,
44 const base::android::JavaParamRef<jobject>& obj);
45 void UpdateUserAgentLocked(JNIEnv* env,
46 const base::android::JavaParamRef<jobject>& obj);
47 void UpdateWebkitPreferencesLocked(
48 JNIEnv* env,
49 const base::android::JavaParamRef<jobject>& obj);
50 void UpdateFormDataPreferencesLocked(
51 JNIEnv* env,
52 const base::android::JavaParamRef<jobject>& obj);
53 void UpdateRendererPreferencesLocked(
54 JNIEnv* env,
55 const base::android::JavaParamRef<jobject>& obj);
56 void UpdateOffscreenPreRasterLocked(
57 JNIEnv* env,
58 const base::android::JavaParamRef<jobject>& obj);
[email protected]cbe55d22013-02-14 17:04:3359
[email protected]b3a97b52014-07-09 06:25:0560 void PopulateWebPreferences(content::WebPreferences* web_prefs);
[email protected]9f8797b2013-09-27 00:18:1361
[email protected]cbe55d22013-02-14 17:04:3362 private:
[email protected]3f93980d2013-02-27 20:21:4563 AwRenderViewHostExt* GetAwRenderViewHostExt();
[email protected]693c1832013-04-25 15:10:0564 void UpdateEverything();
[email protected]cbe55d22013-02-14 17:04:3365
66 // WebContentsObserver overrides:
husha6956642015-12-17 19:06:4067 void RenderViewHostChanged(content::RenderViewHost* old_host,
68 content::RenderViewHost* new_host) override;
dcheng9b4dd1aa2015-02-04 02:56:5469 void WebContentsDestroyed() override;
[email protected]cbe55d22013-02-14 17:04:3370
[email protected]2fa47112014-04-24 08:34:4171 bool renderer_prefs_initialized_;
72
[email protected]693c1832013-04-25 15:10:0573 JavaObjectWeakGlobalRef aw_settings_;
[email protected]cbe55d22013-02-14 17:04:3374};
75
76bool RegisterAwSettings(JNIEnv* env);
77
78} // namespace android_webview
79
80#endif // ANDROID_WEBVIEW_NATIVE_AW_SETTINGS_H_