OLD | NEW |
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 #include "ui/chromeos/network/network_state_notifier.h" | 5 #include "ui/chromeos/network/network_state_notifier.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 } | 111 } |
112 | 112 |
113 NetworkStateNotifier::~NetworkStateNotifier() { | 113 NetworkStateNotifier::~NetworkStateNotifier() { |
114 if (!NetworkHandler::IsInitialized()) | 114 if (!NetworkHandler::IsInitialized()) |
115 return; | 115 return; |
116 NetworkHandler::Get()->network_state_handler()->RemoveObserver(this, | 116 NetworkHandler::Get()->network_state_handler()->RemoveObserver(this, |
117 FROM_HERE); | 117 FROM_HERE); |
118 NetworkHandler::Get()->network_connection_handler()->RemoveObserver(this); | 118 NetworkHandler::Get()->network_connection_handler()->RemoveObserver(this); |
119 } | 119 } |
120 | 120 |
121 void NetworkStateNotifier::ConnectToNetworkRequested( | |
122 const std::string& service_path) { | |
123 RemoveConnectNotification(); | |
124 } | |
125 | |
126 void NetworkStateNotifier::ConnectSucceeded(const std::string& service_path) { | |
127 RemoveConnectNotification(); | |
128 } | |
129 | |
130 void NetworkStateNotifier::ConnectFailed(const std::string& service_path, | 121 void NetworkStateNotifier::ConnectFailed(const std::string& service_path, |
131 const std::string& error_name) { | 122 const std::string& error_name) { |
132 // Only show a notification for certain errors. Other failures are expected | 123 // Only show a notification for certain errors. Other failures are expected |
133 // to be handled by the UI that initiated the connect request. | 124 // to be handled by the UI that initiated the connect request. |
134 // Note: kErrorConnectFailed may also cause the configure dialog to be | 125 // Note: kErrorConnectFailed may also cause the configure dialog to be |
135 // displayed, but we rely on the notification system to show additional | 126 // displayed, but we rely on the notification system to show additional |
136 // details if available. | 127 // details if available. |
137 if (error_name != NetworkConnectionHandler::kErrorConnectFailed && | 128 if (error_name != NetworkConnectionHandler::kErrorConnectFailed && |
138 error_name != NetworkConnectionHandler::kErrorNotFound && | 129 error_name != NetworkConnectionHandler::kErrorNotFound && |
139 error_name != NetworkConnectionHandler::kErrorConfigureFailed && | 130 error_name != NetworkConnectionHandler::kErrorConfigureFailed && |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 error_msg, base::Bind(&NetworkStateNotifier::ShowNetworkSettingsForPath, | 412 error_msg, base::Bind(&NetworkStateNotifier::ShowNetworkSettingsForPath, |
422 weak_ptr_factory_.GetWeakPtr(), vpn->path())); | 413 weak_ptr_factory_.GetWeakPtr(), vpn->path())); |
423 } | 414 } |
424 | 415 |
425 void NetworkStateNotifier::ShowNetworkSettingsForPath( | 416 void NetworkStateNotifier::ShowNetworkSettingsForPath( |
426 const std::string& service_path) { | 417 const std::string& service_path) { |
427 network_connect_->ShowNetworkSettingsForPath(service_path); | 418 network_connect_->ShowNetworkSettingsForPath(service_path); |
428 } | 419 } |
429 | 420 |
430 } // namespace ui | 421 } // namespace ui |
OLD | NEW |