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

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

Issue 2361883002: [Offline Pages] Adds classification of some prerender FinalStatus codes as canceled operations or a… (Closed)
Patch Set: Merge Created 4 years, 2 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_OFFLINER_H_ 5 #ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_H_
6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_H_ 6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 24 matching lines...) Expand all
35 // Prerendering failed to load page. 35 // Prerendering failed to load page.
36 PRERENDERING_FAILED = 5, 36 PRERENDERING_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 // The loader did not accept/start the request.
44 PRERENDERING_NOT_STARTED = 9, 44 PRERENDERING_NOT_STARTED = 9,
45 // Prerendering failed with hard error so should not retry the request.
46 PRERENDERING_FAILED_NO_RETRY = 10,
45 // NOTE: insert new values above this line and update histogram enum too. 47 // NOTE: insert new values above this line and update histogram enum too.
46 STATUS_COUNT 48 STATUS_COUNT
47 }; 49 };
48 50
49 // Reports the completion status of a request. 51 // Reports the completion status of a request.
50 // TODO(dougarnett): consider passing back a request id instead of request. 52 // TODO(dougarnett): consider passing back a request id instead of request.
51 typedef base::Callback<void(const SavePageRequest&, RequestStatus)> 53 typedef base::Callback<void(const SavePageRequest&, RequestStatus)>
52 CompletionCallback; 54 CompletionCallback;
53 55
54 Offliner() {} 56 Offliner() {}
55 virtual ~Offliner() {} 57 virtual ~Offliner() {}
56 58
57 // Processes |request| to load and save an offline page. 59 // Processes |request| to load and save an offline page.
58 // Returns whether the request was accepted or not. |callback| is guaranteed 60 // Returns whether the request was accepted or not. |callback| is guaranteed
59 // to be called if the request was accepted and |Cancel()| is not called. 61 // to be called if the request was accepted and |Cancel()| is not called.
60 virtual bool LoadAndSave( 62 virtual bool LoadAndSave(
61 const SavePageRequest& request, 63 const SavePageRequest& request,
62 const CompletionCallback& callback) = 0; 64 const CompletionCallback& callback) = 0;
63 65
64 // Clears the currently processing request, if any, and skips running its 66 // Clears the currently processing request, if any, and skips running its
65 // CompletionCallback. 67 // CompletionCallback.
66 virtual void Cancel() = 0; 68 virtual void Cancel() = 0;
67 69
68 // TODO(dougarnett): add policy support methods. 70 // TODO(dougarnett): add policy support methods.
69 }; 71 };
70 72
71 } // namespace offline_pages 73 } // namespace offline_pages
72 74
73 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_H_ 75 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698