| 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_view_core_impl.h" | 5 #include "content/browser/android/content_view_core_impl.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
| 9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
| 10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host_manager
.h" | 21 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host_manager
.h" |
| 22 #include "content/browser/renderer_host/compositor_impl_android.h" | 22 #include "content/browser/renderer_host/compositor_impl_android.h" |
| 23 #include "content/browser/renderer_host/render_view_host_impl.h" | 23 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 24 #include "content/browser/renderer_host/render_widget_host_impl.h" | 24 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 25 #include "content/browser/renderer_host/render_widget_host_view_android.h" | 25 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
| 26 #include "content/browser/ssl/ssl_host_state.h" | 26 #include "content/browser/ssl/ssl_host_state.h" |
| 27 #include "content/browser/web_contents/interstitial_page_impl.h" | 27 #include "content/browser/web_contents/interstitial_page_impl.h" |
| 28 #include "content/browser/web_contents/navigation_controller_impl.h" | 28 #include "content/browser/web_contents/navigation_controller_impl.h" |
| 29 #include "content/browser/web_contents/navigation_entry_impl.h" | 29 #include "content/browser/web_contents/navigation_entry_impl.h" |
| 30 #include "content/browser/web_contents/web_contents_view_android.h" | 30 #include "content/browser/web_contents/web_contents_view_android.h" |
| 31 #include "content/common/android/device_info.h" | |
| 32 #include "content/common/view_messages.h" | 31 #include "content/common/view_messages.h" |
| 33 #include "content/public/browser/browser_context.h" | 32 #include "content/public/browser/browser_context.h" |
| 34 #include "content/public/browser/favicon_status.h" | 33 #include "content/public/browser/favicon_status.h" |
| 35 #include "content/public/browser/notification_details.h" | 34 #include "content/public/browser/notification_details.h" |
| 36 #include "content/public/browser/notification_service.h" | 35 #include "content/public/browser/notification_service.h" |
| 37 #include "content/public/browser/notification_source.h" | 36 #include "content/public/browser/notification_source.h" |
| 38 #include "content/public/browser/notification_types.h" | 37 #include "content/public/browser/notification_types.h" |
| 39 #include "content/public/browser/web_contents.h" | 38 #include "content/public/browser/web_contents.h" |
| 40 #include "content/public/common/content_client.h" | 39 #include "content/public/common/content_client.h" |
| 41 #include "content/public/common/content_switches.h" | 40 #include "content/public/common/content_switches.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 tab_crashed_ = !(web_contents->GetRenderWidgetHostView()); | 168 tab_crashed_ = !(web_contents->GetRenderWidgetHostView()); |
| 170 | 169 |
| 171 // TODO(leandrogracia): make use of the hardware_accelerated argument. | 170 // TODO(leandrogracia): make use of the hardware_accelerated argument. |
| 172 | 171 |
| 173 InitJNI(env, obj); | 172 InitJNI(env, obj); |
| 174 | 173 |
| 175 if (CommandLine::ForCurrentProcess()->HasSwitch( | 174 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 176 switches::kEnableCssTransformPinch)) { | 175 switches::kEnableCssTransformPinch)) { |
| 177 dpi_scale_ = 1; | 176 dpi_scale_ = 1; |
| 178 } else { | 177 } else { |
| 179 scoped_ptr<content::DeviceInfo> device_info(new content::DeviceInfo()); | 178 const gfx::Display& display = |
| 180 dpi_scale_ = device_info->GetDPIScale(); | 179 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); |
| 180 dpi_scale_ = display.device_scale_factor(); |
| 181 } | 181 } |
| 182 | 182 |
| 183 // Currently, the only use case we have for overriding a user agent involves | 183 // Currently, the only use case we have for overriding a user agent involves |
| 184 // spoofing a desktop Linux user agent for "Request desktop site". | 184 // spoofing a desktop Linux user agent for "Request desktop site". |
| 185 // Automatically set it for all WebContents so that it is available when a | 185 // Automatically set it for all WebContents so that it is available when a |
| 186 // NavigationEntry requires the user agent to be overridden. | 186 // NavigationEntry requires the user agent to be overridden. |
| 187 const char kLinuxInfoStr[] = "X11; Linux x86_64"; | 187 const char kLinuxInfoStr[] = "X11; Linux x86_64"; |
| 188 std::string product = content::GetContentClient()->GetProduct(); | 188 std::string product = content::GetContentClient()->GetProduct(); |
| 189 std::string spoofed_ua = | 189 std::string spoofed_ua = |
| 190 webkit_glue::BuildUserAgentFromOSAndProduct(kLinuxInfoStr, product); | 190 webkit_glue::BuildUserAgentFromOSAndProduct(kLinuxInfoStr, product); |
| (...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1374 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) { | 1374 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) { |
| 1375 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!"; | 1375 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!"; |
| 1376 return false; | 1376 return false; |
| 1377 } | 1377 } |
| 1378 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I"); | 1378 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I"); |
| 1379 | 1379 |
| 1380 return RegisterNativesImpl(env) >= 0; | 1380 return RegisterNativesImpl(env) >= 0; |
| 1381 } | 1381 } |
| 1382 | 1382 |
| 1383 } // namespace content | 1383 } // namespace content |
| OLD | NEW |