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

Unified Diff: chromecast/android/chromecast_config_android.cc

Issue 490603002: Chromecast: initial checkin of Android-based cast shell. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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: chromecast/android/chromecast_config_android.cc
diff --git a/chromecast/android/chromecast_config_android.cc b/chromecast/android/chromecast_config_android.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b369f0cbf065660d269da0985d082be30735d6ce
--- /dev/null
+++ b/chromecast/android/chromecast_config_android.cc
@@ -0,0 +1,46 @@
+// 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 "chromecast/android/chromecast_config_android.h"
+
+#include "base/logging.h"
+
+namespace chromecast {
+namespace android {
+
+namespace {
+ChromecastConfigAndroid* g_instance = NULL;
Yaron 2014/08/20 18:11:01 Why not use LazyInstance?
gunsch 2014/08/21 22:31:27 Done.
+} // namespace
+
+// static
+ChromecastConfigAndroid* ChromecastConfigAndroid::GetInstance() {
+ // Note: ChromecastConfigAndroid is expected to be thread-safe, and this is
+ // potentially called across multiple threads. However, the first call is very
+ // early, when starting up breakpad (before creating browser threads), so
+ // this is expected to be safe.
+ if (!g_instance) {
+ new ChromecastConfigAndroid();
+ }
+ DCHECK(g_instance);
+ return g_instance;
+}
+
+ChromecastConfigAndroid::ChromecastConfigAndroid() {
+ DCHECK(!g_instance);
+ g_instance = this;
+}
+
+ChromecastConfigAndroid::~ChromecastConfigAndroid() {
+ DCHECK_EQ(g_instance, this);
+ g_instance = NULL;
+}
+
+// Registers a handler to be notified when SendUsageStats is changed.
+void ChromecastConfigAndroid::SetSendUsageStatsChangedCallback(
+ const base::Callback<void(bool)>& callback) {
+ send_usage_stats_changed_callback_ = callback;
+}
+
+} // namespace android
+} // namespace chromecast

Powered by Google App Engine
This is Rietveld 408576698