| 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 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 void NavigationPopup::Destroy(JNIEnv* env, jobject obj) { | 35 void NavigationPopup::Destroy(JNIEnv* env, jobject obj) { |
| 36 delete this; | 36 delete this; |
| 37 } | 37 } |
| 38 | 38 |
| 39 void NavigationPopup::FetchFaviconForUrl(JNIEnv* env, | 39 void NavigationPopup::FetchFaviconForUrl(JNIEnv* env, |
| 40 jobject obj, | 40 jobject obj, |
| 41 jstring jurl) { | 41 jstring jurl) { |
| 42 Profile* profile = g_browser_process->profile_manager()->GetLastUsedProfile(); | 42 Profile* profile = g_browser_process->profile_manager()->GetLastUsedProfile(); |
| 43 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( | 43 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( |
| 44 profile, Profile::EXPLICIT_ACCESS); | 44 profile, ServiceAccessType::EXPLICIT_ACCESS); |
| 45 if (!favicon_service) | 45 if (!favicon_service) |
| 46 return; | 46 return; |
| 47 GURL url(base::android::ConvertJavaStringToUTF16(env, jurl)); | 47 GURL url(base::android::ConvertJavaStringToUTF16(env, jurl)); |
| 48 // TODO(tedchoc): Request higher favicons based on screen density instead of | 48 // TODO(tedchoc): Request higher favicons based on screen density instead of |
| 49 // hardcoding kFaviconSize. | 49 // hardcoding kFaviconSize. |
| 50 favicon_service->GetFaviconImageForPageURL( | 50 favicon_service->GetFaviconImageForPageURL( |
| 51 url, | 51 url, |
| 52 base::Bind(&NavigationPopup::OnFaviconDataAvailable, | 52 base::Bind(&NavigationPopup::OnFaviconDataAvailable, |
| 53 base::Unretained(this), | 53 base::Unretained(this), |
| 54 url), | 54 url), |
| (...skipping 30 matching lines...) Expand all Loading... |
| 85 | 85 |
| 86 static jlong Init(JNIEnv* env, jobject obj) { | 86 static jlong Init(JNIEnv* env, jobject obj) { |
| 87 NavigationPopup* popup = new NavigationPopup(env, obj); | 87 NavigationPopup* popup = new NavigationPopup(env, obj); |
| 88 return reinterpret_cast<intptr_t>(popup); | 88 return reinterpret_cast<intptr_t>(popup); |
| 89 } | 89 } |
| 90 | 90 |
| 91 // static | 91 // static |
| 92 bool NavigationPopup::RegisterNavigationPopup(JNIEnv* env) { | 92 bool NavigationPopup::RegisterNavigationPopup(JNIEnv* env) { |
| 93 return RegisterNativesImpl(env); | 93 return RegisterNativesImpl(env); |
| 94 } | 94 } |
| OLD | NEW |