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

Side by Side Diff: ui/chromeos/network/network_state_notifier.h

Issue 1085993002: Revert of Use networkingPrivate.startConnect (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue_430115_internet_options_cellular
Patch Set: Created 5 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
« no previous file with comments | « ui/chromeos/network/network_connect.cc ('k') | ui/chromeos/network/network_state_notifier.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 UI_CHROMEOS_NETWORK_NETWORK_STATE_NOTIFIER_H_ 5 #ifndef UI_CHROMEOS_NETWORK_NETWORK_STATE_NOTIFIER_H_
6 #define UI_CHROMEOS_NETWORK_NETWORK_STATE_NOTIFIER_H_ 6 #define UI_CHROMEOS_NETWORK_NETWORK_STATE_NOTIFIER_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 27 matching lines...) Expand all
38 // 3. Generates a notification when VPN is disconnected not as a result of 38 // 3. Generates a notification when VPN is disconnected not as a result of
39 // user's action. 39 // user's action.
40 class UI_CHROMEOS_EXPORT NetworkStateNotifier 40 class UI_CHROMEOS_EXPORT NetworkStateNotifier
41 : public chromeos::NetworkConnectionObserver, 41 : public chromeos::NetworkConnectionObserver,
42 public chromeos::NetworkStateHandlerObserver { 42 public chromeos::NetworkStateHandlerObserver {
43 public: 43 public:
44 explicit NetworkStateNotifier(NetworkConnect* network_connect); 44 explicit NetworkStateNotifier(NetworkConnect* network_connect);
45 ~NetworkStateNotifier() override; 45 ~NetworkStateNotifier() override;
46 46
47 // NetworkConnectionObserver 47 // NetworkConnectionObserver
48 void ConnectToNetworkRequested(const std::string& service_path) override;
49 void ConnectSucceeded(const std::string& service_path) override;
50 void ConnectFailed(const std::string& service_path, 48 void ConnectFailed(const std::string& service_path,
51 const std::string& error_name) override; 49 const std::string& error_name) override;
52 void DiconnectRequested(const std::string& service_path) override; 50 void DiconnectRequested(const std::string& service_path) override;
53 51
54 // NetworkStateHandlerObserver 52 // NetworkStateHandlerObserver
55 void DefaultNetworkChanged(const chromeos::NetworkState* network) override; 53 void DefaultNetworkChanged(const chromeos::NetworkState* network) override;
56 void NetworkConnectionStateChanged( 54 void NetworkConnectionStateChanged(
57 const chromeos::NetworkState* network) override; 55 const chromeos::NetworkState* network) override;
58 void NetworkPropertiesUpdated(const chromeos::NetworkState* network) override; 56 void NetworkPropertiesUpdated(const chromeos::NetworkState* network) override;
59 57
60 // Show a connection error notification. If |error_name| matches an error 58 // Show a connection error notification. If |error_name| matches an error
61 // defined in NetworkConnectionHandler for connect, configure, or activation 59 // defined in NetworkConnectionHandler for connect, configure, or activation
62 // failed, then the associated message is shown; otherwise use the last_error 60 // failed, then the associated message is shown; otherwise use the last_error
63 // value for the network or a Shill property if available. 61 // value for the network or a Shill property if available.
64 void ShowNetworkConnectError(const std::string& error_name, 62 void ShowNetworkConnectError(const std::string& error_name,
65 const std::string& service_path); 63 const std::string& service_path);
66 64
67 // Show a mobile activation error notification. 65 // Show a mobile activation error notification.
68 void ShowMobileActivationError(const std::string& service_path); 66 void ShowMobileActivationError(const std::string& service_path);
69 67
68 // Removes any existing connect notifications.
69 void RemoveConnectNotification();
70
70 static const char kNotifierNetwork[]; 71 static const char kNotifierNetwork[];
71 static const char kNotifierNetworkError[]; 72 static const char kNotifierNetworkError[];
72 static const char kNetworkConnectNotificationId[]; 73 static const char kNetworkConnectNotificationId[];
73 static const char kNetworkActivateNotificationId[]; 74 static const char kNetworkActivateNotificationId[];
74 static const char kNetworkOutOfCreditsNotificationId[]; 75 static const char kNetworkOutOfCreditsNotificationId[];
75 76
76 private: 77 private:
77 void ConnectErrorPropertiesSucceeded( 78 void ConnectErrorPropertiesSucceeded(
78 const std::string& error_name, 79 const std::string& error_name,
79 const std::string& service_path, 80 const std::string& service_path,
80 const base::DictionaryValue& shill_properties); 81 const base::DictionaryValue& shill_properties);
81 void ConnectErrorPropertiesFailed( 82 void ConnectErrorPropertiesFailed(
82 const std::string& error_name, 83 const std::string& error_name,
83 const std::string& service_path, 84 const std::string& service_path,
84 const std::string& shill_connect_error, 85 const std::string& shill_connect_error,
85 scoped_ptr<base::DictionaryValue> shill_error_data); 86 scoped_ptr<base::DictionaryValue> shill_error_data);
86 void ShowConnectErrorNotification( 87 void ShowConnectErrorNotification(
87 const std::string& error_name, 88 const std::string& error_name,
88 const std::string& service_path, 89 const std::string& service_path,
89 const base::DictionaryValue& shill_properties); 90 const base::DictionaryValue& shill_properties);
90 void ShowVpnDisconnectedNotification(const chromeos::NetworkState* vpn); 91 void ShowVpnDisconnectedNotification(const chromeos::NetworkState* vpn);
91 92
92 // Removes any existing connect notifications.
93 void RemoveConnectNotification();
94
95 // Returns true if the default network changed. 93 // Returns true if the default network changed.
96 bool UpdateDefaultNetwork(const chromeos::NetworkState* network); 94 bool UpdateDefaultNetwork(const chromeos::NetworkState* network);
97 95
98 // Helper methods to update state and check for notifications. 96 // Helper methods to update state and check for notifications.
99 void UpdateVpnConnectionState(const chromeos::NetworkState* vpn); 97 void UpdateVpnConnectionState(const chromeos::NetworkState* vpn);
100 void UpdateCellularOutOfCredits(const chromeos::NetworkState* cellular); 98 void UpdateCellularOutOfCredits(const chromeos::NetworkState* cellular);
101 void UpdateCellularActivating(const chromeos::NetworkState* cellular); 99 void UpdateCellularActivating(const chromeos::NetworkState* cellular);
102 100
103 // Invokes network_connect_->ShowNetworkSettingsForPath from a callback. 101 // Invokes network_connect_->ShowNetworkSettingsForPath from a callback.
104 void ShowNetworkSettingsForPath(const std::string& service_path); 102 void ShowNetworkSettingsForPath(const std::string& service_path);
105 103
106 NetworkConnect* network_connect_; // unowned 104 NetworkConnect* network_connect_; // unowned
107 std::string last_default_network_; 105 std::string last_default_network_;
108 bool did_show_out_of_credits_; 106 bool did_show_out_of_credits_;
109 base::Time out_of_credits_notify_time_; 107 base::Time out_of_credits_notify_time_;
110 std::set<std::string> cellular_activating_; 108 std::set<std::string> cellular_activating_;
111 bool need_vpn_disconnection_notify_; 109 bool need_vpn_disconnection_notify_;
112 base::WeakPtrFactory<NetworkStateNotifier> weak_ptr_factory_; 110 base::WeakPtrFactory<NetworkStateNotifier> weak_ptr_factory_;
113 111
114 DISALLOW_COPY_AND_ASSIGN(NetworkStateNotifier); 112 DISALLOW_COPY_AND_ASSIGN(NetworkStateNotifier);
115 }; 113 };
116 114
117 } // namespace ui 115 } // namespace ui
118 116
119 #endif // UI_CHROMEOS_NETWORK_NETWORK_STATE_NOTIFIER_H_ 117 #endif // UI_CHROMEOS_NETWORK_NETWORK_STATE_NOTIFIER_H_
OLDNEW
« no previous file with comments | « ui/chromeos/network/network_connect.cc ('k') | ui/chromeos/network/network_state_notifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698