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

Side by Side Diff: chromeos/components/tether/wifi_hotspot_connector.h

Issue 2819303002: Changed wifi arcs to mobile bars for Tether network. (Closed)
Patch Set: Created 3 years, 8 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 CHROMEOS_COMPONENTS_TETHER_WIFI_HOTSPOT_CONNECTOR_H_ 5 #ifndef CHROMEOS_COMPONENTS_TETHER_WIFI_HOTSPOT_CONNECTOR_H_
6 #define CHROMEOS_COMPONENTS_TETHER_WIFI_HOTSPOT_CONNECTOR_H_ 6 #define CHROMEOS_COMPONENTS_TETHER_WIFI_HOTSPOT_CONNECTOR_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "base/observer_list.h" 11 #include "base/observer_list.h"
12 #include "base/timer/timer.h" 12 #include "base/timer/timer.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "chromeos/components/tether/active_host.h"
14 #include "chromeos/network/network_state_handler_observer.h" 15 #include "chromeos/network/network_state_handler_observer.h"
15 16
16 namespace chromeos { 17 namespace chromeos {
17 18
18 class NetworkConnect; 19 class NetworkConnect;
19 class NetworkState; 20 class NetworkState;
20 class NetworkStateHandler; 21 class NetworkStateHandler;
21 22
22 namespace tether { 23 namespace tether {
23 24
24 // Connects to a Wi-Fi hotspot, given an SSID and password. 25 // Connects to a Wi-Fi hotspot, given an SSID and password.
25 class WifiHotspotConnector : public NetworkStateHandlerObserver { 26 class WifiHotspotConnector : public NetworkStateHandlerObserver {
26 public: 27 public:
27 WifiHotspotConnector(NetworkStateHandler* network_state_handler, 28 WifiHotspotConnector(NetworkStateHandler* network_state_handler,
28 NetworkConnect* network_connect); 29 NetworkConnect* network_connect,
30 ActiveHost* active_host);
29 ~WifiHotspotConnector() override; 31 ~WifiHotspotConnector() override;
30 32
31 // Function which receives the GUID of the connected Wi-Fi hotspot. If 33 // Function which receives the GUID of the connected Wi-Fi hotspot. If
32 // the string passed is empty, an error occurred trying to connect. 34 // the string passed is empty, an error occurred trying to connect.
33 using WifiConnectionCallback = base::Callback<void(const std::string&)>; 35 using WifiConnectionCallback = base::Callback<void(const std::string&)>;
34 36
35 // Connects to the Wi-Fi network with SSID |ssid| and password |password|, 37 // Connects to the Wi-Fi network with SSID |ssid| and password |password|,
36 // invoking |callback| when the connection succeeds, fails, or times out. 38 // invoking |callback| when the connection succeeds, fails, or times out.
37 // Note: If ConnectToWifiHotspot() is called while another connection attempt 39 // Note: If ConnectToWifiHotspot() is called while another connection attempt
38 // is in progress, the previous attempt will be canceled and the new attempt 40 // is in progress, the previous attempt will be canceled and the new attempt
(...skipping 13 matching lines...) Expand all
52 // Passes an empty string as |wifi_guid| to signal that the connection did not 54 // Passes an empty string as |wifi_guid| to signal that the connection did not
53 // succeed. 55 // succeed.
54 void InvokeWifiConnectionCallback(const std::string& wifi_guid); 56 void InvokeWifiConnectionCallback(const std::string& wifi_guid);
55 base::DictionaryValue CreateWifiPropertyDictionary( 57 base::DictionaryValue CreateWifiPropertyDictionary(
56 const std::string& ssid, 58 const std::string& ssid,
57 const std::string& password); 59 const std::string& password);
58 void OnConnectionTimeout(); 60 void OnConnectionTimeout();
59 61
60 void SetTimerForTest(std::unique_ptr<base::Timer> timer); 62 void SetTimerForTest(std::unique_ptr<base::Timer> timer);
61 63
64 ActiveHost* active_host_;
Kyle Horimoto 2017/04/17 19:50:04 nit: Place injected classes in the same order as t
lesliewatkins 2017/04/27 00:33:53 Done. Initializing them in a different order give
62 NetworkStateHandler* network_state_handler_; 65 NetworkStateHandler* network_state_handler_;
63 NetworkConnect* network_connect_; 66 NetworkConnect* network_connect_;
64 std::unique_ptr<base::Timer> timer_; 67 std::unique_ptr<base::Timer> timer_;
65 68
66 std::string ssid_; 69 std::string ssid_;
67 std::string password_; 70 std::string password_;
68 std::string wifi_guid_; 71 std::string wifi_guid_;
69 WifiConnectionCallback callback_; 72 WifiConnectionCallback callback_;
70 73
71 base::WeakPtrFactory<WifiHotspotConnector> weak_ptr_factory_; 74 base::WeakPtrFactory<WifiHotspotConnector> weak_ptr_factory_;
72 75
73 DISALLOW_COPY_AND_ASSIGN(WifiHotspotConnector); 76 DISALLOW_COPY_AND_ASSIGN(WifiHotspotConnector);
74 }; 77 };
75 78
76 } // namespace tether 79 } // namespace tether
77 80
78 } // namespace chromeos 81 } // namespace chromeos
79 82
80 #endif // CHROMEOS_COMPONENTS_TETHER_WIFI_HOTSPOT_CONNECTOR_H_ 83 #endif // CHROMEOS_COMPONENTS_TETHER_WIFI_HOTSPOT_CONNECTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698