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