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

Unified Diff: content/browser/payments/payment_app_context.h

Issue 2476343002: PaymentApp: Initial implementation for PaymentAppManager.setManifest(). (Closed)
Patch Set: PaymentApp: Initial implementation for PaymentAppManager.setManifest(). Created 4 years, 1 month 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: content/browser/payments/payment_app_context.h
diff --git a/content/browser/payments/payment_app_context.h b/content/browser/payments/payment_app_context.h
new file mode 100644
index 0000000000000000000000000000000000000000..f04019d00533071a2b876186ce101c540ecdec7a
--- /dev/null
+++ b/content/browser/payments/payment_app_context.h
@@ -0,0 +1,62 @@
+// Copyright 2016 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 CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_CONTEXT_H_
+#define CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_CONTEXT_H_
+
+#include <map>
+#include <memory>
+
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "components/payments/payment_app.mojom.h"
+#include "content/common/content_export.h"
+
+namespace content {
+
+class PaymentAppManager;
+class ServiceWorkerContextWrapper;
+
+class CONTENT_EXPORT PaymentAppContext
+ : public base::RefCountedThreadSafe<PaymentAppContext> {
+ public:
+ PaymentAppContext();
+
+ // Init and Shutdown are for use on the UI thread when the
+ // StoragePartition is being setup and torn down.
+ void Init(const scoped_refptr<ServiceWorkerContextWrapper>& context);
jkarlin 2016/11/08 13:48:53 Passing a const scoped_refptr<X>& is now against b
zino 2016/11/08 14:34:21 Done.
+
+ // Shutdown must be called before deleting this. Call on the UI thread.
+ void Shutdown();
+
+ // Create a PaymentAppManager that is owned by this. Call on the UI
+ // thread.
+ void CreateService(
+ mojo::InterfaceRequest<payments::mojom::PaymentAppManager> request);
+
+ // Called by PaymentAppManager objects so that they can
+ // be deleted. Call on the IO thread.
+ void ServiceHadConnectionError(PaymentAppManager* service);
+
+ protected:
+ friend class base::RefCountedThreadSafe<PaymentAppContext>;
+ virtual ~PaymentAppContext();
+
+ private:
+ void CreateServiceOnIOThread(
+ mojo::InterfaceRequest<payments::mojom::PaymentAppManager> request);
+
+ void ShutdownOnIO();
+
+ // The services are owned by this. They're either deleted
+ // during ShutdownOnIO or when the channel is closed via
+ // ServiceHadConnectionError. Only accessed on the IO thread.
+ std::map<PaymentAppManager*, std::unique_ptr<PaymentAppManager>> services_;
+
+ DISALLOW_COPY_AND_ASSIGN(PaymentAppContext);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_PAYMENT_APP_PAYMENT_APP_CONTEXT_H_
jkarlin 2016/11/08 13:48:53 Should be CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_CON
zino 2016/11/08 14:34:21 Done.

Powered by Google App Engine
This is Rietveld 408576698