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

Side by Side Diff: chrome/browser/automation/testing_automation_provider_chromeos.cc

Issue 7453051: This factors out all of the parsing code from the network library (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reducing friends to minimal set. Created 9 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/chromeos/cros/native_network_constants.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/automation/testing_automation_provider.h" 5 #include "chrome/browser/automation/testing_automation_provider.h"
6 6
7 #include "base/i18n/time_formatting.h" 7 #include "base/i18n/time_formatting.h"
8 #include "base/stringprintf.h" 8 #include "base/stringprintf.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 const char* error_msg) { 142 const char* error_msg) {
143 AutomationJSONReply* reply = static_cast<AutomationJSONReply*>(user_data); 143 AutomationJSONReply* reply = static_cast<AutomationJSONReply*>(user_data);
144 if (result == chromeos::UPDATE_RESULT_SUCCESS) 144 if (result == chromeos::UPDATE_RESULT_SUCCESS)
145 reply->SendSuccess(NULL); 145 reply->SendSuccess(NULL);
146 else 146 else
147 reply->SendError(error_msg); 147 reply->SendError(error_msg);
148 delete reply; 148 delete reply;
149 } 149 }
150 150
151 const std::string VPNProviderTypeToString( 151 const std::string VPNProviderTypeToString(
152 chromeos::VirtualNetwork::ProviderType provider_type) { 152 chromeos::ProviderType provider_type) {
153 switch (provider_type) { 153 switch (provider_type) {
154 case chromeos::VirtualNetwork::PROVIDER_TYPE_L2TP_IPSEC_PSK: 154 case chromeos::PROVIDER_TYPE_L2TP_IPSEC_PSK:
155 return std::string("L2TP_IPSEC_PSK"); 155 return std::string("L2TP_IPSEC_PSK");
156 case chromeos::VirtualNetwork::PROVIDER_TYPE_L2TP_IPSEC_USER_CERT: 156 case chromeos::PROVIDER_TYPE_L2TP_IPSEC_USER_CERT:
157 return std::string("L2TP_IPSEC_USER_CERT"); 157 return std::string("L2TP_IPSEC_USER_CERT");
158 case chromeos::VirtualNetwork::PROVIDER_TYPE_OPEN_VPN: 158 case chromeos::PROVIDER_TYPE_OPEN_VPN:
159 return std::string("OPEN_VPN"); 159 return std::string("OPEN_VPN");
160 default: 160 default:
161 return std::string("UNSUPPORTED_PROVIDER_TYPE"); 161 return std::string("UNSUPPORTED_PROVIDER_TYPE");
162 } 162 }
163 } 163 }
164 164
165 const char* EnterpriseStatusToString( 165 const char* EnterpriseStatusToString(
166 policy::CloudPolicySubsystem::PolicySubsystemState state) { 166 policy::CloudPolicySubsystem::PolicySubsystemState state) {
167 switch (state) { 167 switch (state) {
168 case policy::CloudPolicySubsystem::UNENROLLED: 168 case policy::CloudPolicySubsystem::UNENROLLED:
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 !args->GetString("password", &password)) { 706 !args->GetString("password", &password)) {
707 AutomationJSONReply(this, reply_message) 707 AutomationJSONReply(this, reply_message)
708 .SendError("Invalid or missing args."); 708 .SendError("Invalid or missing args.");
709 return; 709 return;
710 } 710 }
711 711
712 NetworkLibrary* network_library = CrosLibrary::Get()->GetNetworkLibrary(); 712 NetworkLibrary* network_library = CrosLibrary::Get()->GetNetworkLibrary();
713 713
714 // Attempt to connect to the VPN based on the provider type. 714 // Attempt to connect to the VPN based on the provider type.
715 if (provider_type == VPNProviderTypeToString( 715 if (provider_type == VPNProviderTypeToString(
716 chromeos::VirtualNetwork::PROVIDER_TYPE_L2TP_IPSEC_PSK)) { 716 chromeos::PROVIDER_TYPE_L2TP_IPSEC_PSK)) {
717 if (!args->GetString("key", &key)) { 717 if (!args->GetString("key", &key)) {
718 AutomationJSONReply(this, reply_message) 718 AutomationJSONReply(this, reply_message)
719 .SendError("Missing key arg."); 719 .SendError("Missing key arg.");
720 return; 720 return;
721 } 721 }
722 new VirtualConnectObserver(this, reply_message, service_name); 722 new VirtualConnectObserver(this, reply_message, service_name);
723 // Connect using a pre-shared key. 723 // Connect using a pre-shared key.
724 network_library->ConnectToVirtualNetworkPSK(service_name, 724 network_library->ConnectToVirtualNetworkPSK(service_name,
725 hostname, 725 hostname,
726 key, 726 key,
727 username, 727 username,
728 password); 728 password);
729 } else if (provider_type == VPNProviderTypeToString( 729 } else if (provider_type == VPNProviderTypeToString(
730 chromeos::VirtualNetwork::PROVIDER_TYPE_L2TP_IPSEC_USER_CERT)) { 730 chromeos::PROVIDER_TYPE_L2TP_IPSEC_USER_CERT)) {
731 if (!args->GetString("cert_id", &cert_id) || 731 if (!args->GetString("cert_id", &cert_id) ||
732 !args->GetString("cert_nss", &cert_nss)) { 732 !args->GetString("cert_nss", &cert_nss)) {
733 AutomationJSONReply(this, reply_message) 733 AutomationJSONReply(this, reply_message)
734 .SendError("Missing a certificate arg."); 734 .SendError("Missing a certificate arg.");
735 return; 735 return;
736 } 736 }
737 new VirtualConnectObserver(this, reply_message, service_name); 737 new VirtualConnectObserver(this, reply_message, service_name);
738 // Connect using a user certificate. 738 // Connect using a user certificate.
739 network_library->ConnectToVirtualNetworkCert(service_name, 739 network_library->ConnectToVirtualNetworkCert(service_name,
740 hostname, 740 hostname,
741 cert_nss, 741 cert_nss,
742 cert_id, 742 cert_id,
743 username, 743 username,
744 password); 744 password);
745 } else if (provider_type == VPNProviderTypeToString( 745 } else if (provider_type == VPNProviderTypeToString(
746 chromeos::VirtualNetwork::PROVIDER_TYPE_OPEN_VPN)) { 746 chromeos::PROVIDER_TYPE_OPEN_VPN)) {
747 // Connect using OPEN_VPN. Not yet supported by the VPN implementation. 747 // Connect using OPEN_VPN. Not yet supported by the VPN implementation.
748 AutomationJSONReply(this, reply_message) 748 AutomationJSONReply(this, reply_message)
749 .SendError("Provider type OPEN_VPN is not yet supported."); 749 .SendError("Provider type OPEN_VPN is not yet supported.");
750 return; 750 return;
751 } else { 751 } else {
752 AutomationJSONReply(this, reply_message) 752 AutomationJSONReply(this, reply_message)
753 .SendError("Unsupported provider type."); 753 .SendError("Unsupported provider type.");
754 return; 754 return;
755 } 755 }
756 } 756 }
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
1100 1100
1101 // Set up an observer (it will delete itself). 1101 // Set up an observer (it will delete itself).
1102 take_photo_dialog->AddObserver(new PhotoCaptureObserver( 1102 take_photo_dialog->AddObserver(new PhotoCaptureObserver(
1103 this, reply_message)); 1103 this, reply_message));
1104 1104
1105 views::Widget* window = browser::CreateViewsWindow( 1105 views::Widget* window = browser::CreateViewsWindow(
1106 browser->window()->GetNativeHandle(), take_photo_dialog); 1106 browser->window()->GetNativeHandle(), take_photo_dialog);
1107 window->SetAlwaysOnTop(true); 1107 window->SetAlwaysOnTop(true);
1108 window->Show(); 1108 window->Show();
1109 } 1109 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/cros/native_network_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698