OLD | NEW |
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_REMOTE_JSON_REQUEST_H_ | 5 #ifndef COMPONENTS_NTP_SNIPPETS_REMOTE_JSON_REQUEST_H_ |
6 #define COMPONENTS_NTP_SNIPPETS_REMOTE_JSON_REQUEST_H_ | 6 #define COMPONENTS_NTP_SNIPPETS_REMOTE_JSON_REQUEST_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 namespace ntp_snippets { | 29 namespace ntp_snippets { |
30 class UserClassifier; | 30 class UserClassifier; |
31 | 31 |
32 namespace internal { | 32 namespace internal { |
33 | 33 |
34 // Enumeration listing all possible outcomes for fetch attempts. Used for UMA | 34 // Enumeration listing all possible outcomes for fetch attempts. Used for UMA |
35 // histograms, so do not change existing values. Insert new values at the end, | 35 // histograms, so do not change existing values. Insert new values at the end, |
36 // and update the histogram definition. | 36 // and update the histogram definition. |
37 enum class FetchResult { | 37 enum class FetchResult { |
38 SUCCESS, | 38 SUCCESS = 0, |
39 DEPRECATED_EMPTY_HOSTS, | 39 // DEPRECATED_EMPTY_HOSTS = 1, |
40 URL_REQUEST_STATUS_ERROR, | 40 URL_REQUEST_STATUS_ERROR = 2, |
41 HTTP_ERROR, | 41 HTTP_ERROR = 3, |
42 JSON_PARSE_ERROR, | 42 JSON_PARSE_ERROR = 4, |
43 INVALID_SNIPPET_CONTENT_ERROR, | 43 INVALID_SNIPPET_CONTENT_ERROR = 5, |
44 OAUTH_TOKEN_ERROR, | 44 OAUTH_TOKEN_ERROR = 6, |
45 INTERACTIVE_QUOTA_ERROR, | 45 // DEPRECATED_INTERACTIVE_QUOTA_ERROR = 7, |
46 NON_INTERACTIVE_QUOTA_ERROR, | 46 // DEPRECATED_NON_INTERACTIVE_QUOTA_ERROR = 8, |
47 RESULT_MAX | 47 RESULT_MAX = 9 |
48 }; | 48 }; |
49 | 49 |
50 enum FetchAPI { | 50 enum FetchAPI { |
51 CHROME_READER_API, | 51 CHROME_READER_API, |
52 CHROME_CONTENT_SUGGESTIONS_API, | 52 CHROME_CONTENT_SUGGESTIONS_API, |
53 }; | 53 }; |
54 | 54 |
55 // A single request to query remote suggestions. On success, the suggestions are | 55 // A single request to query remote suggestions. On success, the suggestions are |
56 // returned in parsed JSON form (base::Value). | 56 // returned in parsed JSON form (base::Value). |
57 class JsonRequest : public net::URLFetcherDelegate { | 57 class JsonRequest : public net::URLFetcherDelegate { |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 base::WeakPtrFactory<JsonRequest> weak_ptr_factory_; | 177 base::WeakPtrFactory<JsonRequest> weak_ptr_factory_; |
178 | 178 |
179 DISALLOW_COPY_AND_ASSIGN(JsonRequest); | 179 DISALLOW_COPY_AND_ASSIGN(JsonRequest); |
180 }; | 180 }; |
181 | 181 |
182 } // namespace internal | 182 } // namespace internal |
183 | 183 |
184 } // namespace ntp_snippets | 184 } // namespace ntp_snippets |
185 | 185 |
186 #endif // COMPONENTS_NTP_SNIPPETS_REMOTE_JSON_REQUEST_H_ | 186 #endif // COMPONENTS_NTP_SNIPPETS_REMOTE_JSON_REQUEST_H_ |
OLD | NEW |