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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
91 | 91 |
92 using base::android::AttachCurrentThread; | 92 using base::android::AttachCurrentThread; |
93 using base::android::ConvertUTF8ToJavaString; | 93 using base::android::ConvertUTF8ToJavaString; |
94 using content::BrowserThread; | 94 using content::BrowserThread; |
95 using content::GlobalRequestID; | 95 using content::GlobalRequestID; |
96 using content::NavigationController; | 96 using content::NavigationController; |
97 using content::WebContents; | 97 using content::WebContents; |
98 using navigation_interception::InterceptNavigationDelegate; | 98 using navigation_interception::InterceptNavigationDelegate; |
99 using navigation_interception::NavigationParams; | 99 using navigation_interception::NavigationParams; |
100 | 100 |
101 TabAndroid* TabAndroid::FromWebContents(content::WebContents* web_contents) { | 101 TabAndroid* TabAndroid::FromWebContents( |
102 CoreTabHelper* core_tab_helper = CoreTabHelper::FromWebContents(web_contents); | 102 const content::WebContents* web_contents) { |
103 const CoreTabHelper* core_tab_helper = CoreTabHelper::FromWebContents( | |
104 web_contents); | |
103 if (!core_tab_helper) | 105 if (!core_tab_helper) |
104 return NULL; | 106 return NULL; |
105 | 107 |
106 CoreTabHelperDelegate* core_delegate = core_tab_helper->delegate(); | 108 CoreTabHelperDelegate* core_delegate = core_tab_helper->delegate(); |
107 if (!core_delegate) | 109 if (!core_delegate) |
108 return NULL; | 110 return NULL; |
109 | 111 |
110 return static_cast<TabAndroid*>(core_delegate); | 112 return static_cast<TabAndroid*>(core_delegate); |
111 } | 113 } |
112 | 114 |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
657 ScopedJavaLocalRef<jobject> bitmap; | 659 ScopedJavaLocalRef<jobject> bitmap; |
658 favicon::FaviconDriver* favicon_driver = | 660 favicon::FaviconDriver* favicon_driver = |
659 favicon::ContentFaviconDriver::FromWebContents(web_contents_.get()); | 661 favicon::ContentFaviconDriver::FromWebContents(web_contents_.get()); |
660 | 662 |
661 if (!favicon_driver) | 663 if (!favicon_driver) |
662 return bitmap; | 664 return bitmap; |
663 | 665 |
664 // Always return the default favicon in Android. | 666 // Always return the default favicon in Android. |
665 SkBitmap favicon = favicon_driver->GetFavicon().AsBitmap(); | 667 SkBitmap favicon = favicon_driver->GetFavicon().AsBitmap(); |
666 if (!favicon.empty()) { | 668 if (!favicon.empty()) { |
667 const float device_scale_factor = | 669 const float device_scale_factor = |
Theresa
2016/07/12 17:25:17
Please upload rebases as a separate patchset (uplo
| |
668 display::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor(); | 670 display::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor(); |
669 int target_size_dip = device_scale_factor * gfx::kFaviconSize; | 671 int target_size_dip = device_scale_factor * gfx::kFaviconSize; |
670 if (favicon.width() != target_size_dip || | 672 if (favicon.width() != target_size_dip || |
671 favicon.height() != target_size_dip) { | 673 favicon.height() != target_size_dip) { |
672 favicon = | 674 favicon = |
673 skia::ImageOperations::Resize(favicon, | 675 skia::ImageOperations::Resize(favicon, |
674 skia::ImageOperations::RESIZE_BEST, | 676 skia::ImageOperations::RESIZE_BEST, |
675 target_size_dip, | 677 target_size_dip, |
676 target_size_dip); | 678 target_size_dip); |
677 } | 679 } |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
902 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { | 904 static void Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
903 TRACE_EVENT0("native", "TabAndroid::Init"); | 905 TRACE_EVENT0("native", "TabAndroid::Init"); |
904 // This will automatically bind to the Java object and pass ownership there. | 906 // This will automatically bind to the Java object and pass ownership there. |
905 new TabAndroid(env, obj); | 907 new TabAndroid(env, obj); |
906 } | 908 } |
907 | 909 |
908 // static | 910 // static |
909 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { | 911 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { |
910 return RegisterNativesImpl(env); | 912 return RegisterNativesImpl(env); |
911 } | 913 } |
OLD | NEW |