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

Side by Side Diff: chrome/browser/android/offline_pages/offline_page_bridge.cc

Issue 1959393002: Choose the best offline page when given an online URL. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address nits. Created 4 years, 7 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/offline_pages/offline_page_bridge.h" 5 #include "chrome/browser/android/offline_pages/offline_page_bridge.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/android/jni_array.h" 10 #include "base/android/jni_array.h"
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 JNIEnv* env, 259 JNIEnv* env,
260 const JavaParamRef<jobject>& obj, 260 const JavaParamRef<jobject>& obj,
261 jlong offline_id) { 261 jlong offline_id) {
262 const OfflinePageItem* offline_page = 262 const OfflinePageItem* offline_page =
263 offline_page_model_->MaybeGetPageByOfflineId(offline_id); 263 offline_page_model_->MaybeGetPageByOfflineId(offline_id);
264 if (!offline_page) 264 if (!offline_page)
265 return ScopedJavaLocalRef<jobject>(); 265 return ScopedJavaLocalRef<jobject>();
266 return CreateOfflinePageItem(env, *offline_page); 266 return CreateOfflinePageItem(env, *offline_page);
267 } 267 }
268 268
269 ScopedJavaLocalRef<jobject> OfflinePageBridge::GetPageByOnlineURL( 269 ScopedJavaLocalRef<jobject> OfflinePageBridge::GetBestPageForOnlineURL(
270 JNIEnv* env, 270 JNIEnv* env,
271 const JavaParamRef<jobject>& obj, 271 const JavaParamRef<jobject>& obj,
272 const JavaParamRef<jstring>& online_url) { 272 const JavaParamRef<jstring>& online_url) {
273 const OfflinePageItem* offline_page = 273 const OfflinePageItem* offline_page =
274 offline_page_model_->MaybeGetPageByOnlineURL( 274 offline_page_model_->MaybeGetBestPageForOnlineURL(
275 GURL(ConvertJavaStringToUTF8(env, online_url))); 275 GURL(ConvertJavaStringToUTF8(env, online_url)));
276 if (!offline_page) 276 if (!offline_page)
277 return ScopedJavaLocalRef<jobject>(); 277 return ScopedJavaLocalRef<jobject>();
278 return CreateOfflinePageItem(env, *offline_page); 278 return CreateOfflinePageItem(env, *offline_page);
279 } 279 }
280 280
281 ScopedJavaLocalRef<jobject> OfflinePageBridge::GetPageByOfflineUrl( 281 ScopedJavaLocalRef<jobject> OfflinePageBridge::GetPageByOfflineUrl(
282 JNIEnv* env, 282 JNIEnv* env,
283 const JavaParamRef<jobject>& obj, 283 const JavaParamRef<jobject>& obj,
284 const JavaParamRef<jstring>& j_offline_url) { 284 const JavaParamRef<jstring>& j_offline_url) {
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 ConvertUTF8ToJavaString(env, client_id.name_space).obj(), 399 ConvertUTF8ToJavaString(env, client_id.name_space).obj(),
400 ConvertUTF8ToJavaString(env, client_id.id).obj()); 400 ConvertUTF8ToJavaString(env, client_id.id).obj());
401 } 401 }
402 402
403 bool RegisterOfflinePageBridge(JNIEnv* env) { 403 bool RegisterOfflinePageBridge(JNIEnv* env) {
404 return RegisterNativesImpl(env); 404 return RegisterNativesImpl(env);
405 } 405 }
406 406
407 } // namespace android 407 } // namespace android
408 } // namespace offline_pages 408 } // namespace offline_pages
OLDNEW
« no previous file with comments | « chrome/browser/android/offline_pages/offline_page_bridge.h ('k') | chrome/browser/android/offline_pages/offline_page_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698