[email protected] | cbe55d2 | 2013-02-14 17:04:33 | [diff] [blame] | 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. | ||||
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] | 693c183 | 2013-04-25 15:10:05 | [diff] [blame] | 12 | #include "base/memory/scoped_ptr.h" |
[email protected] | cbe55d2 | 2013-02-14 17:04:33 | [diff] [blame] | 13 | #include "content/public/browser/web_contents_observer.h" |
14 | |||||
[email protected] | 9f8797b | 2013-09-27 00:18:13 | [diff] [blame^] | 15 | struct WebPreferences; |
16 | |||||
[email protected] | cbe55d2 | 2013-02-14 17:04:33 | [diff] [blame] | 17 | namespace android_webview { |
18 | |||||
[email protected] | 3f93980d | 2013-02-27 20:21:45 | [diff] [blame] | 19 | class AwRenderViewHostExt; |
20 | |||||
[email protected] | cbe55d2 | 2013-02-14 17:04:33 | [diff] [blame] | 21 | class AwSettings : public content::WebContentsObserver { |
22 | public: | ||||
[email protected] | 9f8797b | 2013-09-27 00:18:13 | [diff] [blame^] | 23 | static AwSettings* FromWebContents(content::WebContents* web_contents); |
24 | |||||
[email protected] | 14a2df0d | 2013-06-14 23:40:32 | [diff] [blame] | 25 | AwSettings(JNIEnv* env, jobject obj, jint web_contents); |
[email protected] | cbe55d2 | 2013-02-14 17:04:33 | [diff] [blame] | 26 | virtual ~AwSettings(); |
27 | |||||
[email protected] | ff022ac | 2013-05-10 12:45:52 | [diff] [blame] | 28 | // Called from Java. Methods with "Locked" suffix require that the settings |
29 | // access lock is held during their execution. | ||||
[email protected] | cbe55d2 | 2013-02-14 17:04:33 | [diff] [blame] | 30 | void Destroy(JNIEnv* env, jobject obj); |
[email protected] | df432e59 | 2013-02-28 21:59:35 | [diff] [blame] | 31 | void ResetScrollAndScaleState(JNIEnv* env, jobject obj); |
[email protected] | ff022ac | 2013-05-10 12:45:52 | [diff] [blame] | 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); | ||||
[email protected] | efcd66b | 2013-05-15 08:38:44 | [diff] [blame] | 36 | void UpdateFormDataPreferencesLocked(JNIEnv* env, jobject obj); |
[email protected] | cbe55d2 | 2013-02-14 17:04:33 | [diff] [blame] | 37 | |
[email protected] | 9f8797b | 2013-09-27 00:18:13 | [diff] [blame^] | 38 | void PopulateWebPreferences(WebPreferences* web_prefs); |
39 | |||||
[email protected] | cbe55d2 | 2013-02-14 17:04:33 | [diff] [blame] | 40 | private: |
[email protected] | 3f93980d | 2013-02-27 20:21:45 | [diff] [blame] | 41 | AwRenderViewHostExt* GetAwRenderViewHostExt(); |
[email protected] | 693c183 | 2013-04-25 15:10:05 | [diff] [blame] | 42 | void UpdateEverything(); |
[email protected] | cbe55d2 | 2013-02-14 17:04:33 | [diff] [blame] | 43 | |
44 | // WebContentsObserver overrides: | ||||
45 | virtual void RenderViewCreated( | ||||
46 | content::RenderViewHost* render_view_host) OVERRIDE; | ||||
[email protected] | 14a2df0d | 2013-06-14 23:40:32 | [diff] [blame] | 47 | virtual void WebContentsDestroyed( |
48 | content::WebContents* web_contents) OVERRIDE; | ||||
[email protected] | cbe55d2 | 2013-02-14 17:04:33 | [diff] [blame] | 49 | |
[email protected] | 693c183 | 2013-04-25 15:10:05 | [diff] [blame] | 50 | JavaObjectWeakGlobalRef aw_settings_; |
[email protected] | cbe55d2 | 2013-02-14 17:04:33 | [diff] [blame] | 51 | }; |
52 | |||||
53 | bool RegisterAwSettings(JNIEnv* env); | ||||
54 | |||||
55 | } // namespace android_webview | ||||
56 | |||||
57 | #endif // ANDROID_WEBVIEW_NATIVE_AW_SETTINGS_H_ |