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 #include "content/browser/android/content_settings.h" | 5 #include "content/browser/android/content_settings.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
9 #include "content/browser/android/content_view_impl.h" | 9 #include "content/browser/android/content_view_core_impl.h" |
10 #include "content/browser/renderer_host/render_view_host_delegate.h" | 10 #include "content/browser/renderer_host/render_view_host_delegate.h" |
11 #include "content/browser/renderer_host/render_view_host_impl.h" | 11 #include "content/browser/renderer_host/render_view_host_impl.h" |
12 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
13 #include "jni/content_settings_jni.h" | 13 #include "jni/content_settings_jni.h" |
14 #include "webkit/glue/user_agent.h" | 14 #include "webkit/glue/user_agent.h" |
15 #include "webkit/glue/webkit_glue.h" | 15 #include "webkit/glue/webkit_glue.h" |
16 #include "webkit/glue/webpreferences.h" | 16 #include "webkit/glue/webpreferences.h" |
17 | 17 |
18 using base::android::CheckException; | 18 using base::android::CheckException; |
19 using base::android::ConvertJavaStringToUTF16; | 19 using base::android::ConvertJavaStringToUTF16; |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 void ContentSettings::SyncToNative(JNIEnv* env, jobject obj) { | 278 void ContentSettings::SyncToNative(JNIEnv* env, jobject obj) { |
279 SyncToNativeImpl(); | 279 SyncToNativeImpl(); |
280 } | 280 } |
281 | 281 |
282 void ContentSettings::RenderViewCreated(RenderViewHost* render_view_host) { | 282 void ContentSettings::RenderViewCreated(RenderViewHost* render_view_host) { |
283 if (is_master_mode_) | 283 if (is_master_mode_) |
284 SyncToNativeImpl(); | 284 SyncToNativeImpl(); |
285 } | 285 } |
286 | 286 |
287 jint Init( | 287 jint Init( |
288 JNIEnv* env, jobject obj, jint nativeContentView, | 288 JNIEnv* env, jobject obj, jint nativeContentViewCore, |
289 jboolean is_master_mode) { | 289 jboolean is_master_mode) { |
290 WebContents* web_contents = | 290 WebContents* web_contents = |
291 reinterpret_cast<ContentViewImpl*>(nativeContentView) | 291 reinterpret_cast<ContentViewCoreImpl*>(nativeContentViewCore) |
292 ->web_contents(); | 292 ->web_contents(); |
293 ContentSettings* content_settings = | 293 ContentSettings* content_settings = |
294 new ContentSettings(env, obj, web_contents, is_master_mode); | 294 new ContentSettings(env, obj, web_contents, is_master_mode); |
295 return reinterpret_cast<jint>(content_settings); | 295 return reinterpret_cast<jint>(content_settings); |
296 } | 296 } |
297 | 297 |
298 jstring GetDefaultUserAgent(JNIEnv* env, jclass clazz) { | 298 jstring GetDefaultUserAgent(JNIEnv* env, jclass clazz) { |
299 // "Version/4.0" had been hardcoded in the legacy WebView. | 299 // "Version/4.0" had been hardcoded in the legacy WebView. |
300 std::string ua = webkit_glue::BuildUserAgentFromProduct("Version/4.0"); | 300 std::string ua = webkit_glue::BuildUserAgentFromProduct("Version/4.0"); |
301 return base::android::ConvertUTF8ToJavaString(env, ua).Release(); | 301 return base::android::ConvertUTF8ToJavaString(env, ua).Release(); |
302 } | 302 } |
303 | 303 |
304 } // namespace content | 304 } // namespace content |
OLD | NEW |