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 |
121 void NetworkStateNotifier::ConnectFailed(const std::string& service_path, | 130 void NetworkStateNotifier::ConnectFailed(const std::string& service_path, |
122 const std::string& error_name) { | 131 const std::string& error_name) { |
123 // Only show a notification for certain errors. Other failures are expected | 132 // Only show a notification for certain errors. Other failures are expected |
124 // to be handled by the UI that initiated the connect request. | 133 // to be handled by the UI that initiated the connect request. |
125 // Note: kErrorConnectFailed may also cause the configure dialog to be | 134 // Note: kErrorConnectFailed may also cause the configure dialog to be |
126 // displayed, but we rely on the notification system to show additional | 135 // displayed, but we rely on the notification system to show additional |
127 // details if available. | 136 // details if available. |
128 if (error_name != NetworkConnectionHandler::kErrorConnectFailed && | 137 if (error_name != NetworkConnectionHandler::kErrorConnectFailed && |
129 error_name != NetworkConnectionHandler::kErrorNotFound && | 138 error_name != NetworkConnectionHandler::kErrorNotFound && |
130 error_name != NetworkConnectionHandler::kErrorConfigureFailed && | 139 error_name != NetworkConnectionHandler::kErrorConfigureFailed && |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 error_msg, base::Bind(&NetworkStateNotifier::ShowNetworkSettingsForPath, | 421 error_msg, base::Bind(&NetworkStateNotifier::ShowNetworkSettingsForPath, |
413 weak_ptr_factory_.GetWeakPtr(), vpn->path())); | 422 weak_ptr_factory_.GetWeakPtr(), vpn->path())); |
414 } | 423 } |
415 | 424 |
416 void NetworkStateNotifier::ShowNetworkSettingsForPath( | 425 void NetworkStateNotifier::ShowNetworkSettingsForPath( |
417 const std::string& service_path) { | 426 const std::string& service_path) { |
418 network_connect_->ShowNetworkSettingsForPath(service_path); | 427 network_connect_->ShowNetworkSettingsForPath(service_path); |
419 } | 428 } |
420 | 429 |
421 } // namespace ui | 430 } // namespace ui |
OLD | NEW |