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

Side by Side Diff: components/arc/net/arc_net_host_impl.h

Issue 1751793002: ARC: Remove error status setting in GetNetworks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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 COMPONENTS_ARC_NET_ARC_NET_HOST_IMPL_H_ 5 #ifndef COMPONENTS_ARC_NET_ARC_NET_HOST_IMPL_H_
6 #define COMPONENTS_ARC_NET_ARC_NET_HOST_IMPL_H_ 6 #define COMPONENTS_ARC_NET_ARC_NET_HOST_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/files/scoped_file.h" 12 #include "base/files/scoped_file.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/synchronization/lock.h"
14 #include "base/threading/thread_checker.h" 15 #include "base/threading/thread_checker.h"
15 #include "chromeos/network/network_state_handler_observer.h" 16 #include "chromeos/network/network_state_handler_observer.h"
16 #include "components/arc/arc_bridge_service.h" 17 #include "components/arc/arc_bridge_service.h"
17 #include "components/arc/arc_service.h" 18 #include "components/arc/arc_service.h"
18 #include "components/arc/common/net.mojom.h" 19 #include "components/arc/common/net.mojom.h"
20 #include "mojo/public/cpp/bindings/array.h"
19 #include "mojo/public/cpp/bindings/binding.h" 21 #include "mojo/public/cpp/bindings/binding.h"
20 22
21 namespace arc { 23 namespace arc {
22 24
23 class ArcBridgeService; 25 class ArcBridgeService;
24 26
25 // Private implementation of ArcNetHost. 27 // Private implementation of ArcNetHost.
26 class ArcNetHostImpl : public ArcService, 28 class ArcNetHostImpl : public ArcService,
27 public ArcBridgeService::Observer, 29 public ArcBridgeService::Observer,
28 public chromeos::NetworkStateHandlerObserver, 30 public chromeos::NetworkStateHandlerObserver,
29 public NetHost { 31 public NetHost {
30 public: 32 public:
31 // The constructor will register an Observer with ArcBridgeService. 33 // The constructor will register an Observer with ArcBridgeService.
32 explicit ArcNetHostImpl(ArcBridgeService* arc_bridge_service); 34 explicit ArcNetHostImpl(ArcBridgeService* arc_bridge_service);
33 ~ArcNetHostImpl() override; 35 ~ArcNetHostImpl() override;
34 36
35 // Called when a GetNetworks call is sent from ARC. 37 // Called when a GetNetworks call is sent from ARC.
36 void GetNetworks(bool configured_only, 38 void GetNetworks(bool configured_only,
37 bool visible_only, 39 bool visible_only,
38 const GetNetworksCallback& callback) override; 40 const GetNetworksCallback& callback) override;
39 41
40 // Called when a GetWifiEnabledState call is sent from ARC. 42 // Called when a GetWifiEnabledState call is sent from ARC.
41 void GetWifiEnabledState( 43 void GetWifiEnabledState(
42 const GetWifiEnabledStateCallback& callback) override; 44 const GetWifiEnabledStateCallback& callback) override;
43 45
44 // Called when a StartScan call is sent from ARC. 46 // Called when a StartScan call is sent from ARC.
45 void StartScan() override; 47 void StartScan() override;
46 48
47 // Overriden from chromeos::NetworkStateHandlerObserver. 49 // Overriden from chromeos::NetworkStateHandlerObserver.
48 void ScanCompleted(const chromeos::DeviceState* /*unused*/) override; 50 void ScanCompleted(const chromeos::DeviceState* /*unused*/) override;
Luis Héctor Chávez 2016/03/01 16:22:31 Can you comment about what thread this is expected
49 51
50 // Overriden from chromeos::NetworkStateHandlerObserver. 52 // Overriden from chromeos::NetworkStateHandlerObserver.
51 void OnShuttingDown() override; 53 void OnShuttingDown() override;
52 54
53 // Overridden from ArcBridgeService::Observer: 55 // Overridden from ArcBridgeService::Observer:
54 void OnNetInstanceReady() override; 56 void OnNetInstanceReady() override;
55 57
58 // Overridden from ArcBridgeService::Observer:
59 void OnNetInstanceClosed() override;
60
56 private: 61 private:
57 base::ThreadChecker thread_checker_; 62 base::ThreadChecker thread_checker_;
58 mojo::Binding<arc::NetHost> binding_; 63 mojo::Binding<arc::NetHost> binding_;
59 64
65 // Lock to synchronize access to the cached list of visible networks.
66 base::Lock visible_networks_lock_;
67
68 // List of visible networks that will be sent across to the instance. This
69 // will be cached in the call to GetNetworks and invalidated when a
70 // ScanCompleted notification is received.
71 mojo::Array<arc::WifiConfigurationPtr> cached_visible_networks_;
Luis Héctor Chávez 2016/03/01 16:22:31 I don't love the idea of a move-only collection be
72
60 DISALLOW_COPY_AND_ASSIGN(ArcNetHostImpl); 73 DISALLOW_COPY_AND_ASSIGN(ArcNetHostImpl);
61 }; 74 };
62 75
63 } // namespace arc 76 } // namespace arc
64 77
65 #endif // COMPONENTS_ARC_NET_ARC_NET_HOST_IMPL_H_ 78 #endif // COMPONENTS_ARC_NET_ARC_NET_HOST_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | components/arc/net/arc_net_host_impl.cc » ('j') | components/arc/net/arc_net_host_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698