Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: content/browser/android/content_view_core_impl.cc

Issue 11886074: Use correct favicon scale factor on Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Renamed and added JavaBitmap JNI registration to .h Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "base/json/json_writer.h" 11 #include "base/json/json_writer.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "base/values.h" 14 #include "base/values.h"
15 #include "cc/layer.h" 15 #include "cc/layer.h"
16 #include "content/browser/android/interstitial_page_delegate_android.h" 16 #include "content/browser/android/interstitial_page_delegate_android.h"
17 #include "content/browser/android/load_url_params.h" 17 #include "content/browser/android/load_url_params.h"
18 #include "content/browser/android/touch_point.h" 18 #include "content/browser/android/touch_point.h"
19 #include "content/browser/renderer_host/java/java_bound_object.h" 19 #include "content/browser/renderer_host/java/java_bound_object.h"
20 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host_manager .h" 20 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host_manager .h"
21 #include "content/browser/renderer_host/compositor_impl_android.h" 21 #include "content/browser/renderer_host/compositor_impl_android.h"
22 #include "content/browser/renderer_host/render_view_host_impl.h" 22 #include "content/browser/renderer_host/render_view_host_impl.h"
23 #include "content/browser/renderer_host/render_widget_host_impl.h" 23 #include "content/browser/renderer_host/render_widget_host_impl.h"
24 #include "content/browser/renderer_host/render_widget_host_view_android.h" 24 #include "content/browser/renderer_host/render_widget_host_view_android.h"
25 #include "content/browser/ssl/ssl_host_state.h" 25 #include "content/browser/ssl/ssl_host_state.h"
26 #include "content/browser/web_contents/interstitial_page_impl.h" 26 #include "content/browser/web_contents/interstitial_page_impl.h"
27 #include "content/browser/web_contents/navigation_controller_impl.h" 27 #include "content/browser/web_contents/navigation_controller_impl.h"
28 #include "content/browser/web_contents/navigation_entry_impl.h" 28 #include "content/browser/web_contents/navigation_entry_impl.h"
29 #include "content/browser/web_contents/web_contents_view_android.h" 29 #include "content/browser/web_contents/web_contents_view_android.h"
30 #include "content/common/android/device_info.h"
31 #include "content/common/view_messages.h" 30 #include "content/common/view_messages.h"
32 #include "content/public/browser/browser_context.h" 31 #include "content/public/browser/browser_context.h"
33 #include "content/public/browser/favicon_status.h" 32 #include "content/public/browser/favicon_status.h"
34 #include "content/public/browser/notification_details.h" 33 #include "content/public/browser/notification_details.h"
35 #include "content/public/browser/notification_service.h" 34 #include "content/public/browser/notification_service.h"
36 #include "content/public/browser/notification_source.h" 35 #include "content/public/browser/notification_source.h"
37 #include "content/public/browser/notification_types.h" 36 #include "content/public/browser/notification_types.h"
38 #include "content/public/browser/web_contents.h" 37 #include "content/public/browser/web_contents.h"
39 #include "content/public/common/content_client.h" 38 #include "content/public/common/content_client.h"
40 #include "content/public/common/page_transition_types.h" 39 #include "content/public/common/page_transition_types.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 // process, we use it to test whether there is a renderer process. 163 // process, we use it to test whether there is a renderer process.
165 tab_crashed_ = !(web_contents->GetRenderWidgetHostView()); 164 tab_crashed_ = !(web_contents->GetRenderWidgetHostView());
166 165
167 // TODO(leandrogracia): make use of the hardware_accelerated argument. 166 // TODO(leandrogracia): make use of the hardware_accelerated argument.
168 167
169 InitJNI(env, obj); 168 InitJNI(env, obj);
170 169
171 if (!gfx::Screen::GetNativeScreen()->IsDIPEnabled()) { 170 if (!gfx::Screen::GetNativeScreen()->IsDIPEnabled()) {
172 dpi_scale_ = 1; 171 dpi_scale_ = 1;
173 } else { 172 } else {
174 scoped_ptr<content::DeviceInfo> device_info(new content::DeviceInfo()); 173 const gfx::Display& display =
175 dpi_scale_ = device_info->GetDPIScale(); 174 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay();
175 dpi_scale_ = display.device_scale_factor();
176 } 176 }
177 177
178 // 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
179 // spoofing a desktop Linux user agent for "Request desktop site". 179 // spoofing a desktop Linux user agent for "Request desktop site".
180 // 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
181 // NavigationEntry requires the user agent to be overridden. 181 // NavigationEntry requires the user agent to be overridden.
182 const char kLinuxInfoStr[] = "X11; Linux x86_64"; 182 const char kLinuxInfoStr[] = "X11; Linux x86_64";
183 std::string product = content::GetContentClient()->GetProduct(); 183 std::string product = content::GetContentClient()->GetProduct();
184 std::string spoofed_ua = 184 std::string spoofed_ua =
185 webkit_glue::BuildUserAgentFromOSAndProduct(kLinuxInfoStr, product); 185 webkit_glue::BuildUserAgentFromOSAndProduct(kLinuxInfoStr, product);
(...skipping 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after
1350 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) { 1350 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) {
1351 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!"; 1351 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!";
1352 return false; 1352 return false;
1353 } 1353 }
1354 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I"); 1354 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I");
1355 1355
1356 return RegisterNativesImpl(env) >= 0; 1356 return RegisterNativesImpl(env) >= 0;
1357 } 1357 }
1358 1358
1359 } // namespace content 1359 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698