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

Side by Side Diff: components/ntp_snippets/ntp_snippets_fetcher.h

Issue 2273323002: NTP Snippets: Added error codes for out of quota events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 3 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_NTP_SNIPPETS_NTP_SNIPPETS_FETCHER_H_ 5 #ifndef COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_FETCHER_H_
6 #define COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_FETCHER_H_ 6 #define COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_FETCHER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 using OptionalSnippets = base::Optional<NTPSnippet::CategoryMap>; 50 using OptionalSnippets = base::Optional<NTPSnippet::CategoryMap>;
51 // |snippets| contains parsed snippets if a fetch succeeded. If problems 51 // |snippets| contains parsed snippets if a fetch succeeded. If problems
52 // occur, |snippets| contains no value (no actual vector in base::Optional). 52 // occur, |snippets| contains no value (no actual vector in base::Optional).
53 // Error details can be retrieved using last_status(). 53 // Error details can be retrieved using last_status().
54 using SnippetsAvailableCallback = 54 using SnippetsAvailableCallback =
55 base::Callback<void(OptionalSnippets snippets)>; 55 base::Callback<void(OptionalSnippets snippets)>;
56 56
57 // Enumeration listing all possible outcomes for fetch attempts. Used for UMA 57 // Enumeration listing all possible outcomes for fetch attempts. Used for UMA
58 // histograms, so do not change existing values. Insert new values at the end, 58 // histograms, so do not change existing values. Insert new values at the end,
59 // and update the histogram definition. 59 // and update the histogram definition.
Marc Treib 2016/08/25 11:58:27 ^^ You'll have to update histograms.xml too
60 enum class FetchResult { 60 enum class FetchResult {
61 SUCCESS, 61 SUCCESS,
62 EMPTY_HOSTS, 62 EMPTY_HOSTS,
63 URL_REQUEST_STATUS_ERROR, 63 URL_REQUEST_STATUS_ERROR,
64 HTTP_ERROR, 64 HTTP_ERROR,
65 JSON_PARSE_ERROR, 65 JSON_PARSE_ERROR,
66 INVALID_SNIPPET_CONTENT_ERROR, 66 INVALID_SNIPPET_CONTENT_ERROR,
67 OAUTH_TOKEN_ERROR, 67 OAUTH_TOKEN_ERROR,
68 INTERACTIVE_QUOTA_ERROR,
69 NON_INTERACTIVE_QUOTA_ERROR,
68 RESULT_MAX 70 RESULT_MAX
69 }; 71 };
70 72
71 // Enumeration listing all possible variants of dealing with personalization. 73 // Enumeration listing all possible variants of dealing with personalization.
72 enum class Personalization { 74 enum class Personalization {
73 kPersonal, 75 kPersonal,
74 kNonPersonal, 76 kNonPersonal,
75 kBoth 77 kBoth
76 }; 78 };
77 79
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 // When a token request gets canceled, we want to retry once. 237 // When a token request gets canceled, we want to retry once.
236 bool oauth_token_retried_; 238 bool oauth_token_retried_;
237 239
238 base::WeakPtrFactory<NTPSnippetsFetcher> weak_ptr_factory_; 240 base::WeakPtrFactory<NTPSnippetsFetcher> weak_ptr_factory_;
239 241
240 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsFetcher); 242 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsFetcher);
241 }; 243 };
242 } // namespace ntp_snippets 244 } // namespace ntp_snippets
243 245
244 #endif // COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_FETCHER_H_ 246 #endif // COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_FETCHER_H_
OLDNEW
« no previous file with comments | « no previous file | components/ntp_snippets/ntp_snippets_fetcher.cc » ('j') | components/ntp_snippets/ntp_snippets_fetcher.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698