Chromium Code Reviews| Index: chrome/browser/chromeos/enrollment_dialog_view.cc |
| diff --git a/chrome/browser/chromeos/enrollment_dialog_view.cc b/chrome/browser/chromeos/enrollment_dialog_view.cc |
| index 405f6afd379fdb8730cd12a9d97f0922fb5ee19f..5d654bf7ff7f2b9a34be45b2bd4fa5999233c486 100644 |
| --- a/chrome/browser/chromeos/enrollment_dialog_view.cc |
| +++ b/chrome/browser/chromeos/enrollment_dialog_view.cc |
| @@ -6,10 +6,13 @@ |
| #include "base/bind.h" |
| #include "base/strings/utf_string_conversions.h" |
| +#include "chrome/browser/chromeos/profiles/profile_helper.h" |
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/browser/profiles/profile_manager.h" |
| #include "chrome/browser/ui/browser_finder.h" |
| #include "chrome/browser/ui/browser_navigator.h" |
| +#include "chromeos/network/client_cert_util.h" |
| +#include "chromeos/network/managed_network_configuration_handler.h" |
| #include "chromeos/network/network_event_log.h" |
| #include "chromeos/network/network_state.h" |
| #include "chromeos/network/network_state_handler.h" |
| @@ -267,27 +270,37 @@ bool CreateDialog(const std::string& service_path, |
| NET_LOG_ERROR("Enrolling Unknown network", service_path); |
| return false; |
| } |
| + Browser* browser = chrome::FindBrowserWithWindow(owning_window); |
| + Profile* profile = |
| + browser ? browser->profile() : ProfileManager::GetPrimaryUserProfile(); |
| + std::string username_hash = ProfileHelper::GetUserIdHashFromProfile(profile); |
| + |
| + onc::ONCSource onc_source = onc::ONC_SOURCE_NONE; |
| + const base::DictionaryValue* policy = |
| + NetworkHandler::Get() |
| + ->managed_network_configuration_handler() |
| + ->FindPolicyByGUID(username_hash, network->guid(), &onc_source); |
| + |
| // We skip certificate patterns for device policy ONC so that an unmanaged |
| // user can't get to the place where a cert is presented for them |
| // involuntarily. |
| - if (network->ui_data().onc_source() == onc::ONC_SOURCE_DEVICE_POLICY) |
| + if (!policy || onc_source == onc::ONC_SOURCE_DEVICE_POLICY) |
| return false; |
| - const CertificatePattern& certificate_pattern = |
| - network->ui_data().certificate_pattern(); |
| - if (certificate_pattern.Empty()) { |
| - NET_LOG_EVENT("No certificate pattern found", service_path); |
| + client_cert::ClientCertConfig cert_config; |
| + OncToClientCertConfig(*policy, &cert_config); |
| + |
| + if (cert_config.client_cert_type != onc::client_cert::kPattern) |
| return false; |
| - } |
| + |
| + if (cert_config.pattern.Empty()) |
| + NET_LOG_ERROR("Certificate pattern is empty", service_path); |
| NET_LOG_USER("Enrolling", service_path); |
| - Browser* browser = chrome::FindBrowserWithWindow(owning_window); |
| - Profile* profile = browser ? browser->profile() : |
| - ProfileManager::GetPrimaryUserProfile(); |
| DialogEnrollmentDelegate* enrollment = |
| new DialogEnrollmentDelegate(owning_window, network->name(), profile); |
| - return enrollment->Enroll(certificate_pattern.enrollment_uri_list(), |
| + return enrollment->Enroll(cert_config.pattern.enrollment_uri_list(), |
|
stevenjb
2014/07/07 19:34:05
Is this valid (i.e. just an empty list) if cert_co
pneubeck (no reviews)
2014/07/09 07:51:26
Done.
Moved the check from the Enroll function to
|
| base::Bind(&EnrollmentComplete, service_path)); |
| } |