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

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

Issue 2751253004: [Offline Pages] Add UMA to record final offline request status and loading failed error code. (Closed)
Patch Set: fix unit test so DidFinishNavigation is only called once Created 3 years, 9 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_REQUEST_NOTIFIER_H_ 5 #ifndef COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_REQUEST_NOTIFIER_H_
6 #define COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_REQUEST_NOTIFIER_H_ 6 #define COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_REQUEST_NOTIFIER_H_
7 7
8 namespace offline_pages { 8 namespace offline_pages {
9 9
10 class SavePageRequest; 10 class SavePageRequest;
11 11
12 class RequestNotifier { 12 class RequestNotifier {
13 public: 13 public:
14 // Status to return for failed notifications. 14 // Status to return for failed notifications.
15 // NOTE: for any changes to the enum, please also update related switch code 15 // NOTE: for any changes to the enum, please also update related switch code
16 // in RequestCoordinatorEventLogger. 16 // in RequestCoordinatorEventLogger.
17 // GENERATED_JAVA_ENUM_PACKAGE:org.chromium.components.offlinepages 17 // GENERATED_JAVA_ENUM_PACKAGE:org.chromium.components.offlinepages
18 // WARNING: You must update histograms.xml to match any changes made to
19 // this enum (ie, histogram enum for OfflinePagesBackgroundSavePageResult).
18 enum class BackgroundSavePageResult { 20 enum class BackgroundSavePageResult {
19 SUCCESS, 21 SUCCESS = 0,
20 LOADING_FAILURE, 22 LOADING_FAILURE = 1,
21 LOADING_CANCELED, 23 LOADING_CANCELED = 2,
22 FOREGROUND_CANCELED, 24 FOREGROUND_CANCELED = 3,
23 SAVE_FAILED, 25 SAVE_FAILED = 4,
24 EXPIRED, 26 EXPIRED = 5,
25 RETRY_COUNT_EXCEEDED, 27 RETRY_COUNT_EXCEEDED = 6,
26 START_COUNT_EXCEEDED, 28 START_COUNT_EXCEEDED = 7,
27 REMOVED, 29 REMOVED = 8,
30 // NOTE: insert new values above this line and update histogram enum too.
31 STATUS_COUNT
28 }; 32 };
29 33
30 virtual ~RequestNotifier() = default; 34 virtual ~RequestNotifier() = default;
31 35
32 // Notifies observers that |request| has been added. 36 // Notifies observers that |request| has been added.
33 virtual void NotifyAdded(const SavePageRequest& request) = 0; 37 virtual void NotifyAdded(const SavePageRequest& request) = 0;
34 38
35 // Notifies observers that |request| has been completed with |status|. 39 // Notifies observers that |request| has been completed with |status|.
36 virtual void NotifyCompleted(const SavePageRequest& request, 40 virtual void NotifyCompleted(const SavePageRequest& request,
37 BackgroundSavePageResult status) = 0; 41 BackgroundSavePageResult status) = 0;
38 42
39 // Notifies observers that |request| has been changed. 43 // Notifies observers that |request| has been changed.
40 virtual void NotifyChanged(const SavePageRequest& request) = 0; 44 virtual void NotifyChanged(const SavePageRequest& request) = 0;
41 45
42 // Notifies observers of progress on |request|, which received 46 // Notifies observers of progress on |request|, which received
43 // |received_bytes| at that point. 47 // |received_bytes| at that point.
44 virtual void NotifyNetworkProgress(const SavePageRequest& request, 48 virtual void NotifyNetworkProgress(const SavePageRequest& request,
45 int64_t received_bytes) = 0; 49 int64_t received_bytes) = 0;
46 }; 50 };
47 51
48 } // namespace offline_pages 52 } // namespace offline_pages
49 53
50 #endif // COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_REQUEST_NOTIFIER_H_ 54 #endif // COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_REQUEST_NOTIFIER_H_
OLDNEW
« no previous file with comments | « components/offline_pages/core/background/request_coordinator_unittest.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698