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 #include "android_webview/native/aw_settings.h" | 5 #include "android_webview/native/aw_settings.h" |
6 | 6 |
7 #include "android_webview/browser/aw_content_browser_client.h" | 7 #include "android_webview/browser/aw_content_browser_client.h" |
8 #include "android_webview/browser/renderer_host/aw_render_view_host_ext.h" | 8 #include "android_webview/browser/renderer_host/aw_render_view_host_ext.h" |
9 #include "android_webview/common/aw_content_client.h" | 9 #include "android_webview/common/aw_content_client.h" |
10 #include "android_webview/native/aw_contents.h" | 10 #include "android_webview/native/aw_contents.h" |
11 #include "base/android/jni_android.h" | 11 #include "base/android/jni_android.h" |
12 #include "base/android/jni_string.h" | 12 #include "base/android/jni_string.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/ptr_util.h" |
14 #include "base/supports_user_data.h" | 15 #include "base/supports_user_data.h" |
15 #include "content/public/browser/navigation_controller.h" | 16 #include "content/public/browser/navigation_controller.h" |
16 #include "content/public/browser/navigation_entry.h" | 17 #include "content/public/browser/navigation_entry.h" |
17 #include "content/public/browser/render_view_host.h" | 18 #include "content/public/browser/render_view_host.h" |
18 #include "content/public/browser/web_contents.h" | 19 #include "content/public/browser/web_contents.h" |
19 #include "content/public/common/renderer_preferences.h" | 20 #include "content/public/common/renderer_preferences.h" |
20 #include "content/public/common/web_preferences.h" | 21 #include "content/public/common/web_preferences.h" |
21 #include "jni/AwSettings_jni.h" | 22 #include "jni/AwSettings_jni.h" |
22 #include "ui/gfx/font_render_params.h" | 23 #include "ui/gfx/font_render_params.h" |
23 | 24 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 AwSettings* settings_; | 74 AwSettings* settings_; |
74 }; | 75 }; |
75 | 76 |
76 AwSettings::AwSettings(JNIEnv* env, | 77 AwSettings::AwSettings(JNIEnv* env, |
77 jobject obj, | 78 jobject obj, |
78 content::WebContents* web_contents) | 79 content::WebContents* web_contents) |
79 : WebContentsObserver(web_contents), | 80 : WebContentsObserver(web_contents), |
80 renderer_prefs_initialized_(false), | 81 renderer_prefs_initialized_(false), |
81 aw_settings_(env, obj) { | 82 aw_settings_(env, obj) { |
82 web_contents->SetUserData(kAwSettingsUserDataKey, | 83 web_contents->SetUserData(kAwSettingsUserDataKey, |
83 new AwSettingsUserData(this)); | 84 base::MakeUnique<AwSettingsUserData>(this)); |
84 } | 85 } |
85 | 86 |
86 AwSettings::~AwSettings() { | 87 AwSettings::~AwSettings() { |
87 if (web_contents()) { | 88 if (web_contents()) { |
88 web_contents()->SetUserData(kAwSettingsUserDataKey, NULL); | 89 web_contents()->SetUserData(kAwSettingsUserDataKey, NULL); |
89 } | 90 } |
90 | 91 |
91 JNIEnv* env = base::android::AttachCurrentThread(); | 92 JNIEnv* env = base::android::AttachCurrentThread(); |
92 ScopedJavaLocalRef<jobject> scoped_obj = aw_settings_.get(env); | 93 ScopedJavaLocalRef<jobject> scoped_obj = aw_settings_.get(env); |
93 if (scoped_obj.is_null()) | 94 if (scoped_obj.is_null()) |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 JNIEnv* env, | 459 JNIEnv* env, |
459 const JavaParamRef<jclass>& clazz) { | 460 const JavaParamRef<jclass>& clazz) { |
460 return base::android::ConvertUTF8ToJavaString(env, GetUserAgent()); | 461 return base::android::ConvertUTF8ToJavaString(env, GetUserAgent()); |
461 } | 462 } |
462 | 463 |
463 bool RegisterAwSettings(JNIEnv* env) { | 464 bool RegisterAwSettings(JNIEnv* env) { |
464 return RegisterNativesImpl(env); | 465 return RegisterNativesImpl(env); |
465 } | 466 } |
466 | 467 |
467 } // namespace android_webview | 468 } // namespace android_webview |
OLD | NEW |