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 "content/public/browser/web_contents_observer.h" | 13 #include "content/public/browser/web_contents_observer.h" |
13 | 14 |
14 namespace android_webview { | 15 namespace android_webview { |
15 | 16 |
16 class AwRenderViewHostExt; | 17 class AwRenderViewHostExt; |
17 | 18 |
18 class AwSettings : public content::WebContentsObserver { | 19 class AwSettings : public content::WebContentsObserver { |
19 public: | 20 public: |
20 AwSettings(JNIEnv* env, jobject obj); | 21 AwSettings(JNIEnv* env, jobject obj); |
21 virtual ~AwSettings(); | 22 virtual ~AwSettings(); |
22 | 23 |
23 // Called from Java. | 24 // Called from Java. |
24 void Destroy(JNIEnv* env, jobject obj); | 25 void Destroy(JNIEnv* env, jobject obj); |
25 void ResetScrollAndScaleState(JNIEnv* env, jobject obj); | 26 void ResetScrollAndScaleState(JNIEnv* env, jobject obj); |
26 void SetInitialPageScale(JNIEnv* env, jobject obj, jfloat page_scale_percent); | |
27 void SetTextZoom(JNIEnv* env, jobject obj, jint text_zoom_percent); | |
28 void SetWebContents(JNIEnv* env, jobject obj, jint web_contents); | 27 void SetWebContents(JNIEnv* env, jobject obj, jint web_contents); |
| 28 void UpdateEverything(JNIEnv* env, jobject obj); |
| 29 void UpdateInitialPageScale(JNIEnv* env, jobject obj); |
| 30 void UpdateUserAgent(JNIEnv* env, jobject obj); |
| 31 void UpdateWebkitPreferences(JNIEnv* env, jobject obj); |
29 | 32 |
30 private: | 33 private: |
| 34 struct FieldIds; |
| 35 |
31 AwRenderViewHostExt* GetAwRenderViewHostExt(); | 36 AwRenderViewHostExt* GetAwRenderViewHostExt(); |
32 void UpdateInitialPageScale(); | 37 void UpdateEverything(); |
33 void UpdateTextZoom(); | 38 void UpdatePreferredSizeMode(); |
34 void UpdatePreferredSizeMode(content::RenderViewHost* render_view_host); | |
35 void UpdateRenderViewHostExtSettings(); | |
36 void UpdateRenderViewHostSettings(content::RenderViewHost* render_view_host); | |
37 | 39 |
38 // WebContentsObserver overrides: | 40 // WebContentsObserver overrides: |
39 virtual void RenderViewCreated( | 41 virtual void RenderViewCreated( |
40 content::RenderViewHost* render_view_host) OVERRIDE; | 42 content::RenderViewHost* render_view_host) OVERRIDE; |
41 | 43 |
42 JavaObjectWeakGlobalRef java_ref_; | 44 // Java field references for accessing the values in the Java object. |
43 float initial_page_scale_percent_; | 45 scoped_ptr<FieldIds> field_ids_; |
44 int text_zoom_percent_; | 46 |
| 47 JavaObjectWeakGlobalRef aw_settings_; |
45 }; | 48 }; |
46 | 49 |
47 bool RegisterAwSettings(JNIEnv* env); | 50 bool RegisterAwSettings(JNIEnv* env); |
48 | 51 |
49 } // namespace android_webview | 52 } // namespace android_webview |
50 | 53 |
51 #endif // ANDROID_WEBVIEW_NATIVE_AW_SETTINGS_H_ | 54 #endif // ANDROID_WEBVIEW_NATIVE_AW_SETTINGS_H_ |
OLD | NEW |