Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: chrome/browser/android/favicon_helper.cc

Issue 839193002: Move ServiceAccessType into //components/keyed_service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compilation on android Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/android/provider/chrome_browser_provider.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_array.h" 10 #include "base/android/jni_array.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 jstring j_page_url, 109 jstring j_page_url,
110 jint j_icon_types, 110 jint j_icon_types,
111 jint j_desired_size_in_pixel, 111 jint j_desired_size_in_pixel,
112 jobject j_favicon_image_callback) { 112 jobject j_favicon_image_callback) {
113 Profile* profile = ProfileAndroid::FromProfileAndroid(j_profile); 113 Profile* profile = ProfileAndroid::FromProfileAndroid(j_profile);
114 DCHECK(profile); 114 DCHECK(profile);
115 if (!profile) 115 if (!profile)
116 return false; 116 return false;
117 117
118 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( 118 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile(
119 profile, Profile::EXPLICIT_ACCESS); 119 profile, ServiceAccessType::EXPLICIT_ACCESS);
120 DCHECK(favicon_service); 120 DCHECK(favicon_service);
121 if (!favicon_service) 121 if (!favicon_service)
122 return false; 122 return false;
123 123
124 ScopedJavaGlobalRef<jobject>* j_scoped_favicon_callback = 124 ScopedJavaGlobalRef<jobject>* j_scoped_favicon_callback =
125 new ScopedJavaGlobalRef<jobject>(); 125 new ScopedJavaGlobalRef<jobject>();
126 j_scoped_favicon_callback->Reset(env, j_favicon_image_callback); 126 j_scoped_favicon_callback->Reset(env, j_favicon_image_callback);
127 127
128 favicon_base::FaviconRawBitmapCallback callback_runner = base::Bind( 128 favicon_base::FaviconRawBitmapCallback callback_runner = base::Bind(
129 &OnLocalFaviconAvailable, base::Owned(j_scoped_favicon_callback)); 129 &OnLocalFaviconAvailable, base::Owned(j_scoped_favicon_callback));
(...skipping 15 matching lines...) Expand all
145 jstring j_page_url, 145 jstring j_page_url,
146 jintArray j_icon_types, 146 jintArray j_icon_types,
147 jint j_min_size_threshold_px, 147 jint j_min_size_threshold_px,
148 jobject j_favicon_image_callback) { 148 jobject j_favicon_image_callback) {
149 Profile* profile = ProfileAndroid::FromProfileAndroid(j_profile); 149 Profile* profile = ProfileAndroid::FromProfileAndroid(j_profile);
150 DCHECK(profile); 150 DCHECK(profile);
151 if (!profile) 151 if (!profile)
152 return; 152 return;
153 153
154 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( 154 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile(
155 profile, Profile::EXPLICIT_ACCESS); 155 profile, ServiceAccessType::EXPLICIT_ACCESS);
156 DCHECK(favicon_service); 156 DCHECK(favicon_service);
157 if (!favicon_service) 157 if (!favicon_service)
158 return; 158 return;
159 159
160 std::vector<int> icon_types; 160 std::vector<int> icon_types;
161 base::android::JavaIntArrayToIntVector(env, j_icon_types, &icon_types); 161 base::android::JavaIntArrayToIntVector(env, j_icon_types, &icon_types);
162 162
163 ScopedJavaGlobalRef<jobject>* j_scoped_favicon_callback = 163 ScopedJavaGlobalRef<jobject>* j_scoped_favicon_callback =
164 new ScopedJavaGlobalRef<jobject>(); 164 new ScopedJavaGlobalRef<jobject>();
165 j_scoped_favicon_callback->Reset(env, j_favicon_image_callback); 165 j_scoped_favicon_callback->Reset(env, j_favicon_image_callback);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 218
219 gfx::JavaBitmap bitmap_lock(bitmap); 219 gfx::JavaBitmap bitmap_lock(bitmap);
220 SkBitmap skbitmap = gfx::CreateSkBitmapFromJavaBitmap(bitmap_lock); 220 SkBitmap skbitmap = gfx::CreateSkBitmapFromJavaBitmap(bitmap_lock);
221 return color_utils::CalculateKMeanColorOfBitmap(skbitmap); 221 return color_utils::CalculateKMeanColorOfBitmap(skbitmap);
222 } 222 }
223 223
224 // static 224 // static
225 bool FaviconHelper::RegisterFaviconHelper(JNIEnv* env) { 225 bool FaviconHelper::RegisterFaviconHelper(JNIEnv* env) {
226 return RegisterNativesImpl(env); 226 return RegisterNativesImpl(env);
227 } 227 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/provider/chrome_browser_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698