OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_LINUX_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_LINUX_H_ |
6 #define EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_LINUX_H_ | 6 #define EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_LINUX_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/linked_ptr.h" | 14 #include "base/memory/linked_ptr.h" |
15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
16 #include "base/threading/thread.h" | 16 #include "base/threading/thread.h" |
17 #include "components/keyed_service/core/keyed_service.h" | 17 #include "components/keyed_service/core/keyed_service.h" |
18 #include "extensions/browser/api/networking_private/networking_private_delegate.
h" | 18 #include "extensions/browser/api/networking_private/networking_private_delegate.
h" |
19 | 19 |
20 namespace content { | |
21 class BrowserContext; | |
22 } | |
23 | |
24 namespace dbus { | 20 namespace dbus { |
25 class Bus; | 21 class Bus; |
26 class ObjectPath; | 22 class ObjectPath; |
27 class ObjectProxy; | 23 class ObjectProxy; |
28 class Response; | 24 class Response; |
29 }; | 25 }; |
30 | 26 |
31 namespace extensions { | 27 namespace extensions { |
32 | 28 |
33 // Linux NetworkingPrivateDelegate implementation. | 29 // Linux NetworkingPrivateDelegate implementation. |
34 class NetworkingPrivateLinux : public NetworkingPrivateDelegate { | 30 class NetworkingPrivateLinux : public NetworkingPrivateDelegate { |
35 public: | 31 public: |
36 typedef std::map<base::string16, linked_ptr<base::DictionaryValue>> | 32 typedef std::map<base::string16, linked_ptr<base::DictionaryValue>> |
37 NetworkMap; | 33 NetworkMap; |
38 | 34 |
39 typedef std::vector<std::string> GuidList; | 35 typedef std::vector<std::string> GuidList; |
40 | 36 |
41 NetworkingPrivateLinux(content::BrowserContext* browser_context, | 37 explicit NetworkingPrivateLinux( |
42 std::unique_ptr<VerifyDelegate> verify_delegate); | 38 std::unique_ptr<VerifyDelegate> verify_delegate); |
43 | 39 |
44 // NetworkingPrivateDelegate | 40 // NetworkingPrivateDelegate |
45 void GetProperties(const std::string& guid, | 41 void GetProperties(const std::string& guid, |
46 const DictionaryCallback& success_callback, | 42 const DictionaryCallback& success_callback, |
47 const FailureCallback& failure_callback) override; | 43 const FailureCallback& failure_callback) override; |
48 void GetManagedProperties(const std::string& guid, | 44 void GetManagedProperties(const std::string& guid, |
49 const DictionaryCallback& success_callback, | 45 const DictionaryCallback& success_callback, |
50 const FailureCallback& failure_callback) override; | 46 const FailureCallback& failure_callback) override; |
51 void GetState(const std::string& guid, | 47 void GetState(const std::string& guid, |
52 const DictionaryCallback& success_callback, | 48 const DictionaryCallback& success_callback, |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 void OnNetworksChangedEventTask(std::unique_ptr<GuidList> guid_list); | 249 void OnNetworksChangedEventTask(std::unique_ptr<GuidList> guid_list); |
254 | 250 |
255 void GetCachedNetworkProperties(const std::string& guid, | 251 void GetCachedNetworkProperties(const std::string& guid, |
256 base::DictionaryValue* properties, | 252 base::DictionaryValue* properties, |
257 std::string* error); | 253 std::string* error); |
258 | 254 |
259 void OnNetworksChangedEventOnUIThread(const GuidList& network_guids); | 255 void OnNetworksChangedEventOnUIThread(const GuidList& network_guids); |
260 | 256 |
261 void OnNetworkListChangedEventOnUIThread(const GuidList& network_guids); | 257 void OnNetworkListChangedEventOnUIThread(const GuidList& network_guids); |
262 | 258 |
263 // Browser context. | |
264 content::BrowserContext* browser_context_; | |
265 // Thread used for DBus actions. | 259 // Thread used for DBus actions. |
266 base::Thread dbus_thread_; | 260 base::Thread dbus_thread_; |
267 // DBus instance. Only access on |dbus_thread_|. | 261 // DBus instance. Only access on |dbus_thread_|. |
268 scoped_refptr<dbus::Bus> dbus_; | 262 scoped_refptr<dbus::Bus> dbus_; |
269 // Task runner used by the |dbus_| object. | 263 // Task runner used by the |dbus_| object. |
270 scoped_refptr<base::SequencedTaskRunner> dbus_task_runner_; | 264 scoped_refptr<base::SequencedTaskRunner> dbus_task_runner_; |
271 // This is owned by |dbus_| object. Only access on |dbus_thread_|. | 265 // This is owned by |dbus_| object. Only access on |dbus_thread_|. |
272 dbus::ObjectProxy* network_manager_proxy_; | 266 dbus::ObjectProxy* network_manager_proxy_; |
273 // Holds the current mapping of known networks. Only access on |dbus_thread_|. | 267 // Holds the current mapping of known networks. Only access on |dbus_thread_|. |
274 std::unique_ptr<NetworkMap> network_map_; | 268 std::unique_ptr<NetworkMap> network_map_; |
275 // Observers to Network Events. | 269 // Observers to Network Events. |
276 base::ObserverList<NetworkingPrivateDelegateObserver> | 270 base::ObserverList<NetworkingPrivateDelegateObserver> |
277 network_events_observers_; | 271 network_events_observers_; |
278 | 272 |
279 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateLinux); | 273 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateLinux); |
280 }; | 274 }; |
281 | 275 |
282 } // namespace extensions | 276 } // namespace extensions |
283 | 277 |
284 #endif // EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_LINUX_H_ | 278 #endif // EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_LINUX_H_ |
OLD | NEW |