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

Unified Diff: components/ntp_snippets/breaking_news/subscription_request_params.h

Issue 2918513002: [NTP::Push] Add the classes for sending a breaking news subscription request (Closed)
Patch Set: Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: components/ntp_snippets/breaking_news/subscription_request_params.h
diff --git a/components/ntp_snippets/breaking_news/subscription_request_params.h b/components/ntp_snippets/breaking_news/subscription_request_params.h
new file mode 100644
index 0000000000000000000000000000000000000000..2a97c49b0ddb770cfba8207ee40da614a337e2cc
--- /dev/null
+++ b/components/ntp_snippets/breaking_news/subscription_request_params.h
@@ -0,0 +1,42 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_NTP_SNIPPETS_BREAKING_NEWS_SUBSCRIPTION_REQUEST_PARAMS_H_
+#define COMPONENTS_NTP_SNIPPETS_BREAKING_NEWS_SUBSCRIPTION_REQUEST_PARAMS_H_
+
+#include <memory>
+#include <set>
+#include <string>
+
+#include "base/callback.h"
+#include "base/optional.h"
+#include "base/values.h"
+#include "components/ntp_snippets/category.h"
+
+namespace ntp_snippets {
+
+// Contains all parameters for subscribing for breaking news push messages.
+struct SubscriptionRequestParams {
+ SubscriptionRequestParams();
+ SubscriptionRequestParams(const SubscriptionRequestParams&);
+ ~SubscriptionRequestParams();
+
+ // GCM subscribtion token obtain from GCM driver (instanceID::getToken())
Bernhard Bauer 2017/05/31 13:12:45 "subscription", "obtained"
mamir 2017/05/31 14:25:03 Done.
+ std::string token;
+
+ // TODO(mamir): Additional fields to be added: country, language.
+};
+
+// Callbacks for JSON parsing to allow injecting platform-dependent code.
+using SuccessCallback =
+ base::Callback<void(std::unique_ptr<base::Value> result)>;
+using ErrorCallback = base::Callback<void(const std::string& error)>;
+using ParseJSONCallback =
+ base::Callback<void(const std::string& raw_json_string,
+ const SuccessCallback& success_callback,
+ const ErrorCallback& error_callback)>;
+
+} // namespace ntp_snippets
+
+#endif // COMPONENTS_NTP_SNIPPETS_BREAKING_NEWS_SUBSCRIPTION_REQUEST_PARAMS_H_

Powered by Google App Engine
This is Rietveld 408576698