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

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

Issue 2608553002: [OfflinePages] Improve visiblity/handling of "Loading not started" case (Closed)
Patch Set: Addes ! low-end device default to test Setup Created 3 years, 11 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_H_ 5 #ifndef COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_OFFLINER_H_
6 #define COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_OFFLINER_H_ 6 #define COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_OFFLINER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 22 matching lines...) Expand all
33 // Loading was canceled. 33 // Loading was canceled.
34 LOADING_CANCELED = 4, 34 LOADING_CANCELED = 4,
35 // Loader failed to load page. 35 // Loader failed to load page.
36 LOADING_FAILED = 5, 36 LOADING_FAILED = 5,
37 // Failed to save loaded page. 37 // Failed to save loaded page.
38 SAVE_FAILED = 6, 38 SAVE_FAILED = 6,
39 // Foreground transition canceled request. 39 // Foreground transition canceled request.
40 FOREGROUND_CANCELED = 7, 40 FOREGROUND_CANCELED = 7,
41 // RequestCoordinator canceled request attempt per time limit. 41 // RequestCoordinator canceled request attempt per time limit.
42 REQUEST_COORDINATOR_TIMED_OUT = 8, 42 REQUEST_COORDINATOR_TIMED_OUT = 8,
43 // The loader did not accept/start the request. 43 // Deprecated. The RequestCoordinator did not start loading the request.
44 LOADING_NOT_STARTED = 9, 44 DEPRECATED_LOADING_NOT_STARTED = 9,
45 // Loader failed with hard error so should not retry the request. 45 // Loader failed with hard error so should not retry the request.
46 LOADING_FAILED_NO_RETRY = 10, 46 LOADING_FAILED_NO_RETRY = 10,
47 // Loader failed with some error that suggests we should not continue 47 // Loader failed with some error that suggests we should not continue
48 // processing another request at this time. 48 // processing another request at this time.
49 LOADING_FAILED_NO_NEXT = 11, 49 LOADING_FAILED_NO_NEXT = 11,
50 // The RequestCoordinator tried to start loading the request but the
51 // loading request was not accepted.
52 LOADING_NOT_ACCEPTED = 12,
53 // The RequestCoordinator did not start loading the request because
54 // updating the status in the request queue failed.
55 QUEUE_UPDATE_FAILED = 13,
50 // NOTE: insert new values above this line and update histogram enum too. 56 // NOTE: insert new values above this line and update histogram enum too.
51 STATUS_COUNT 57 STATUS_COUNT
52 }; 58 };
53 59
54 // Reports the completion status of a request. 60 // Reports the completion status of a request.
55 // TODO(dougarnett): consider passing back a request id instead of request. 61 // TODO(dougarnett): consider passing back a request id instead of request.
56 typedef base::Callback<void(const SavePageRequest&, RequestStatus)> 62 typedef base::Callback<void(const SavePageRequest&, RequestStatus)>
57 CompletionCallback; 63 CompletionCallback;
58 64
59 Offliner() {} 65 Offliner() {}
60 virtual ~Offliner() {} 66 virtual ~Offliner() {}
61 67
62 // Processes |request| to load and save an offline page. 68 // Processes |request| to load and save an offline page.
63 // Returns whether the request was accepted or not. |callback| is guaranteed 69 // Returns whether the request was accepted or not. |callback| is guaranteed
64 // to be called if the request was accepted and |Cancel()| is not called. 70 // to be called if the request was accepted and |Cancel()| is not called.
65 virtual bool LoadAndSave(const SavePageRequest& request, 71 virtual bool LoadAndSave(const SavePageRequest& request,
66 const CompletionCallback& callback) = 0; 72 const CompletionCallback& callback) = 0;
67 73
68 // Clears the currently processing request, if any, and skips running its 74 // Clears the currently processing request, if any, and skips running its
69 // CompletionCallback. 75 // CompletionCallback.
70 virtual void Cancel() = 0; 76 virtual void Cancel() = 0;
71 77
72 // TODO(dougarnett): add policy support methods. 78 // TODO(dougarnett): add policy support methods.
73 }; 79 };
74 80
75 } // namespace offline_pages 81 } // namespace offline_pages
76 82
77 #endif // COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_OFFLINER_H_ 83 #endif // COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_OFFLINER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698