blob: 29c477b2dadb03e978ae017a327ef300655b364d [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
10#include "base/android/jni_helper.h"
11#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]9f8797b2013-09-27 00:18:1315struct WebPreferences;
16
[email protected]cbe55d22013-02-14 17:04:3317namespace android_webview {
18
[email protected]3f93980d2013-02-27 20:21:4519class AwRenderViewHostExt;
20
[email protected]cbe55d22013-02-14 17:04:3321class AwSettings : public content::WebContentsObserver {
22 public:
[email protected]9f8797b2013-09-27 00:18:1323 static AwSettings* FromWebContents(content::WebContents* web_contents);
24
[email protected]14a2df0d2013-06-14 23:40:3225 AwSettings(JNIEnv* env, jobject obj, jint web_contents);
[email protected]cbe55d22013-02-14 17:04:3326 virtual ~AwSettings();
27
[email protected]ff022ac2013-05-10 12:45:5228 // Called from Java. Methods with "Locked" suffix require that the settings
29 // access lock is held during their execution.
[email protected]cbe55d22013-02-14 17:04:3330 void Destroy(JNIEnv* env, jobject obj);
[email protected]df432e592013-02-28 21:59:3531 void ResetScrollAndScaleState(JNIEnv* env, jobject obj);
[email protected]ff022ac2013-05-10 12:45:5232 void UpdateEverythingLocked(JNIEnv* env, jobject obj);
33 void UpdateInitialPageScaleLocked(JNIEnv* env, jobject obj);
34 void UpdateUserAgentLocked(JNIEnv* env, jobject obj);
35 void UpdateWebkitPreferencesLocked(JNIEnv* env, jobject obj);
[email protected]efcd66b2013-05-15 08:38:4436 void UpdateFormDataPreferencesLocked(JNIEnv* env, jobject obj);
[email protected]cbe55d22013-02-14 17:04:3337
[email protected]9f8797b2013-09-27 00:18:1338 void PopulateWebPreferences(WebPreferences* web_prefs);
39
[email protected]cbe55d22013-02-14 17:04:3340 private:
[email protected]3f93980d2013-02-27 20:21:4541 AwRenderViewHostExt* GetAwRenderViewHostExt();
[email protected]693c1832013-04-25 15:10:0542 void UpdateEverything();
[email protected]cbe55d22013-02-14 17:04:3343
44 // WebContentsObserver overrides:
45 virtual void RenderViewCreated(
46 content::RenderViewHost* render_view_host) OVERRIDE;
[email protected]14a2df0d2013-06-14 23:40:3247 virtual void WebContentsDestroyed(
48 content::WebContents* web_contents) OVERRIDE;
[email protected]cbe55d22013-02-14 17:04:3349
[email protected]693c1832013-04-25 15:10:0550 JavaObjectWeakGlobalRef aw_settings_;
[email protected]cbe55d22013-02-14 17:04:3351};
52
53bool RegisterAwSettings(JNIEnv* env);
54
55} // namespace android_webview
56
57#endif // ANDROID_WEBVIEW_NATIVE_AW_SETTINGS_H_