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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 // process. We treat it like the tab is crashed. If the content is loaded | 164 // process. We treat it like the tab is crashed. If the content is loaded |
165 // when the tab is shown, tab_crashed_ will be reset. Since | 165 // when the tab is shown, tab_crashed_ will be reset. Since |
166 // RenderWidgetHostView is associated with the lifetime of the renderer | 166 // RenderWidgetHostView is associated with the lifetime of the renderer |
167 // process, we use it to test whether there is a renderer process. | 167 // process, we use it to test whether there is a renderer process. |
168 tab_crashed_ = !(web_contents->GetRenderWidgetHostView()); | 168 tab_crashed_ = !(web_contents->GetRenderWidgetHostView()); |
169 | 169 |
170 // TODO(leandrogracia): make use of the hardware_accelerated argument. | 170 // TODO(leandrogracia): make use of the hardware_accelerated argument. |
171 | 171 |
172 InitJNI(env, obj); | 172 InitJNI(env, obj); |
173 | 173 |
174 if (CommandLine::ForCurrentProcess()->HasSwitch( | 174 const gfx::Display& display = |
175 switches::kEnableCssTransformPinch)) { | 175 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); |
176 dpi_scale_ = 1; | 176 dpi_scale_ = display.device_scale_factor(); |
177 } else { | |
178 const gfx::Display& display = | |
179 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); | |
180 dpi_scale_ = display.device_scale_factor(); | |
181 } | |
182 | 177 |
183 // Currently, the only use case we have for overriding a user agent involves | 178 // Currently, the only use case we have for overriding a user agent involves |
184 // spoofing a desktop Linux user agent for "Request desktop site". | 179 // spoofing a desktop Linux user agent for "Request desktop site". |
185 // Automatically set it for all WebContents so that it is available when a | 180 // Automatically set it for all WebContents so that it is available when a |
186 // NavigationEntry requires the user agent to be overridden. | 181 // NavigationEntry requires the user agent to be overridden. |
187 const char kLinuxInfoStr[] = "X11; Linux x86_64"; | 182 const char kLinuxInfoStr[] = "X11; Linux x86_64"; |
188 std::string product = content::GetContentClient()->GetProduct(); | 183 std::string product = content::GetContentClient()->GetProduct(); |
189 std::string spoofed_ua = | 184 std::string spoofed_ua = |
190 webkit_glue::BuildUserAgentFromOSAndProduct(kLinuxInfoStr, product); | 185 webkit_glue::BuildUserAgentFromOSAndProduct(kLinuxInfoStr, product); |
191 web_contents->SetUserAgentOverride(spoofed_ua); | 186 web_contents->SetUserAgentOverride(spoofed_ua); |
(...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1385 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) { | 1380 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) { |
1386 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!"; | 1381 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!"; |
1387 return false; | 1382 return false; |
1388 } | 1383 } |
1389 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I"); | 1384 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I"); |
1390 | 1385 |
1391 return RegisterNativesImpl(env) >= 0; | 1386 return RegisterNativesImpl(env) >= 0; |
1392 } | 1387 } |
1393 | 1388 |
1394 } // namespace content | 1389 } // namespace content |
OLD | NEW |