OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef ANDROID_WEBVIEW_NATIVE_AW_SETTINGS_H_ | 5 #ifndef ANDROID_WEBVIEW_NATIVE_AW_SETTINGS_H_ |
6 #define ANDROID_WEBVIEW_NATIVE_AW_SETTINGS_H_ | 6 #define ANDROID_WEBVIEW_NATIVE_AW_SETTINGS_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 | 9 |
10 #include "base/android/jni_helper.h" | 10 #include "base/android/jni_helper.h" |
11 #include "base/android/scoped_java_ref.h" | 11 #include "base/android/scoped_java_ref.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "content/public/browser/web_contents_observer.h" | 13 #include "content/public/browser/web_contents_observer.h" |
14 | 14 |
| 15 struct WebPreferences; |
| 16 |
15 namespace android_webview { | 17 namespace android_webview { |
16 | 18 |
17 class AwRenderViewHostExt; | 19 class AwRenderViewHostExt; |
18 | 20 |
19 class AwSettings : public content::WebContentsObserver { | 21 class AwSettings : public content::WebContentsObserver { |
20 public: | 22 public: |
| 23 static AwSettings* FromWebContents(content::WebContents* web_contents); |
| 24 |
21 AwSettings(JNIEnv* env, jobject obj, jint web_contents); | 25 AwSettings(JNIEnv* env, jobject obj, jint web_contents); |
22 virtual ~AwSettings(); | 26 virtual ~AwSettings(); |
23 | 27 |
24 // Called from Java. Methods with "Locked" suffix require that the settings | 28 // Called from Java. Methods with "Locked" suffix require that the settings |
25 // access lock is held during their execution. | 29 // access lock is held during their execution. |
26 void Destroy(JNIEnv* env, jobject obj); | 30 void Destroy(JNIEnv* env, jobject obj); |
27 void ResetScrollAndScaleState(JNIEnv* env, jobject obj); | 31 void ResetScrollAndScaleState(JNIEnv* env, jobject obj); |
28 void UpdateEverythingLocked(JNIEnv* env, jobject obj); | 32 void UpdateEverythingLocked(JNIEnv* env, jobject obj); |
29 void UpdateInitialPageScaleLocked(JNIEnv* env, jobject obj); | 33 void UpdateInitialPageScaleLocked(JNIEnv* env, jobject obj); |
30 void UpdateUserAgentLocked(JNIEnv* env, jobject obj); | 34 void UpdateUserAgentLocked(JNIEnv* env, jobject obj); |
31 void UpdateWebkitPreferencesLocked(JNIEnv* env, jobject obj); | 35 void UpdateWebkitPreferencesLocked(JNIEnv* env, jobject obj); |
32 void UpdateFormDataPreferencesLocked(JNIEnv* env, jobject obj); | 36 void UpdateFormDataPreferencesLocked(JNIEnv* env, jobject obj); |
33 | 37 |
| 38 void PopulateWebPreferences(WebPreferences* web_prefs); |
| 39 |
34 private: | 40 private: |
35 AwRenderViewHostExt* GetAwRenderViewHostExt(); | 41 AwRenderViewHostExt* GetAwRenderViewHostExt(); |
36 void UpdateEverything(); | 42 void UpdateEverything(); |
37 | 43 |
38 // WebContentsObserver overrides: | 44 // WebContentsObserver overrides: |
39 virtual void RenderViewCreated( | 45 virtual void RenderViewCreated( |
40 content::RenderViewHost* render_view_host) OVERRIDE; | 46 content::RenderViewHost* render_view_host) OVERRIDE; |
41 virtual void WebContentsDestroyed( | 47 virtual void WebContentsDestroyed( |
42 content::WebContents* web_contents) OVERRIDE; | 48 content::WebContents* web_contents) OVERRIDE; |
43 | 49 |
44 JavaObjectWeakGlobalRef aw_settings_; | 50 JavaObjectWeakGlobalRef aw_settings_; |
45 }; | 51 }; |
46 | 52 |
47 bool RegisterAwSettings(JNIEnv* env); | 53 bool RegisterAwSettings(JNIEnv* env); |
48 | 54 |
49 } // namespace android_webview | 55 } // namespace android_webview |
50 | 56 |
51 #endif // ANDROID_WEBVIEW_NATIVE_AW_SETTINGS_H_ | 57 #endif // ANDROID_WEBVIEW_NATIVE_AW_SETTINGS_H_ |
OLD | NEW |