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

Side by Side Diff: chrome/browser/extensions/api/bluetooth/bluetooth_api.h

Issue 10383198: Move helper functions into the anonymous namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments Created 8 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/extensions/api/bluetooth/bluetooth_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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_API_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_API_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_API_H_
7 #pragma once 7 #pragma once
8 8
9 #include "chrome/browser/extensions/extension_function.h" 9 #include "chrome/browser/extensions/extension_function.h"
10 10
11 #if defined(OS_CHROMEOS) 11 #if defined(OS_CHROMEOS)
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 13
14 namespace chromeos { 14 namespace chromeos {
15 15
16 class BluetoothAdapter;
17 class BluetoothDevice; 16 class BluetoothDevice;
18 class BluetoothSocket; 17 class BluetoothSocket;
19 class ExtensionBluetoothEventRouter;
20 18
21 } // namespace chromeos 19 } // namespace chromeos
22 #endif 20 #endif
23 21
24 namespace extensions { 22 namespace extensions {
25 namespace api { 23 namespace api {
26 24
27 class BluetoothExtensionFunction : public SyncExtensionFunction { 25 class BluetoothIsAvailableFunction : public SyncExtensionFunction {
28 protected:
29 virtual ~BluetoothExtensionFunction() {}
30
31 #if defined(OS_CHROMEOS)
32 chromeos::ExtensionBluetoothEventRouter* event_router();
33 const chromeos::BluetoothAdapter* adapter() const;
34 chromeos::BluetoothAdapter* GetMutableAdapter();
35 #endif
36 };
37
38 class AsyncBluetoothExtensionFunction : public AsyncExtensionFunction {
39 protected:
40 virtual ~AsyncBluetoothExtensionFunction() {}
41
42 #if defined(OS_CHROMEOS)
43 chromeos::ExtensionBluetoothEventRouter* event_router();
44 const chromeos::BluetoothAdapter* adapter() const;
45 chromeos::BluetoothAdapter* GetMutableAdapter();
46 #endif
47 };
48
49 class BluetoothIsAvailableFunction : public BluetoothExtensionFunction {
50 public: 26 public:
51 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bluetooth.isAvailable") 27 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bluetooth.isAvailable")
52 28
53 protected: 29 protected:
54 virtual ~BluetoothIsAvailableFunction() {} 30 virtual ~BluetoothIsAvailableFunction() {}
55 31
56 // ExtensionFunction: 32 // ExtensionFunction:
57 virtual bool RunImpl() OVERRIDE; 33 virtual bool RunImpl() OVERRIDE;
58 }; 34 };
59 35
60 class BluetoothIsPoweredFunction : public BluetoothExtensionFunction { 36 class BluetoothIsPoweredFunction : public SyncExtensionFunction {
61 public: 37 public:
62 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bluetooth.isPowered") 38 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bluetooth.isPowered")
63 39
64 protected: 40 protected:
65 virtual ~BluetoothIsPoweredFunction() {} 41 virtual ~BluetoothIsPoweredFunction() {}
66 42
67 // ExtensionFunction: 43 // ExtensionFunction:
68 virtual bool RunImpl() OVERRIDE; 44 virtual bool RunImpl() OVERRIDE;
69 }; 45 };
70 46
71 class BluetoothGetAddressFunction : public BluetoothExtensionFunction { 47 class BluetoothGetAddressFunction : public SyncExtensionFunction {
72 public: 48 public:
73 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bluetooth.getAddress") 49 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bluetooth.getAddress")
74 50
75 protected: 51 protected:
76 virtual ~BluetoothGetAddressFunction() {} 52 virtual ~BluetoothGetAddressFunction() {}
77 53
78 // ExtensionFunction: 54 // ExtensionFunction:
79 virtual bool RunImpl() OVERRIDE; 55 virtual bool RunImpl() OVERRIDE;
80 }; 56 };
81 57
82 class BluetoothGetDevicesWithServiceUUIDFunction 58 class BluetoothGetDevicesWithServiceUUIDFunction
83 : public BluetoothExtensionFunction { 59 : public SyncExtensionFunction {
84 public: 60 public:
85 DECLARE_EXTENSION_FUNCTION_NAME( 61 DECLARE_EXTENSION_FUNCTION_NAME(
86 "experimental.bluetooth.getDevicesWithServiceUUID") 62 "experimental.bluetooth.getDevicesWithServiceUUID")
87 63
88 protected: 64 protected:
89 virtual ~BluetoothGetDevicesWithServiceUUIDFunction() {} 65 virtual ~BluetoothGetDevicesWithServiceUUIDFunction() {}
90 66
91 // ExtensionFunction: 67 // ExtensionFunction:
92 virtual bool RunImpl() OVERRIDE; 68 virtual bool RunImpl() OVERRIDE;
93 }; 69 };
94 70
95 class BluetoothGetDevicesWithServiceNameFunction 71 class BluetoothGetDevicesWithServiceNameFunction
96 : public AsyncBluetoothExtensionFunction { 72 : public AsyncExtensionFunction {
97 public: 73 public:
98 DECLARE_EXTENSION_FUNCTION_NAME( 74 DECLARE_EXTENSION_FUNCTION_NAME(
99 "experimental.bluetooth.getDevicesWithServiceName") 75 "experimental.bluetooth.getDevicesWithServiceName")
100 76
101 #if defined(OS_CHROMEOS) 77 #if defined(OS_CHROMEOS)
102 BluetoothGetDevicesWithServiceNameFunction(); 78 BluetoothGetDevicesWithServiceNameFunction();
103 #endif 79 #endif
104 80
105 protected: 81 protected:
106 virtual ~BluetoothGetDevicesWithServiceNameFunction() {} 82 virtual ~BluetoothGetDevicesWithServiceNameFunction() {}
107 83
108 // ExtensionFunction: 84 // ExtensionFunction:
109 virtual bool RunImpl() OVERRIDE; 85 virtual bool RunImpl() OVERRIDE;
110 86
87 private:
111 #if defined(OS_CHROMEOS) 88 #if defined(OS_CHROMEOS)
112 private:
113 void AddDeviceIfTrue( 89 void AddDeviceIfTrue(
114 ListValue* list, const chromeos::BluetoothDevice* device, bool result); 90 ListValue* list, const chromeos::BluetoothDevice* device, bool result);
115 91
116 int callbacks_pending_; 92 int callbacks_pending_;
117 #endif 93 #endif
118 }; 94 };
119 95
120 class BluetoothConnectFunction : public AsyncBluetoothExtensionFunction { 96 class BluetoothConnectFunction : public AsyncExtensionFunction {
121 public: 97 public:
122 virtual bool RunImpl() OVERRIDE; 98 virtual bool RunImpl() OVERRIDE;
123 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bluetooth.connect") 99 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bluetooth.connect")
124 100
125 private: 101 private:
126 #if defined(OS_CHROMEOS) 102 #if defined(OS_CHROMEOS)
127 void ConnectToServiceCallback( 103 void ConnectToServiceCallback(
128 const chromeos::BluetoothDevice* device, 104 const chromeos::BluetoothDevice* device,
129 const std::string& service_uuid, 105 const std::string& service_uuid,
130 scoped_refptr<chromeos::BluetoothSocket> socket); 106 scoped_refptr<chromeos::BluetoothSocket> socket);
131 #endif 107 #endif
132 }; 108 };
133 109
134 class BluetoothDisconnectFunction : public BluetoothExtensionFunction { 110 class BluetoothDisconnectFunction : public SyncExtensionFunction {
135 public: 111 public:
136 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bluetooth.disconnect") 112 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bluetooth.disconnect")
137 113
138 protected: 114 protected:
139 virtual ~BluetoothDisconnectFunction() {} 115 virtual ~BluetoothDisconnectFunction() {}
140 116
141 // ExtensionFunction: 117 // ExtensionFunction:
142 virtual bool RunImpl() OVERRIDE; 118 virtual bool RunImpl() OVERRIDE;
143 }; 119 };
144 120
145 class BluetoothReadFunction : public BluetoothExtensionFunction { 121 class BluetoothReadFunction : public SyncExtensionFunction {
146 public: 122 public:
147 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bluetooth.read") 123 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bluetooth.read")
148 124
149 protected: 125 protected:
150 virtual ~BluetoothReadFunction() {} 126 virtual ~BluetoothReadFunction() {}
151 127
152 // ExtensionFunction: 128 // ExtensionFunction:
153 virtual bool RunImpl() OVERRIDE; 129 virtual bool RunImpl() OVERRIDE;
154 }; 130 };
155 131
156 class BluetoothSetOutOfBandPairingDataFunction 132 class BluetoothSetOutOfBandPairingDataFunction
157 : public BluetoothExtensionFunction { 133 : public SyncExtensionFunction {
158 public: 134 public:
159 DECLARE_EXTENSION_FUNCTION_NAME( 135 DECLARE_EXTENSION_FUNCTION_NAME(
160 "experimental.bluetooth.setOutOfBandPairingData") 136 "experimental.bluetooth.setOutOfBandPairingData")
161 137
162 protected: 138 protected:
163 virtual ~BluetoothSetOutOfBandPairingDataFunction() {} 139 virtual ~BluetoothSetOutOfBandPairingDataFunction() {}
164 140
165 // ExtensionFunction: 141 // ExtensionFunction:
166 virtual bool RunImpl() OVERRIDE; 142 virtual bool RunImpl() OVERRIDE;
167 }; 143 };
168 144
169 class BluetoothGetOutOfBandPairingDataFunction 145 class BluetoothGetOutOfBandPairingDataFunction
170 : public BluetoothExtensionFunction { 146 : public SyncExtensionFunction {
171 public: 147 public:
172 DECLARE_EXTENSION_FUNCTION_NAME( 148 DECLARE_EXTENSION_FUNCTION_NAME(
173 "experimental.bluetooth.getOutOfBandPairingData") 149 "experimental.bluetooth.getOutOfBandPairingData")
174 150
175 protected: 151 protected:
176 virtual ~BluetoothGetOutOfBandPairingDataFunction() {} 152 virtual ~BluetoothGetOutOfBandPairingDataFunction() {}
177 153
178 // ExtensionFunction: 154 // ExtensionFunction:
179 virtual bool RunImpl() OVERRIDE; 155 virtual bool RunImpl() OVERRIDE;
180 }; 156 };
181 157
182 class BluetoothWriteFunction : public BluetoothExtensionFunction { 158 class BluetoothWriteFunction : public SyncExtensionFunction {
183 public: 159 public:
184 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bluetooth.write") 160 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bluetooth.write")
185 161
186 private: 162 private:
187 virtual ~BluetoothWriteFunction() {} 163 virtual ~BluetoothWriteFunction() {}
188 164
189 // ExtensionFunction: 165 // ExtensionFunction:
190 virtual bool RunImpl() OVERRIDE; 166 virtual bool RunImpl() OVERRIDE;
191 }; 167 };
192 168
193 } // namespace api 169 } // namespace api
194 } // namespace extensions 170 } // namespace extensions
195 171
196 #endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_API_H_ 172 #endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_API_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/bluetooth/bluetooth_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698