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

Unified Diff: components/copresence/copresence_manager_impl.h

Issue 441103002: Tests for the Copresence API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@api
Patch Set: Renaming to simply CopresenceDelegate Created 6 years, 4 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
« no previous file with comments | « components/copresence/copresence_manager.cc ('k') | components/copresence/copresence_manager_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/copresence/copresence_manager_impl.h
diff --git a/components/copresence/copresence_manager_impl.h b/components/copresence/copresence_manager_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..5134401391d6f4577d8dbdc2c1680c28c17a905c
--- /dev/null
+++ b/components/copresence/copresence_manager_impl.h
@@ -0,0 +1,71 @@
+// Copyright 2014 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_COPRESENCE_COPRESENCE_MANAGER_IMPL_H_
+#define COMPONENTS_COPRESENCE_COPRESENCE_MANAGER_IMPL_H_
+
+#include <string>
+#include <vector>
+
+#include "base/callback.h"
+#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
+#include "components/copresence/proto/rpcs.pb.h"
+#include "components/copresence/public/copresence_manager.h"
+
+namespace net {
+class URLContextGetter;
+}
+
+namespace copresence {
+
+class RpcHandler;
+
+struct PendingRequest {
+ PendingRequest(const ReportRequest& report,
+ const std::string app_id,
+ const StatusCallback& callback);
+ ~PendingRequest();
+
+ ReportRequest report;
+ std::string app_id;
+ StatusCallback callback;
+};
+
+// The implementation for CopresenceManager.
+class CopresenceManagerImpl : public CopresenceManager,
+ public base::SupportsWeakPtr<CopresenceManagerImpl> {
+ public:
+ virtual ~CopresenceManagerImpl();
+ virtual void ExecuteReportRequest(ReportRequest request,
+ const std::string& app_id,
+ const StatusCallback& callback) OVERRIDE;
+
+ private:
+ // Create managers with the CopresenceManager::Create() method.
+ friend class CopresenceManager;
+ CopresenceManagerImpl(CopresenceDelegate* delegate);
+
+ void CompleteInitialization();
+ void InitStepComplete(const std::string& step, bool success);
+
+ bool init_failed_;
+ std::vector<PendingRequest> pending_requests_queue_;
+
+ // TODO(rkc): This code is almost identical to what we use in feedback to
+ // perform multiple blocking tasks and then run a post process method. Look
+ // into refactoring it all out to a common construct, like maybe a
+ // PostMultipleTasksAndReply?
+ size_t pending_init_operations_;
+
+ CopresenceDelegate* const delegate_;
+ scoped_ptr<RpcHandler> rpc_handler_;
+
+ DISALLOW_COPY_AND_ASSIGN(CopresenceManagerImpl);
+};
+
+} // namespace copresence
+
+#endif // COMPONENTS_COPRESENCE_COPRESENCE_MANAGER_IMPL_H_
« no previous file with comments | « components/copresence/copresence_manager.cc ('k') | components/copresence/copresence_manager_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698