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

Side by Side Diff: ui/chromeos/network/network_connect.cc

Issue 983823002: Use GUID instead of servicePath in network settings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue_430115_internet_options_enable_extension_apis
Patch Set: Use guid instead of service_path for proxy prefs Created 5 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
« no previous file with comments | « ui/chromeos/network/network_connect.h ('k') | ui/chromeos/network/network_state_notifier.h » ('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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_connect.h" 5 #include "ui/chromeos/network/network_connect.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 void ShowMobileSetup(const std::string& service_path) override; 69 void ShowMobileSetup(const std::string& service_path) override;
70 void ConfigureNetworkAndConnect(const std::string& service_path, 70 void ConfigureNetworkAndConnect(const std::string& service_path,
71 const base::DictionaryValue& shill_properties, 71 const base::DictionaryValue& shill_properties,
72 bool shared) override; 72 bool shared) override;
73 void CreateConfigurationAndConnect(base::DictionaryValue* shill_properties, 73 void CreateConfigurationAndConnect(base::DictionaryValue* shill_properties,
74 bool shared) override; 74 bool shared) override;
75 void CreateConfiguration(base::DictionaryValue* shill_properties, 75 void CreateConfiguration(base::DictionaryValue* shill_properties,
76 bool shared) override; 76 bool shared) override;
77 base::string16 GetShillErrorString(const std::string& error, 77 base::string16 GetShillErrorString(const std::string& error,
78 const std::string& service_path) override; 78 const std::string& service_path) override;
79 void ShowNetworkSettings(const std::string& service_path) override; 79 void ShowNetworkSettingsForPath(const std::string& service_path) override;
80 80
81 private: 81 private:
82 void HandleUnconfiguredNetwork(const std::string& service_path); 82 void HandleUnconfiguredNetwork(const std::string& service_path);
83 void OnConnectFailed(const std::string& service_path, 83 void OnConnectFailed(const std::string& service_path,
84 const std::string& error_name, 84 const std::string& error_name,
85 scoped_ptr<base::DictionaryValue> error_data); 85 scoped_ptr<base::DictionaryValue> error_data);
86 bool GetNetworkProfilePath(bool shared, std::string* profile_path); 86 bool GetNetworkProfilePath(bool shared, std::string* profile_path);
87 void OnConnectSucceeded(const std::string& service_path); 87 void OnConnectSucceeded(const std::string& service_path);
88 void CallConnectToNetwork(const std::string& service_path, 88 void CallConnectToNetwork(const std::string& service_path,
89 bool check_error_state); 89 bool check_error_state);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 if (network->RequiresActivation()) { 152 if (network->RequiresActivation()) {
153 ActivateCellular(service_path); 153 ActivateCellular(service_path);
154 return; 154 return;
155 } 155 }
156 if (network->cellular_out_of_credits()) { 156 if (network->cellular_out_of_credits()) {
157 ShowMobileSetup(service_path); 157 ShowMobileSetup(service_path);
158 return; 158 return;
159 } 159 }
160 // No special configure or setup for |network|, show the settings UI. 160 // No special configure or setup for |network|, show the settings UI.
161 if (chromeos::LoginState::Get()->IsUserLoggedIn()) { 161 if (chromeos::LoginState::Get()->IsUserLoggedIn()) {
162 delegate_->ShowNetworkSettings(service_path); 162 ShowNetworkSettingsForPath(service_path);
163 } 163 }
164 return; 164 return;
165 } 165 }
166 NOTREACHED(); 166 NOTREACHED();
167 } 167 }
168 168
169 // If |shared| is true, sets |profile_path| to the shared profile path. 169 // If |shared| is true, sets |profile_path| to the shared profile path.
170 // Otherwise sets |profile_path| to the user profile path if authenticated and 170 // Otherwise sets |profile_path| to the user profile path if authenticated and
171 // available. Returns 'false' if unable to set |profile_path|. 171 // available. Returns 'false' if unable to set |profile_path|.
172 bool NetworkConnectImpl::GetNetworkProfilePath(bool shared, 172 bool NetworkConnectImpl::GetNetworkProfilePath(bool shared,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 // If a new connect attempt canceled this connect, or a connect attempt to 204 // If a new connect attempt canceled this connect, or a connect attempt to
205 // the same network is in progress, no need to notify the user here since they 205 // the same network is in progress, no need to notify the user here since they
206 // will be notified when the new or existing attempt completes. 206 // will be notified when the new or existing attempt completes.
207 if (error_name == NetworkConnectionHandler::kErrorConnectCanceled || 207 if (error_name == NetworkConnectionHandler::kErrorConnectCanceled ||
208 error_name == NetworkConnectionHandler::kErrorConnecting) { 208 error_name == NetworkConnectionHandler::kErrorConnecting) {
209 return; 209 return;
210 } 210 }
211 211
212 // Already connected to the network, show the settings UI for the network. 212 // Already connected to the network, show the settings UI for the network.
213 if (error_name == NetworkConnectionHandler::kErrorConnected) { 213 if (error_name == NetworkConnectionHandler::kErrorConnected) {
214 ShowNetworkSettings(service_path); 214 ShowNetworkSettingsForPath(service_path);
215 return; 215 return;
216 } 216 }
217 217
218 if (error_name == NetworkConnectionHandler::kErrorBadPassphrase || 218 if (error_name == NetworkConnectionHandler::kErrorBadPassphrase ||
219 error_name == NetworkConnectionHandler::kErrorPassphraseRequired || 219 error_name == NetworkConnectionHandler::kErrorPassphraseRequired ||
220 error_name == NetworkConnectionHandler::kErrorConfigurationRequired || 220 error_name == NetworkConnectionHandler::kErrorConfigurationRequired ||
221 error_name == NetworkConnectionHandler::kErrorAuthenticationRequired) { 221 error_name == NetworkConnectionHandler::kErrorAuthenticationRequired) {
222 HandleUnconfiguredNetwork(service_path); 222 HandleUnconfiguredNetwork(service_path);
223 return; 223 return;
224 } 224 }
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 } 601 }
602 602
603 if (base::StringToLowerASCII(error) == 603 if (base::StringToLowerASCII(error) ==
604 base::StringToLowerASCII(std::string(shill::kUnknownString))) { 604 base::StringToLowerASCII(std::string(shill::kUnknownString))) {
605 return l10n_util::GetStringUTF16(IDS_CHROMEOS_NETWORK_ERROR_UNKNOWN); 605 return l10n_util::GetStringUTF16(IDS_CHROMEOS_NETWORK_ERROR_UNKNOWN);
606 } 606 }
607 return l10n_util::GetStringFUTF16(IDS_NETWORK_UNRECOGNIZED_ERROR, 607 return l10n_util::GetStringFUTF16(IDS_NETWORK_UNRECOGNIZED_ERROR,
608 base::UTF8ToUTF16(error)); 608 base::UTF8ToUTF16(error));
609 } 609 }
610 610
611 void NetworkConnectImpl::ShowNetworkSettings(const std::string& service_path) { 611 void NetworkConnectImpl::ShowNetworkSettingsForPath(
612 delegate_->ShowNetworkSettings(service_path); 612 const std::string& service_path) {
613 const NetworkState* network = GetNetworkState(service_path);
614 delegate_->ShowNetworkSettingsForGuid(network ? network->guid() : "");
613 } 615 }
614 616
615 } // namespace 617 } // namespace
616 618
617 const char NetworkConnect::kErrorActivateFailed[] = "activate-failed"; 619 const char NetworkConnect::kErrorActivateFailed[] = "activate-failed";
618 620
619 static NetworkConnect* g_network_connect = NULL; 621 static NetworkConnect* g_network_connect = NULL;
620 622
621 // static 623 // static
622 void NetworkConnect::Initialize(Delegate* delegate) { 624 void NetworkConnect::Initialize(Delegate* delegate) {
(...skipping 14 matching lines...) Expand all
637 return g_network_connect; 639 return g_network_connect;
638 } 640 }
639 641
640 NetworkConnect::NetworkConnect() { 642 NetworkConnect::NetworkConnect() {
641 } 643 }
642 644
643 NetworkConnect::~NetworkConnect() { 645 NetworkConnect::~NetworkConnect() {
644 } 646 }
645 647
646 } // namespace ui 648 } // namespace ui
OLDNEW
« no previous file with comments | « ui/chromeos/network/network_connect.h ('k') | ui/chromeos/network/network_state_notifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698