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

Side by Side Diff: components/offline_pages/core/background/offliner_stub.h

Issue 2836863002: [Offline pages] Removing active_request_ from request coordinator (Closed)
Patch Set: Addressing code review feedback and fixing app status change bug Created 3 years, 8 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_CORE_BACKGROUND_OFFLINER_STUB_H_ 5 #ifndef COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_OFFLINER_STUB_H_
6 #define COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_OFFLINER_STUB_H_ 6 #define COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_OFFLINER_STUB_H_
7 7
8 #include <memory>
9
10 #include "base/callback_forward.h"
8 #include "components/offline_pages/core/background/offliner.h" 11 #include "components/offline_pages/core/background/offliner.h"
9 12
10 namespace offline_pages { 13 namespace offline_pages {
11 14
12 // Test class stubbing out the functionality of Offliner. 15 // Test class stubbing out the functionality of Offliner.
13 // It is only used for test support. 16 // It is only used for test support.
14 class OfflinerStub : public Offliner { 17 class OfflinerStub : public Offliner {
15 public: 18 public:
16 OfflinerStub(); 19 OfflinerStub();
17 ~OfflinerStub() override; 20 ~OfflinerStub() override;
18 21
19 bool LoadAndSave(const SavePageRequest& request, 22 bool LoadAndSave(const SavePageRequest& request,
20 const CompletionCallback& completion_callback, 23 const CompletionCallback& completion_callback,
21 const ProgressCallback& progress_callback) override; 24 const ProgressCallback& progress_callback) override;
22 25
23 void Cancel(const CancelCallback& callback) override; 26 bool Cancel(const CancelCallback& callback) override;
27
28 bool HandleTimeout(int64_t request_id) override;
24 29
25 void disable_loading() { disable_loading_ = true; } 30 void disable_loading() { disable_loading_ = true; }
26 31
27 void enable_callback(bool enable) { enable_callback_ = enable; } 32 void enable_callback(bool enable) { enable_callback_ = enable; }
28 33
29 bool cancel_called() { return cancel_called_; } 34 bool cancel_called() { return cancel_called_; }
30 35
31 void reset_cancel_called() { cancel_called_ = false; } 36 void reset_cancel_called() { cancel_called_ = false; }
32 37
33 bool HandleTimeout(const SavePageRequest& request) override;
34
35 void enable_snapshot_on_last_retry() { snapshot_on_last_retry_ = true; } 38 void enable_snapshot_on_last_retry() { snapshot_on_last_retry_ = true; }
36 39
37 private: 40 private:
38 CompletionCallback completion_callback_; 41 base::Closure completion_callback_;
39 ProgressCallback progress_callback_; 42 std::unique_ptr<SavePageRequest> pending_request_;
40 bool disable_loading_; 43 bool disable_loading_;
41 bool enable_callback_; 44 bool enable_callback_;
42 bool cancel_called_; 45 bool cancel_called_;
43 bool snapshot_on_last_retry_; 46 bool snapshot_on_last_retry_;
44 }; 47 };
45 48
46 } // namespace offline_pages 49 } // namespace offline_pages
47 50
48 #endif // COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_OFFLINER_STUB_H_ 51 #endif // COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_OFFLINER_STUB_H_
OLDNEW
« no previous file with comments | « components/offline_pages/core/background/offliner.h ('k') | components/offline_pages/core/background/offliner_stub.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698