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

Unified Diff: chrome/browser/extensions/api/cast_devices_private/cast_devices_private_api.h

Issue 1291113002: Cast extension private API for ChromeOS system tray. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Rebase Created 5 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 | « no previous file | chrome/browser/extensions/api/cast_devices_private/cast_devices_private_api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/cast_devices_private/cast_devices_private_api.h
diff --git a/chrome/browser/extensions/api/cast_devices_private/cast_devices_private_api.h b/chrome/browser/extensions/api/cast_devices_private/cast_devices_private_api.h
new file mode 100644
index 0000000000000000000000000000000000000000..7621d83c15711feee774968e98027a979a6f3850
--- /dev/null
+++ b/chrome/browser/extensions/api/cast_devices_private/cast_devices_private_api.h
@@ -0,0 +1,71 @@
+// Copyright 2015 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 CHROME_BROWSER_EXTENSIONS_API_CAST_DEVICES_PRIVATE_CAST_DEVICES_PRIVATE_API_H_
+#define CHROME_BROWSER_EXTENSIONS_API_CAST_DEVICES_PRIVATE_CAST_DEVICES_PRIVATE_API_H_
+
+#include <vector>
+
+#include "ash/cast_config_delegate.h"
+#include "base/callback_list.h"
+#include "extensions/browser/browser_context_keyed_api_factory.h"
+#include "extensions/browser/extension_function.h"
+
+namespace extensions {
+
+class CastDeviceUpdateListeners : public BrowserContextKeyedAPI {
+ public:
+ explicit CastDeviceUpdateListeners(content::BrowserContext* context);
+ ~CastDeviceUpdateListeners() override;
+
+ // Fetch an instance for the given context.
+ static CastDeviceUpdateListeners* Get(content::BrowserContext* context);
+
+ // Register a function that will be invoked only when a new device update is
+ // available.
+ ash::CastConfigDelegate::DeviceUpdateSubscription RegisterCallback(
+ const ash::CastConfigDelegate::ReceiversAndActivitesCallback& callback);
+
+ // BrowserContextKeyedAPI implementation:
+ static BrowserContextKeyedAPIFactory<CastDeviceUpdateListeners>*
+ GetFactoryInstance();
+ static const bool kServiceIsCreatedWithBrowserContext = false;
+
+ private:
+ using ReceiverAndActivityList =
+ std::vector<ash::CastConfigDelegate::ReceiverAndActivity>;
+
+ friend class CastDevicesPrivateUpdateDevicesFunction; // For NotifyCallbacks.
+ void NotifyCallbacks(const ReceiverAndActivityList& devices);
+
+ base::CallbackList<void(const ReceiverAndActivityList&)> callback_list_;
+
+ friend class BrowserContextKeyedAPIFactory<CastDeviceUpdateListeners>;
+
+ // BrowserContextKeyedAPI implementation:
+ static const char* service_name() { return "CastDeviceUpdateListeners"; }
+
+ DISALLOW_COPY_AND_ASSIGN(CastDeviceUpdateListeners);
+};
+
+// static void updateDeviceState(ReceiverActivity[] devices);
+class CastDevicesPrivateUpdateDevicesFunction :
+ public UIThreadExtensionFunction {
+ public:
+ CastDevicesPrivateUpdateDevicesFunction();
+
+ private:
+ ~CastDevicesPrivateUpdateDevicesFunction() override;
+
+ // ExtensionFunction:
+ ResponseAction Run() override;
+
+ DECLARE_EXTENSION_FUNCTION("cast.devicesPrivate.updateDevices",
+ CASTDEVICESPRIVATE_UPDATEDEVICES);
+ DISALLOW_COPY_AND_ASSIGN(CastDevicesPrivateUpdateDevicesFunction);
+};
+
+} // namespace extensions
+
+#endif // CHROME_BROWSER_EXTENSIONS_API_CAST_DEVICES_PRIVATE_CAST_DEVICES_PRIVATE_API_H_
« no previous file with comments | « no previous file | chrome/browser/extensions/api/cast_devices_private/cast_devices_private_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698