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

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: Reworked per feedback 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 22 matching lines...) Expand all
33 // Prerendering was canceled. 33 // Prerendering was canceled.
34 PRERENDERING_CANCELED = 4, 34 PRERENDERING_CANCELED = 4,
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 // Prerendering failed with hard error so should not retry the request.
44 PRERENDERING_FAILED_NO_RETRY = 9,
43 // NOTE: insert new values above this line and update histogram enum too. 45 // NOTE: insert new values above this line and update histogram enum too.
44 STATUS_COUNT 46 STATUS_COUNT
45 }; 47 };
46 48
47 // Reports the completion status of a request. 49 // Reports the completion status of a request.
48 // TODO(dougarnett): consider passing back a request id instead of request. 50 // TODO(dougarnett): consider passing back a request id instead of request.
49 typedef base::Callback<void(const SavePageRequest&, RequestStatus)> 51 typedef base::Callback<void(const SavePageRequest&, RequestStatus)>
50 CompletionCallback; 52 CompletionCallback;
51 53
52 Offliner() {} 54 Offliner() {}
53 virtual ~Offliner() {} 55 virtual ~Offliner() {}
54 56
55 // Processes |request| to load and save an offline page. 57 // Processes |request| to load and save an offline page.
56 // Returns whether the request was accepted or not. |callback| is guaranteed 58 // Returns whether the request was accepted or not. |callback| is guaranteed
57 // to be called if the request was accepted and |Cancel()| is not called. 59 // to be called if the request was accepted and |Cancel()| is not called.
58 virtual bool LoadAndSave( 60 virtual bool LoadAndSave(
59 const SavePageRequest& request, 61 const SavePageRequest& request,
60 const CompletionCallback& callback) = 0; 62 const CompletionCallback& callback) = 0;
61 63
62 // Clears the currently processing request, if any, and skips running its 64 // Clears the currently processing request, if any, and skips running its
63 // CompletionCallback. 65 // CompletionCallback.
64 virtual void Cancel() = 0; 66 virtual void Cancel() = 0;
65 67
66 // TODO(dougarnett): add policy support methods. 68 // TODO(dougarnett): add policy support methods.
67 }; 69 };
68 70
69 } // namespace offline_pages 71 } // namespace offline_pages
70 72
71 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_H_ 73 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698