OLD | NEW |
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 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 favicon::FaviconDriver* favicon_driver = | 688 favicon::FaviconDriver* favicon_driver = |
689 favicon::ContentFaviconDriver::FromWebContents(web_contents_.get()); | 689 favicon::ContentFaviconDriver::FromWebContents(web_contents_.get()); |
690 | 690 |
691 if (!favicon_driver) | 691 if (!favicon_driver) |
692 return bitmap; | 692 return bitmap; |
693 | 693 |
694 // Always return the default favicon in Android. | 694 // Always return the default favicon in Android. |
695 SkBitmap favicon = favicon_driver->GetFavicon().AsBitmap(); | 695 SkBitmap favicon = favicon_driver->GetFavicon().AsBitmap(); |
696 if (!favicon.empty()) { | 696 if (!favicon.empty()) { |
697 const float device_scale_factor = | 697 const float device_scale_factor = |
698 display::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor(); | 698 display::Screen::GetScreen()->GetDisplayNearestWindow( |
| 699 web_contents_->GetNativeView()).device_scale_factor(); |
699 int target_size_dip = device_scale_factor * gfx::kFaviconSize; | 700 int target_size_dip = device_scale_factor * gfx::kFaviconSize; |
700 if (favicon.width() != target_size_dip || | 701 if (favicon.width() != target_size_dip || |
701 favicon.height() != target_size_dip) { | 702 favicon.height() != target_size_dip) { |
702 favicon = | 703 favicon = |
703 skia::ImageOperations::Resize(favicon, | 704 skia::ImageOperations::Resize(favicon, |
704 skia::ImageOperations::RESIZE_BEST, | 705 skia::ImageOperations::RESIZE_BEST, |
705 target_size_dip, | 706 target_size_dip, |
706 target_size_dip); | 707 target_size_dip); |
707 } | 708 } |
708 | 709 |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
882 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { | 883 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
883 TRACE_EVENT0("native", "TabAndroid::Init"); | 884 TRACE_EVENT0("native", "TabAndroid::Init"); |
884 // This will automatically bind to the Java object and pass ownership there. | 885 // This will automatically bind to the Java object and pass ownership there. |
885 new TabAndroid(env, obj); | 886 new TabAndroid(env, obj); |
886 } | 887 } |
887 | 888 |
888 // static | 889 // static |
889 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { | 890 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { |
890 return RegisterNativesImpl(env); | 891 return RegisterNativesImpl(env); |
891 } | 892 } |
OLD | NEW |