Chromium Code Reviews| Index: chrome/browser/android/offline_pages/offline_page_bridge.cc |
| diff --git a/chrome/browser/android/offline_pages/offline_page_bridge.cc b/chrome/browser/android/offline_pages/offline_page_bridge.cc |
| index 830d91d2e2a1fac8303818a9c504ecb89f7ea034..1669344d52d74cf158356c06b9b8bb1aa81b03d7 100644 |
| --- a/chrome/browser/android/offline_pages/offline_page_bridge.cc |
| +++ b/chrome/browser/android/offline_pages/offline_page_bridge.cc |
| @@ -12,8 +12,11 @@ |
| #include "chrome/browser/android/offline_pages/offline_page_mhtml_archiver.h" |
| #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" |
| #include "chrome/browser/android/offline_pages/offline_page_utils.h" |
| +#include "chrome/browser/android/offline_pages/request_coordinator_factory.h" |
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/browser/profiles/profile_android.h" |
| +#include "components/offline_pages/background/request_coordinator.h" |
| +#include "components/offline_pages/background/save_page_request.h" |
| #include "components/offline_pages/offline_page_feature.h" |
| #include "components/offline_pages/offline_page_item.h" |
| #include "components/offline_pages/offline_page_model.h" |
| @@ -316,6 +319,33 @@ void OfflinePageBridge::SavePage( |
| base::Bind(&SavePageCallback, j_callback_ref, url)); |
| } |
| +void OfflinePageBridge::SavePageLater( |
| + JNIEnv* env, |
| + const JavaParamRef<jobject>& obj, |
| + const JavaParamRef<jstring>& j_url, |
| + const JavaParamRef<jstring>& j_client_id_namespace, |
| + const JavaParamRef<jstring>& j_client_id) { |
| + // TODO(petewil): We want a more robust scheme for allocating new IDs. |
| + static int64_t id = 0; |
| + offline_pages::ClientId client_id; |
| + client_id.name_space = ConvertJavaStringToUTF8(env, j_client_id_namespace); |
| + client_id.id = ConvertJavaStringToUTF8(env, j_client_id); |
| + |
| + offline_pages::SavePageRequest request( |
|
fgorski
2016/05/06 07:03:09
Pete, use the same signature as for SavePage:
url
Pete Williamson
2016/05/06 18:28:13
Done. I had been following the interface spec tha
|
| + id++, |
| + GURL(ConvertJavaStringToUTF8(env, j_url)), |
| + client_id, |
| + base::Time::Now()); |
| + |
| + // Get a background request coordinator. |
| + RequestCoordinator* coordinator = |
| + offline_pages::RequestCoordinatorFactory::GetInstance()-> |
| + GetForBrowserContext(browser_context_); |
| + |
| + // Make a request to the background offliner. |
| + coordinator->SavePageLater(request); |
| +} |
| + |
| void OfflinePageBridge::DeletePages( |
| JNIEnv* env, |
| const JavaParamRef<jobject>& obj, |