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

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

Issue 2023293002: OfflinePageModel cleanups - improved CanSavePage() and moved static kInvalidOfflineId to impl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 <set>
9 #include <string>
8 #include <utility> 10 #include <utility>
11 #include <vector>
9 12
10 #include "base/android/jni_array.h" 13 #include "base/android/jni_array.h"
11 #include "base/android/jni_string.h" 14 #include "base/android/jni_string.h"
12 #include "chrome/browser/android/offline_pages/offline_page_mhtml_archiver.h" 15 #include "chrome/browser/android/offline_pages/offline_page_mhtml_archiver.h"
13 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" 16 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h"
14 #include "chrome/browser/android/offline_pages/offline_page_utils.h" 17 #include "chrome/browser/android/offline_pages/offline_page_utils.h"
15 #include "chrome/browser/android/offline_pages/request_coordinator_factory.h" 18 #include "chrome/browser/android/offline_pages/request_coordinator_factory.h"
16 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/profiles/profile_android.h" 20 #include "chrome/browser/profiles/profile_android.h"
18 #include "components/offline_pages/background/request_coordinator.h" 21 #include "components/offline_pages/background/request_coordinator.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 148
146 static jboolean IsBackgroundLoadingEnabled(JNIEnv* env, 149 static jboolean IsBackgroundLoadingEnabled(JNIEnv* env,
147 const JavaParamRef<jclass>& clazz) { 150 const JavaParamRef<jclass>& clazz) {
148 return offline_pages::IsOfflinePagesBackgroundLoadingEnabled(); 151 return offline_pages::IsOfflinePagesBackgroundLoadingEnabled();
149 } 152 }
150 153
151 static jboolean CanSavePage(JNIEnv* env, 154 static jboolean CanSavePage(JNIEnv* env,
152 const JavaParamRef<jclass>& clazz, 155 const JavaParamRef<jclass>& clazz,
153 const JavaParamRef<jstring>& j_url) { 156 const JavaParamRef<jstring>& j_url) {
154 GURL url(ConvertJavaStringToUTF8(env, j_url)); 157 GURL url(ConvertJavaStringToUTF8(env, j_url));
155 return url.is_valid() && OfflinePageModel::CanSavePage(url); 158 return OfflinePageUtils::CanSaveURL(url);
dewittj 2016/06/01 16:05:04 nit: just combine the two lines
dougarnett 2016/06/01 22:40:22 Done.
156 } 159 }
157 160
158 static ScopedJavaLocalRef<jobject> GetOfflinePageBridgeForProfile( 161 static ScopedJavaLocalRef<jobject> GetOfflinePageBridgeForProfile(
159 JNIEnv* env, 162 JNIEnv* env,
160 const JavaParamRef<jclass>& jcaller, 163 const JavaParamRef<jclass>& jcaller,
161 const JavaParamRef<jobject>& j_profile) { 164 const JavaParamRef<jobject>& j_profile) {
162 Profile* profile = ProfileAndroid::FromProfileAndroid(j_profile); 165 Profile* profile = ProfileAndroid::FromProfileAndroid(j_profile);
163 166
164 OfflinePageModel* offline_page_model = 167 OfflinePageModel* offline_page_model =
165 OfflinePageModelFactory::GetForBrowserContext(profile); 168 OfflinePageModelFactory::GetForBrowserContext(profile);
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 ConvertUTF8ToJavaString(env, client_id.name_space).obj(), 414 ConvertUTF8ToJavaString(env, client_id.name_space).obj(),
412 ConvertUTF8ToJavaString(env, client_id.id).obj()); 415 ConvertUTF8ToJavaString(env, client_id.id).obj());
413 } 416 }
414 417
415 bool RegisterOfflinePageBridge(JNIEnv* env) { 418 bool RegisterOfflinePageBridge(JNIEnv* env) {
416 return RegisterNativesImpl(env); 419 return RegisterNativesImpl(env);
417 } 420 }
418 421
419 } // namespace android 422 } // namespace android
420 } // namespace offline_pages 423 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698