Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 144 } | 147 } |
| 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 return OfflinePageModel::CanSaveURL(ConvertJavaStringToUTF8(env, j_url)); |
|
fgorski
2016/06/02 16:41:56
As you've noticed compilers are not happy, because
dougarnett
2016/06/02 18:30:55
Thanks - I do wonder now about the nit then - seem
| |
| 155 return url.is_valid() && OfflinePageModel::CanSavePage(url); | |
| 156 } | 158 } |
| 157 | 159 |
| 158 static ScopedJavaLocalRef<jobject> GetOfflinePageBridgeForProfile( | 160 static ScopedJavaLocalRef<jobject> GetOfflinePageBridgeForProfile( |
| 159 JNIEnv* env, | 161 JNIEnv* env, |
| 160 const JavaParamRef<jclass>& jcaller, | 162 const JavaParamRef<jclass>& jcaller, |
| 161 const JavaParamRef<jobject>& j_profile) { | 163 const JavaParamRef<jobject>& j_profile) { |
| 162 Profile* profile = ProfileAndroid::FromProfileAndroid(j_profile); | 164 Profile* profile = ProfileAndroid::FromProfileAndroid(j_profile); |
| 163 | 165 |
| 164 OfflinePageModel* offline_page_model = | 166 OfflinePageModel* offline_page_model = |
| 165 OfflinePageModelFactory::GetForBrowserContext(profile); | 167 OfflinePageModelFactory::GetForBrowserContext(profile); |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 411 ConvertUTF8ToJavaString(env, client_id.name_space).obj(), | 413 ConvertUTF8ToJavaString(env, client_id.name_space).obj(), |
| 412 ConvertUTF8ToJavaString(env, client_id.id).obj()); | 414 ConvertUTF8ToJavaString(env, client_id.id).obj()); |
| 413 } | 415 } |
| 414 | 416 |
| 415 bool RegisterOfflinePageBridge(JNIEnv* env) { | 417 bool RegisterOfflinePageBridge(JNIEnv* env) { |
| 416 return RegisterNativesImpl(env); | 418 return RegisterNativesImpl(env); |
| 417 } | 419 } |
| 418 | 420 |
| 419 } // namespace android | 421 } // namespace android |
| 420 } // namespace offline_pages | 422 } // namespace offline_pages |
| OLD | NEW |