OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/favicon_helper.h" | 5 #include "chrome/browser/android/favicon_helper.h" |
6 | 6 |
7 #include <jni.h> | 7 #include <jni.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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 if (!profile) | 83 if (!profile) |
84 return false; | 84 return false; |
85 | 85 |
86 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( | 86 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( |
87 profile, Profile::EXPLICIT_ACCESS); | 87 profile, Profile::EXPLICIT_ACCESS); |
88 DCHECK(favicon_service); | 88 DCHECK(favicon_service); |
89 if (!favicon_service) | 89 if (!favicon_service) |
90 return false; | 90 return false; |
91 | 91 |
92 FaviconService::FaviconForURLParams params( | 92 FaviconService::FaviconForURLParams params( |
93 profile, | |
94 GURL(ConvertJavaStringToUTF16(env, j_page_url)), | 93 GURL(ConvertJavaStringToUTF16(env, j_page_url)), |
95 static_cast<int>(j_icon_types), | 94 static_cast<int>(j_icon_types), |
96 static_cast<int>(j_desired_size_in_dip)); | 95 static_cast<int>(j_desired_size_in_dip)); |
97 | 96 |
98 ScopedJavaGlobalRef<jobject>* j_scoped_favicon_callback = | 97 ScopedJavaGlobalRef<jobject>* j_scoped_favicon_callback = |
99 new ScopedJavaGlobalRef<jobject>(); | 98 new ScopedJavaGlobalRef<jobject>(); |
100 j_scoped_favicon_callback->Reset(env, j_favicon_image_callback); | 99 j_scoped_favicon_callback->Reset(env, j_favicon_image_callback); |
101 | 100 |
102 FaviconService::FaviconImageCallback callback_runner = base::Bind( | 101 FaviconService::FaviconImageCallback callback_runner = base::Bind( |
103 &OnLocalFaviconAvailable, base::Owned(j_scoped_favicon_callback)); | 102 &OnLocalFaviconAvailable, base::Owned(j_scoped_favicon_callback)); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 return color_utils::CalculateKMeanColorOfPNG( | 159 return color_utils::CalculateKMeanColorOfPNG( |
161 png_data, min_darkness, max_brightness, &sampler); | 160 png_data, min_darkness, max_brightness, &sampler); |
162 } | 161 } |
163 | 162 |
164 FaviconHelper::~FaviconHelper() {} | 163 FaviconHelper::~FaviconHelper() {} |
165 | 164 |
166 // static | 165 // static |
167 bool FaviconHelper::RegisterFaviconHelper(JNIEnv* env) { | 166 bool FaviconHelper::RegisterFaviconHelper(JNIEnv* env) { |
168 return RegisterNativesImpl(env); | 167 return RegisterNativesImpl(env); |
169 } | 168 } |
OLD | NEW |