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

Side by Side Diff: components/offline_pages/background/request_coordinator.h

Issue 2177943005: Move user requested trigger conditions into policy object. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make more methods const Created 4 years, 4 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 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 #ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ 5 #ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_
6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ 6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 // a callback. If processing was already active, returns false. 55 // a callback. If processing was already active, returns false.
56 bool StartProcessing(const DeviceConditions& device_conditions, 56 bool StartProcessing(const DeviceConditions& device_conditions,
57 const base::Callback<void(bool)>& callback); 57 const base::Callback<void(bool)>& callback);
58 58
59 // Stops the current request processing if active. This is a way for 59 // Stops the current request processing if active. This is a way for
60 // caller to abort processing; otherwise, processing will complete on 60 // caller to abort processing; otherwise, processing will complete on
61 // its own. In either case, the callback will be called when processing 61 // its own. In either case, the callback will be called when processing
62 // is stopped or complete. 62 // is stopped or complete.
63 void StopProcessing(); 63 void StopProcessing();
64 64
65 // TODO(dougarnett): Move to OfflinerPolicy in some form. 65 const Scheduler::TriggerConditions GetTriggerConditionsForUserRequest();
66 const Scheduler::TriggerConditions& GetTriggerConditionsForUserRequest();
67 66
68 // A way for tests to set the callback in use when an operation is over. 67 // A way for tests to set the callback in use when an operation is over.
69 void SetProcessingCallbackForTest(const base::Callback<void(bool)> callback) { 68 void SetProcessingCallbackForTest(const base::Callback<void(bool)> callback) {
70 scheduler_callback_ = callback; 69 scheduler_callback_ = callback;
71 } 70 }
72 71
73 // Returns the request queue used for requests. Coordinator keeps ownership. 72 // Returns the request queue used for requests. Coordinator keeps ownership.
74 RequestQueue* queue() { return queue_.get(); } 73 RequestQueue* queue() { return queue_.get(); }
75 74
76 // Return an unowned pointer to the Scheduler. 75 // Return an unowned pointer to the Scheduler.
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 base::OneShotTimer watchdog_timer_; 161 base::OneShotTimer watchdog_timer_;
163 // Allows us to pass a weak pointer to callbacks. 162 // Allows us to pass a weak pointer to callbacks.
164 base::WeakPtrFactory<RequestCoordinator> weak_ptr_factory_; 163 base::WeakPtrFactory<RequestCoordinator> weak_ptr_factory_;
165 164
166 DISALLOW_COPY_AND_ASSIGN(RequestCoordinator); 165 DISALLOW_COPY_AND_ASSIGN(RequestCoordinator);
167 }; 166 };
168 167
169 } // namespace offline_pages 168 } // namespace offline_pages
170 169
171 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ 170 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_
OLDNEW
« no previous file with comments | « components/offline_pages/background/offliner_policy.h ('k') | components/offline_pages/background/request_coordinator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698