| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/evaluation/evaluation_test_schedu
ler.h" | 5 #include "chrome/browser/android/offline_pages/evaluation/evaluation_test_schedu
ler.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/threading/thread_task_runner_handle.h" | 8 #include "base/threading/thread_task_runner_handle.h" |
| 9 #include "chrome/browser/android/offline_pages/request_coordinator_factory.h" | 9 #include "chrome/browser/android/offline_pages/request_coordinator_factory.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 void GetAllRequestsDone( | 32 void GetAllRequestsDone( |
| 33 std::vector<std::unique_ptr<SavePageRequest>> requests) { | 33 std::vector<std::unique_ptr<SavePageRequest>> requests) { |
| 34 if (requests.size() > 0) { | 34 if (requests.size() > 0) { |
| 35 Profile* profile = ProfileManager::GetLastUsedProfile(); | 35 Profile* profile = ProfileManager::GetLastUsedProfile(); |
| 36 RequestCoordinator* coordinator = | 36 RequestCoordinator* coordinator = |
| 37 RequestCoordinatorFactory::GetInstance()->GetForBrowserContext(profile); | 37 RequestCoordinatorFactory::GetInstance()->GetForBrowserContext(profile); |
| 38 // TODO(romax) Maybe get current real condition. | 38 // TODO(romax) Maybe get current real condition. |
| 39 DeviceConditions device_conditions( | 39 DeviceConditions device_conditions( |
| 40 true, 0, net::NetworkChangeNotifier::ConnectionType::CONNECTION_WIFI); | 40 true, 0, net::NetworkChangeNotifier::ConnectionType::CONNECTION_WIFI); |
| 41 coordinator->StartProcessing(device_conditions, | 41 coordinator->StartScheduledProcessing(device_conditions, |
| 42 base::Bind(&ProcessingDoneCallback)); | 42 base::Bind(&ProcessingDoneCallback)); |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 | 45 |
| 46 void StartProcessing() { | 46 void StartProcessing() { |
| 47 Profile* profile = ProfileManager::GetLastUsedProfile(); | 47 Profile* profile = ProfileManager::GetLastUsedProfile(); |
| 48 RequestCoordinator* coordinator = | 48 RequestCoordinator* coordinator = |
| 49 RequestCoordinatorFactory::GetInstance()->GetForBrowserContext(profile); | 49 RequestCoordinatorFactory::GetInstance()->GetForBrowserContext(profile); |
| 50 coordinator->GetAllRequests(base::Bind(&GetAllRequestsDone)); | 50 coordinator->GetAllRequests(base::Bind(&GetAllRequestsDone)); |
| 51 } | 51 } |
| 52 | 52 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 74 | 74 |
| 75 void EvaluationTestScheduler::Unschedule() {} | 75 void EvaluationTestScheduler::Unschedule() {} |
| 76 | 76 |
| 77 void EvaluationTestScheduler::ImmediateScheduleCallback(bool result) { | 77 void EvaluationTestScheduler::ImmediateScheduleCallback(bool result) { |
| 78 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, | 78 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, |
| 79 base::Bind(&StartProcessing)); | 79 base::Bind(&StartProcessing)); |
| 80 } | 80 } |
| 81 | 81 |
| 82 } // namespace android | 82 } // namespace android |
| 83 } // namespace offline_pages | 83 } // namespace offline_pages |
| OLD | NEW |