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

Unified Diff: components/copresence/copresence_manager.cc

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_client.cc ('k') | components/copresence/copresence_manager_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/copresence/copresence_manager.cc
diff --git a/components/copresence/copresence_manager.cc b/components/copresence/copresence_manager.cc
new file mode 100644
index 0000000000000000000000000000000000000000..fa89006376fd2d9f5e56f85bc3a6b6249aaf510f
--- /dev/null
+++ b/components/copresence/copresence_manager.cc
@@ -0,0 +1,39 @@
+// 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.
+
+#include "components/copresence/public/copresence_manager.h"
+
+#include "base/bind.h"
+#include "components/copresence/copresence_manager_impl.h"
+#include "components/copresence/rpc/rpc_handler.h"
+
+namespace copresence {
+
+// static
+scoped_ptr<CopresenceManager> CopresenceManager::Create(
+ CopresenceDelegate* delegate) {
+ CopresenceManagerImpl* manager = new CopresenceManagerImpl(delegate);
+
+ manager->pending_init_operations_++;
+ manager->rpc_handler_.reset(new RpcHandler(delegate));
+ manager->rpc_handler_->Initialize(
+ base::Bind(&CopresenceManagerImpl::InitStepComplete,
+ // This is safe because the manager owns the RpcHandler.
+ base::Unretained(manager),
+ "Copresence device registration"));
+
+ manager->pending_init_operations_++;
+ DCHECK(delegate->GetWhispernetClient());
+ delegate->GetWhispernetClient()->Initialize(
+ base::Bind(&CopresenceManagerImpl::InitStepComplete,
+ // We cannot cancel WhispernetClient initialization.
+ // TODO(ckehoe): Get rid of this.
+ manager->AsWeakPtr(),
+ "Whispernet proxy initialization"));
+
+ return make_scoped_ptr<CopresenceManager>(manager);
+}
+
+} // namespace copresence
+
« no previous file with comments | « components/copresence/copresence_client.cc ('k') | components/copresence/copresence_manager_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698