| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_BROWSER_ANDROID_CONTENT_SETTINGS_H_ | 5 #ifndef CONTENT_BROWSER_ANDROID_CONTENT_SETTINGS_H_ |
| 6 #define CONTENT_BROWSER_ANDROID_CONTENT_SETTINGS_H_ | 6 #define CONTENT_BROWSER_ANDROID_CONTENT_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/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "content/public/browser/web_contents_observer.h" | 12 #include "content/public/browser/web_contents_observer.h" |
| 13 | 13 |
| 14 namespace content { | 14 namespace content { |
| 15 | 15 |
| 16 class ContentSettings : public WebContentsObserver { | 16 class ContentSettings : public WebContentsObserver { |
| 17 public: | 17 public: |
| 18 ContentSettings(JNIEnv* env, jobject obj, | 18 ContentSettings(JNIEnv* env, jobject obj, |
| 19 WebContents* contents, | 19 WebContents* contents); |
| 20 bool is_master_mode); | |
| 21 | 20 |
| 22 static bool RegisterContentSettings(JNIEnv* env); | 21 static bool RegisterContentSettings(JNIEnv* env); |
| 23 | 22 |
| 24 // Synchronizes the Java settings from native settings. | |
| 25 void SyncFromNative(JNIEnv* env, jobject obj); | 23 void SyncFromNative(JNIEnv* env, jobject obj); |
| 26 // Synchronizes the native settings from Java settings. | |
| 27 void SyncToNative(JNIEnv* env, jobject obj); | |
| 28 | 24 |
| 29 private: | 25 private: |
| 30 struct FieldIds; | 26 struct FieldIds; |
| 31 // Self-deletes when the underlying WebContents is destroyed. | 27 // Self-deletes when the underlying WebContents is destroyed. |
| 32 virtual ~ContentSettings(); | 28 virtual ~ContentSettings(); |
| 33 | 29 |
| 34 void SyncFromNativeImpl(); | 30 void SyncFromNativeImpl(); |
| 35 void SyncToNativeImpl(); | |
| 36 | 31 |
| 37 // WebContentsObserver overrides: | 32 // WebContentsObserver overrides: |
| 38 virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; | |
| 39 virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE; | 33 virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE; |
| 40 | 34 |
| 41 // Determines whether a sync to native should be triggered when a new render | |
| 42 // view is created. | |
| 43 bool is_master_mode_; | |
| 44 | |
| 45 // Java field references for accessing the values in the Java object. | 35 // Java field references for accessing the values in the Java object. |
| 46 scoped_ptr<FieldIds> field_ids_; | 36 scoped_ptr<FieldIds> field_ids_; |
| 47 | 37 |
| 48 // The Java counterpart to this class. | 38 // The Java counterpart to this class. |
| 49 JavaObjectWeakGlobalRef content_settings_; | 39 JavaObjectWeakGlobalRef content_settings_; |
| 50 }; | 40 }; |
| 51 | 41 |
| 52 } // namespace content | 42 } // namespace content |
| 53 | 43 |
| 54 #endif // CONTENT_BROWSER_ANDROID_CONTENT_SETTINGS_H_ | 44 #endif // CONTENT_BROWSER_ANDROID_CONTENT_SETTINGS_H_ |
| OLD | NEW |