Chromium Code Reviews| Index: chrome/browser/android/offline_pages/background_scheduler_bridge.cc |
| diff --git a/chrome/browser/android/offline_pages/background_scheduler_bridge.cc b/chrome/browser/android/offline_pages/background_scheduler_bridge.cc |
| index 41810ac56ae9c7dbeaec465750b350f34e209bbb..91e52d5bd39b2d713b1cfef9e5bf19c2f3ed816c 100644 |
| --- a/chrome/browser/android/offline_pages/background_scheduler_bridge.cc |
| +++ b/chrome/browser/android/offline_pages/background_scheduler_bridge.cc |
| @@ -2,14 +2,15 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| +#include "chrome/browser/android/offline_pages/background_scheduler_bridge.h" |
| #include "base/android/callback_android.h" |
| #include "base/android/scoped_java_ref.h" |
| -#include "chrome/browser/android/offline_pages/background_scheduler_bridge.h" |
| #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" |
| #include "chrome/browser/android/offline_pages/request_coordinator_factory.h" |
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/browser/profiles/profile_manager.h" |
| #include "components/offline_pages/core/background/device_conditions.h" |
| +#include "components/offline_pages/core/background/offliner.h" |
| #include "components/offline_pages/core/background/request_coordinator.h" |
| #include "jni/BackgroundSchedulerBridge_jni.h" |
| @@ -56,6 +57,19 @@ static jboolean StartScheduledProcessing( |
| device_conditions, base::Bind(&ProcessingDoneCallback, j_callback_ref)); |
| } |
| +// JNI call to stop request processing in scheduled mode. |
| +static void StopScheduledProcessing(JNIEnv* env, |
| + const JavaParamRef<jclass>& jcaller) { |
| + Profile* profile = ProfileManager::GetLastUsedProfile(); |
| + RequestCoordinator* coordinator = |
| + RequestCoordinatorFactory::GetInstance()->GetForBrowserContext(profile); |
| + DVLOG(2) << "resource_coordinator: " << coordinator; |
| + if (!coordinator) |
| + return; |
| + coordinator->StopProcessing( |
| + Offliner::RequestStatus::BACKGROUND_SCHEDULER_CANCELED); |
|
Pete Williamson
2017/02/28 20:17:49
After thinking about it and looking at the current
fgorski
2017/02/28 21:24:09
Done.
|
| +} |
| + |
| BackgroundSchedulerBridge::BackgroundSchedulerBridge() = default; |
| BackgroundSchedulerBridge::~BackgroundSchedulerBridge() = default; |