1 // 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.
5 #ifndef ANDROID_WEBVIEW_NATIVE_AW_SETTINGS_H_
6 #define ANDROID_WEBVIEW_NATIVE_AW_SETTINGS_H_
10 #include "base/android/jni_helper.h"
11 #include "base/android/scoped_java_ref.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "content/public/browser/web_contents_observer.h"
15 struct WebPreferences
;
17 namespace android_webview
{
19 class AwRenderViewHostExt
;
21 class AwSettings
: public content::WebContentsObserver
{
23 static AwSettings
* FromWebContents(content::WebContents
* web_contents
);
25 AwSettings(JNIEnv
* env
, jobject obj
, jint web_contents
);
26 virtual ~AwSettings();
28 // Called from Java. Methods with "Locked" suffix require that the settings
29 // access lock is held during their execution.
30 void Destroy(JNIEnv
* env
, jobject obj
);
31 void ResetScrollAndScaleState(JNIEnv
* env
, jobject obj
);
32 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
);
36 void UpdateFormDataPreferencesLocked(JNIEnv
* env
, jobject obj
);
38 void PopulateWebPreferences(WebPreferences
* web_prefs
);
41 AwRenderViewHostExt
* GetAwRenderViewHostExt();
42 void UpdateEverything();
44 // Fixed WebPreferences for Android WebView.
45 static void PopulateFixedPreferences(WebPreferences
* web_prefs
);
47 // WebContentsObserver overrides:
48 virtual void RenderViewCreated(
49 content::RenderViewHost
* render_view_host
) OVERRIDE
;
50 virtual void WebContentsDestroyed(
51 content::WebContents
* web_contents
) OVERRIDE
;
53 JavaObjectWeakGlobalRef aw_settings_
;
56 bool RegisterAwSettings(JNIEnv
* env
);
58 } // namespace android_webview
60 #endif // ANDROID_WEBVIEW_NATIVE_AW_SETTINGS_H_