| 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 30 matching lines...) Expand all Loading... |
| 41 jobject obj, | 41 jobject obj, |
| 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->GetFaviconImageForPageURL( |
| 52 FaviconService::FaviconForURLParams( | 52 FaviconService::FaviconForPageURLParams( |
| 53 url, favicon_base::FAVICON, gfx::kFaviconSize), | 53 url, favicon_base::FAVICON, gfx::kFaviconSize), |
| 54 base::Bind(&NavigationPopup::OnFaviconDataAvailable, | 54 base::Bind(&NavigationPopup::OnFaviconDataAvailable, |
| 55 base::Unretained(this), | 55 base::Unretained(this), |
| 56 url), | 56 url), |
| 57 &cancelable_task_tracker_); | 57 &cancelable_task_tracker_); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void NavigationPopup::OnFaviconDataAvailable( | 60 void NavigationPopup::OnFaviconDataAvailable( |
| 61 GURL navigation_entry_url, | 61 GURL navigation_entry_url, |
| 62 const favicon_base::FaviconImageResult& image_result) { | 62 const favicon_base::FaviconImageResult& image_result) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 87 | 87 |
| 88 static jlong Init(JNIEnv* env, jobject obj) { | 88 static jlong Init(JNIEnv* env, jobject obj) { |
| 89 NavigationPopup* popup = new NavigationPopup(env, obj); | 89 NavigationPopup* popup = new NavigationPopup(env, obj); |
| 90 return reinterpret_cast<intptr_t>(popup); | 90 return reinterpret_cast<intptr_t>(popup); |
| 91 } | 91 } |
| 92 | 92 |
| 93 // static | 93 // static |
| 94 bool NavigationPopup::RegisterNavigationPopup(JNIEnv* env) { | 94 bool NavigationPopup::RegisterNavigationPopup(JNIEnv* env) { |
| 95 return RegisterNativesImpl(env); | 95 return RegisterNativesImpl(env); |
| 96 } | 96 } |
| OLD | NEW |