| 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 "chrome/browser/ui/android/navigation_popup.h" | 5 #include "chrome/browser/ui/android/navigation_popup.h" |
| 6 | 6 |
| 7 #include "base/android/jni_string.h" | 7 #include "base/android/jni_string.h" |
| 8 #include "base/android/scoped_java_ref.h" | 8 #include "base/android/scoped_java_ref.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 jstring jurl) { | 42 jstring jurl) { |
| 43 Profile* profile = g_browser_process->profile_manager()->GetLastUsedProfile(); | 43 Profile* profile = g_browser_process->profile_manager()->GetLastUsedProfile(); |
| 44 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( | 44 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( |
| 45 profile, Profile::EXPLICIT_ACCESS); | 45 profile, Profile::EXPLICIT_ACCESS); |
| 46 if (!favicon_service) | 46 if (!favicon_service) |
| 47 return; | 47 return; |
| 48 GURL url(base::android::ConvertJavaStringToUTF16(env, jurl)); | 48 GURL url(base::android::ConvertJavaStringToUTF16(env, jurl)); |
| 49 // TODO(tedchoc): Request higher favicons based on screen density instead of | 49 // TODO(tedchoc): Request higher favicons based on screen density instead of |
| 50 // hardcoding kFaviconSize. | 50 // hardcoding kFaviconSize. |
| 51 favicon_service->GetFaviconImageForURL( | 51 favicon_service->GetFaviconImageForURL( |
| 52 FaviconService::FaviconForURLParams(profile, | 52 FaviconService::FaviconForURLParams(url, |
| 53 url, | |
| 54 chrome::FAVICON, | 53 chrome::FAVICON, |
| 55 gfx::kFaviconSize), | 54 gfx::kFaviconSize), |
| 56 base::Bind(&NavigationPopup::OnFaviconDataAvailable, | 55 base::Bind(&NavigationPopup::OnFaviconDataAvailable, |
| 57 base::Unretained(this), | 56 base::Unretained(this), |
| 58 url), | 57 url), |
| 59 &cancelable_task_tracker_); | 58 &cancelable_task_tracker_); |
| 60 } | 59 } |
| 61 | 60 |
| 62 void NavigationPopup::OnFaviconDataAvailable( | 61 void NavigationPopup::OnFaviconDataAvailable( |
| 63 GURL navigation_entry_url, | 62 GURL navigation_entry_url, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 89 | 88 |
| 90 static jint Init(JNIEnv* env, jobject obj) { | 89 static jint Init(JNIEnv* env, jobject obj) { |
| 91 NavigationPopup* popup = new NavigationPopup(env, obj); | 90 NavigationPopup* popup = new NavigationPopup(env, obj); |
| 92 return reinterpret_cast<jint>(popup); | 91 return reinterpret_cast<jint>(popup); |
| 93 } | 92 } |
| 94 | 93 |
| 95 // static | 94 // static |
| 96 bool NavigationPopup::RegisterNavigationPopup(JNIEnv* env) { | 95 bool NavigationPopup::RegisterNavigationPopup(JNIEnv* env) { |
| 97 return RegisterNativesImpl(env); | 96 return RegisterNativesImpl(env); |
| 98 } | 97 } |
| OLD | NEW |