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

Side by Side Diff: chrome/browser/android/tab_android.cc

Issue 2121973003: Replace/remove some uses of DeviceDisplayInfo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compilation for Chrome Created 4 years, 5 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
« no previous file with comments | « no previous file | content/browser/gpu/gpu_data_manager_impl_private.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "chrome/browser/android/tab_android.h" 5 #include "chrome/browser/android/tab_android.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "base/android/jni_string.h" 10 #include "base/android/jni_string.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 #include "content/public/browser/user_metrics.h" 76 #include "content/public/browser/user_metrics.h"
77 #include "content/public/browser/web_contents.h" 77 #include "content/public/browser/web_contents.h"
78 #include "content/public/common/resource_request_body.h" 78 #include "content/public/common/resource_request_body.h"
79 #include "content/public/common/top_controls_state.h" 79 #include "content/public/common/top_controls_state.h"
80 #include "jni/Tab_jni.h" 80 #include "jni/Tab_jni.h"
81 #include "net/base/escape.h" 81 #include "net/base/escape.h"
82 #include "skia/ext/image_operations.h" 82 #include "skia/ext/image_operations.h"
83 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" 83 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h"
84 #include "ui/base/resource/resource_bundle.h" 84 #include "ui/base/resource/resource_bundle.h"
85 #include "ui/base/window_open_disposition.h" 85 #include "ui/base/window_open_disposition.h"
86 #include "ui/gfx/android/device_display_info.h" 86 #include "ui/display/display.h"
87 #include "ui/display/screen.h"
87 #include "ui/gfx/android/java_bitmap.h" 88 #include "ui/gfx/android/java_bitmap.h"
88 #include "ui/gfx/favicon_size.h" 89 #include "ui/gfx/favicon_size.h"
89 #include "ui/gfx/image/image_skia.h" 90 #include "ui/gfx/image/image_skia.h"
90 91
91 using base::android::AttachCurrentThread; 92 using base::android::AttachCurrentThread;
92 using base::android::ConvertUTF8ToJavaString; 93 using base::android::ConvertUTF8ToJavaString;
93 using content::BrowserThread; 94 using content::BrowserThread;
94 using content::GlobalRequestID; 95 using content::GlobalRequestID;
95 using content::NavigationController; 96 using content::NavigationController;
96 using content::WebContents; 97 using content::WebContents;
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 ScopedJavaLocalRef<jobject> bitmap; 657 ScopedJavaLocalRef<jobject> bitmap;
657 favicon::FaviconDriver* favicon_driver = 658 favicon::FaviconDriver* favicon_driver =
658 favicon::ContentFaviconDriver::FromWebContents(web_contents_.get()); 659 favicon::ContentFaviconDriver::FromWebContents(web_contents_.get());
659 660
660 if (!favicon_driver) 661 if (!favicon_driver)
661 return bitmap; 662 return bitmap;
662 663
663 // Always return the default favicon in Android. 664 // Always return the default favicon in Android.
664 SkBitmap favicon = favicon_driver->GetFavicon().AsBitmap(); 665 SkBitmap favicon = favicon_driver->GetFavicon().AsBitmap();
665 if (!favicon.empty()) { 666 if (!favicon.empty()) {
666 gfx::DeviceDisplayInfo device_info; 667 const float device_scale_factor =
667 const float device_scale_factor = device_info.GetDIPScale(); 668 display::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor();
668 int target_size_dip = device_scale_factor * gfx::kFaviconSize; 669 int target_size_dip = device_scale_factor * gfx::kFaviconSize;
669 if (favicon.width() != target_size_dip || 670 if (favicon.width() != target_size_dip ||
670 favicon.height() != target_size_dip) { 671 favicon.height() != target_size_dip) {
671 favicon = 672 favicon =
672 skia::ImageOperations::Resize(favicon, 673 skia::ImageOperations::Resize(favicon,
673 skia::ImageOperations::RESIZE_BEST, 674 skia::ImageOperations::RESIZE_BEST,
674 target_size_dip, 675 target_size_dip,
675 target_size_dip); 676 target_size_dip);
676 } 677 }
677 678
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { 902 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) {
902 TRACE_EVENT0("native", "TabAndroid::Init"); 903 TRACE_EVENT0("native", "TabAndroid::Init");
903 // This will automatically bind to the Java object and pass ownership there. 904 // This will automatically bind to the Java object and pass ownership there.
904 new TabAndroid(env, obj); 905 new TabAndroid(env, obj);
905 } 906 }
906 907
907 // static 908 // static
908 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { 909 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) {
909 return RegisterNativesImpl(env); 910 return RegisterNativesImpl(env);
910 } 911 }
OLDNEW
« no previous file with comments | « no previous file | content/browser/gpu/gpu_data_manager_impl_private.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698