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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_CAST_DEVICES_PRIVATE_CAST_DEVICES_PRIVATE_ API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_CAST_DEVICES_PRIVATE_CAST_DEVICES_PRIVATE_ API_H_
7
8 #include <vector>
9
10 #include "ash/cast_config_delegate.h"
11 #include "base/callback_list.h"
12 #include "extensions/browser/browser_context_keyed_api_factory.h"
13 #include "extensions/browser/extension_function.h"
14
15 namespace extensions {
16
17 class CastDeviceUpdateListeners : public BrowserContextKeyedAPI {
18 public:
19 explicit CastDeviceUpdateListeners(content::BrowserContext* context);
20 ~CastDeviceUpdateListeners() override;
21
22 // Fetch an instance for the given context.
23 static CastDeviceUpdateListeners* Get(content::BrowserContext* context);
24
25 // Register a function that will be invoked only when a new device update is
26 // available.
27 ash::CastConfigDelegate::DeviceUpdateSubscription RegisterCallback(
28 const ash::CastConfigDelegate::ReceiversAndActivitesCallback& callback);
29
30 // BrowserContextKeyedAPI implementation:
31 static BrowserContextKeyedAPIFactory<CastDeviceUpdateListeners>*
32 GetFactoryInstance();
33 static const bool kServiceIsCreatedWithBrowserContext = false;
34
35 private:
36 using ReceiverAndActivityList =
37 std::vector<ash::CastConfigDelegate::ReceiverAndActivity>;
38
39 friend class CastDevicesPrivateUpdateDevicesFunction; // For NotifyCallbacks.
40 void NotifyCallbacks(const ReceiverAndActivityList& devices);
41
42 base::CallbackList<void(const ReceiverAndActivityList&)> callback_list_;
43
44 friend class BrowserContextKeyedAPIFactory<CastDeviceUpdateListeners>;
45
46 // BrowserContextKeyedAPI implementation:
47 static const char* service_name() { return "CastDeviceUpdateListeners"; }
48
49 DISALLOW_COPY_AND_ASSIGN(CastDeviceUpdateListeners);
50 };
51
52 // static void updateDeviceState(ReceiverActivity[] devices);
53 class CastDevicesPrivateUpdateDevicesFunction :
54 public UIThreadExtensionFunction {
55 public:
56 CastDevicesPrivateUpdateDevicesFunction();
57
58 private:
59 ~CastDevicesPrivateUpdateDevicesFunction() override;
60
61 // ExtensionFunction:
62 ResponseAction Run() override;
63
64 DECLARE_EXTENSION_FUNCTION("cast.devicesPrivate.updateDevices",
65 CASTDEVICESPRIVATE_UPDATEDEVICES);
66 DISALLOW_COPY_AND_ASSIGN(CastDevicesPrivateUpdateDevicesFunction);
67 };
68
69 } // namespace extensions
70
71 #endif // CHROME_BROWSER_EXTENSIONS_API_CAST_DEVICES_PRIVATE_CAST_DEVICES_PRIVA TE_API_H_
OLDNEW
« 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