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

Unified Diff: chrome/browser/extensions/api/copresence_private/copresence_private_api.cc

Issue 444513005: Add the Copresence API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
Index: chrome/browser/extensions/api/copresence_private/copresence_private_api.cc
diff --git a/chrome/browser/extensions/api/copresence_private/copresence_private_api.cc b/chrome/browser/extensions/api/copresence_private/copresence_private_api.cc
index 2dcc52e7d78e5967f86c666d1d3376f8dfbc9d72..f2d1d0fe952fcb9ffb594d53f43ea20527e7426b 100644
--- a/chrome/browser/extensions/api/copresence_private/copresence_private_api.cc
+++ b/chrome/browser/extensions/api/copresence_private/copresence_private_api.cc
@@ -7,27 +7,19 @@
#include "base/lazy_instance.h"
#include "base/stl_util.h"
#include "chrome/browser/copresence/chrome_whispernet_client.h"
+#include "chrome/browser/extensions/api/copresence/copresence_api.h"
#include "chrome/common/extensions/api/copresence_private.h"
#include "components/copresence/public/whispernet_client.h"
#include "media/base/audio_bus.h"
namespace extensions {
-// This code is only for testing while we don't have the rest of the
-// CopresenceAPI service which will actually give us the whispernet client.
-// Once we add that code, both the g_whispernet_client and the
-// GetWhispernetClient function will go away, to be replaced by the
-// GetWhispernetClient function that will fetch our active whispernet client
-// from the CopresenceAPI profile keyed service.
-copresence::WhispernetClient* g_whispernet_client = NULL;
-
// Copresence Private functions.
copresence::WhispernetClient* CopresencePrivateFunction::GetWhispernetClient() {
- // This is temporary code, this needs to be replaced by the real
- // GetWhispernetClient code from c/b/e/api/copresence/copresence_util.h
- DCHECK(g_whispernet_client);
- return g_whispernet_client;
+ CopresenceService* service =
+ CopresenceService::GetFactoryInstance()->Get(browser_context());
+ return service ? service->whispernet_client() : NULL;
}
// CopresenceSendFoundFunction implementation:
@@ -98,8 +90,4 @@ CopresencePrivateSendInitializedFunction::Run() {
return RespondNow(NoArguments());
}
-void SetWhispernetClientForTesting(copresence::WhispernetClient* client) {
- g_whispernet_client = client;
-}
-
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698