summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-11 00:31:36 +0000
committermnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-11 00:31:36 +0000
commit69a99825b6e0268a465a27bb6c529beb5a7c9b51 (patch)
treeb7d136ff2126d6a51ef083f0b7e6aeb7823061ba
parentad37797e7831b162e88c09b093ca3b1647203065 (diff)
downloadchromium_src-69a99825b6e0268a465a27bb6c529beb5a7c9b51.zip
chromium_src-69a99825b6e0268a465a27bb6c529beb5a7c9b51.tar.gz
chromium_src-69a99825b6e0268a465a27bb6c529beb5a7c9b51.tar.bz2
CrOS OOBE: Add device requisition prompt.
This adds a prompt to Chrome OS OOBE allowing the user to input a device requisition string. This will be passed as a hint at enrollment time for the server to request certain device modes. BUG=chromium:238652 TEST=Manual: On the Oobe screen, hit Ctrl+Alt+Shift+D to access the prompt. Review URL: https://chromiumcodereview.appspot.com/14858041 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@205358 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/app/generated_resources.grd10
-rw-r--r--chrome/browser/chromeos/login/webui_login_view.cc9
-rw-r--r--chrome/browser/chromeos/login/wizard_controller.cc34
-rw-r--r--chrome/browser/chromeos/login/wizard_controller.h14
-rw-r--r--chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.cc75
-rw-r--r--chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h18
-rw-r--r--chrome/browser/prefs/browser_prefs.cc2
-rw-r--r--chrome/browser/resources/chromeos/login/display_manager.js46
-rw-r--r--chrome/browser/resources/chromeos/login/login_common.js8
-rw-r--r--chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc26
-rw-r--r--chrome/browser/ui/webui/chromeos/login/core_oobe_handler.h4
-rw-r--r--chrome/common/pref_names.cc9
-rw-r--r--chrome/common/pref_names.h3
13 files changed, 225 insertions, 33 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index b4c374eb..5e158b7 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -14623,6 +14623,16 @@ Some features may be unavailable. Please check that the profile exists and you
<!-- Strings for the new-style OAuth-based enterprise enrollment page -->
<if expr="pp_ifdef('chromeos')">
+ <message name="IDS_ENTERPRISE_DEVICE_REQUISITION_PROMPT_CANCEL" desc="Cancel button text in the device requisition poup.">
+ Cancel
+ </message>
+ <message name="IDS_ENTERPRISE_DEVICE_REQUISITION_PROMPT_OK" desc="OK button text in the device requisition poup.">
+ Set Requisition
+ </message>
+ <message name="IDS_ENTERPRISE_DEVICE_REQUISITION_PROMPT_TEXT" desc="Prompt shown in the device requisition prompt popup.">
+ Use this device requisition when enrolling the device for enterprise management:
+ </message>
+
<message name="IDS_ENTERPRISE_ENROLLMENT_STATUS_REGISTRATION_FAILED" desc="Error message shown on the enrollment screen upon failed device registration.">
Error when registering the device with the server: <ph name="CLIENT_ERROR">$1<ex>Failed to connect to the server</ex></ph>.
</message>
diff --git a/chrome/browser/chromeos/login/webui_login_view.cc b/chrome/browser/chromeos/login/webui_login_view.cc
index 312f40e..bcaba8c 100644
--- a/chrome/browser/chromeos/login/webui_login_view.cc
+++ b/chrome/browser/chromeos/login/webui_login_view.cc
@@ -56,6 +56,8 @@ const char kAccelNameVersion[] = "version";
const char kAccelNameReset[] = "reset";
const char kAccelNameLeft[] = "left";
const char kAccelNameRight[] = "right";
+const char kAccelNameDeviceRequisition[] = "device_requisition";
+const char kAccelNameDeviceRequisitionRemora[] = "device_requisition_remora";
// Observes IPC messages from the FrameSniffer and notifies JS if error
// appears.
@@ -171,6 +173,13 @@ WebUILoginView::WebUILoginView()
accel_map_[ui::Accelerator(ui::VKEY_RIGHT, ui::EF_NONE)] =
kAccelNameRight;
+ accel_map_[ui::Accelerator(
+ ui::VKEY_D, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN | ui::EF_SHIFT_DOWN)] =
+ kAccelNameDeviceRequisition;
+ accel_map_[
+ ui::Accelerator(ui::VKEY_H, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN)] =
+ kAccelNameDeviceRequisitionRemora;
+
for (AccelMap::iterator i(accel_map_.begin()); i != accel_map_.end(); ++i)
AddAccelerator(i->first);
}
diff --git a/chrome/browser/chromeos/login/wizard_controller.cc b/chrome/browser/chromeos/login/wizard_controller.cc
index eb2e8b4..9dd7d2e 100644
--- a/chrome/browser/chromeos/login/wizard_controller.cc
+++ b/chrome/browser/chromeos/login/wizard_controller.cc
@@ -44,10 +44,12 @@
#include "chrome/browser/chromeos/login/startup_utils.h"
#include "chrome/browser/chromeos/login/user_manager.h"
#include "chrome/browser/chromeos/net/network_portal_detector.h"
+#include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h"
#include "chrome/browser/chromeos/settings/cros_settings.h"
#include "chrome/browser/chromeos/settings/cros_settings_names.h"
#include "chrome/browser/chromeos/system/statistics_provider.h"
#include "chrome/browser/chromeos/ui/focus_ring_controller.h"
+#include "chrome/browser/policy/browser_policy_connector.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/options/options_util.h"
@@ -163,18 +165,9 @@ WizardController::WizardController(chromeos::LoginDisplayHost* host,
usage_statistics_reporting_(true),
skip_update_enroll_after_eula_(false),
login_screen_started_(false),
- user_image_screen_return_to_previous_hack_(false),
- force_enrollment_(false),
- can_exit_enrollment_(true) {
+ user_image_screen_return_to_previous_hack_(false) {
DCHECK(default_controller_ == NULL);
default_controller_ = this;
-
- chromeos::system::StatisticsProvider* provider =
- chromeos::system::StatisticsProvider::GetInstance();
- provider->GetMachineFlag(chromeos::kOemIsEnterpriseManagedKey,
- &force_enrollment_);
- provider->GetMachineFlag(chromeos::kOemCanExitEnterpriseEnrollmentKey,
- &can_exit_enrollment_);
}
WizardController::~WizardController() {
@@ -384,7 +377,7 @@ void WizardController::ShowEnrollmentScreen() {
EnrollmentScreen* screen = GetEnrollmentScreen();
screen->SetParameters(is_auto_enrollment,
- !force_enrollment_ || can_exit_enrollment_,
+ !ShouldAutoStartEnrollment() || CanExitEnrollment(),
user);
SetCurrentScreen(screen);
}
@@ -564,16 +557,15 @@ void WizardController::OnUserImageSkipped() {
void WizardController::OnEnrollmentDone() {
// Mark OOBE as completed only if enterprise enrollment was part of the
// forced flow (i.e. app kiosk).
- if (force_enrollment_)
+ if (ShouldAutoStartEnrollment())
PerformPostUpdateActions();
// TODO(mnissler): Unify the logic for auto-login for Public Sessions and
// Kiosk Apps and make this code cover both cases: http://crbug.com/234694.
- if (KioskAppManager::Get()->IsAutoLaunchEnabled()) {
+ if (KioskAppManager::Get()->IsAutoLaunchEnabled())
AutoLaunchKioskApp();
- } else if (!force_enrollment_ || can_exit_enrollment_) {
+ else
ShowLoginScreen();
- }
}
void WizardController::OnResetCanceled() {
@@ -605,7 +597,7 @@ void WizardController::OnAutoEnrollmentDone() {
}
void WizardController::OnOOBECompleted() {
- if (force_enrollment_) {
+ if (ShouldAutoStartEnrollment()) {
ShowEnrollmentScreen();
} else {
PerformPostUpdateActions();
@@ -844,4 +836,14 @@ void WizardController::SetZeroDelays() {
zero_delay_enabled_ = true;
}
+bool WizardController::ShouldAutoStartEnrollment() const {
+ return g_browser_process->browser_policy_connector()->
+ GetDeviceCloudPolicyManager()->ShouldAutoStartEnrollment();
+}
+
+bool WizardController::CanExitEnrollment() const {
+ return g_browser_process->browser_policy_connector()->
+ GetDeviceCloudPolicyManager()->CanExitEnrollment();
+}
+
} // namespace chromeos
diff --git a/chrome/browser/chromeos/login/wizard_controller.h b/chrome/browser/chromeos/login/wizard_controller.h
index b91083c..0f44089 100644
--- a/chrome/browser/chromeos/login/wizard_controller.h
+++ b/chrome/browser/chromeos/login/wizard_controller.h
@@ -31,6 +31,7 @@ class ErrorScreen;
class EulaScreen;
class FocusRingController;
class KioskAutolaunchScreen;
+class LocallyManagedUserCreationScreen;
class LoginDisplayHost;
class NetworkScreen;
class OobeDisplay;
@@ -40,7 +41,6 @@ class UpdateScreen;
class UserImageScreen;
class WizardScreen;
class WrongHWIDScreen;
-class LocallyManagedUserCreationScreen;
// Class that manages control flow between wizard screens. Wizard controller
// interacts with screen controllers to move the user between screens.
@@ -226,6 +226,12 @@ class WizardController : public ScreenObserver {
// Launched kiosk app configured for auto-launch.
void AutoLaunchKioskApp();
+ // Checks whether OOBE should start enrollment automatically.
+ bool ShouldAutoStartEnrollment() const;
+
+ // Checks whether the user is allowed to exit enrollment.
+ bool CanExitEnrollment() const;
+
// Whether to skip any screens that may normally be shown after login
// (registration, Terms of Service, user image selection).
static bool skip_post_login_screens_;
@@ -297,12 +303,6 @@ class WizardController : public ScreenObserver {
// a previous screen instead of proceeding with usual flow.
bool user_image_screen_return_to_previous_hack_;
- // True if OOBE should force enterprise enrollment flow.
- bool force_enrollment_;
-
- // True if OOBE should prevent exiting enterprise enrollment.
- bool can_exit_enrollment_;
-
// A focus ring controller to draw focus ring around view for keyboard
// driven oobe.
scoped_ptr<FocusRingController> focus_ring_controller_;
diff --git a/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.cc b/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.cc
index 1f67d75..ebc0442 100644
--- a/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.cc
+++ b/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.cc
@@ -6,6 +6,8 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
+#include "base/prefs/pref_registry_simple.h"
+#include "base/prefs/pref_service.h"
#include "chrome/browser/chromeos/attestation/attestation_policy_observer.h"
#include "chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.h"
#include "chrome/browser/chromeos/policy/enrollment_handler_chromeos.h"
@@ -50,8 +52,8 @@ const char* kMachineInfoSerialNumberKeys[] = {
"sn", // old ZGB devices (more recent ones use serial_number)
};
-// Fetches a machine statics from StatisticsProvider, returns an empty string on
-// failure.
+// Fetches a machine statistic value from StatisticsProvider, returns an empty
+// string on failure.
std::string GetMachineStatistic(const std::string& key) {
std::string value;
chromeos::system::StatisticsProvider* provider =
@@ -62,6 +64,20 @@ std::string GetMachineStatistic(const std::string& key) {
return value;
}
+// Gets a machine flag from StatisticsProvider, returns the given
+// |default_value| if not present.
+bool GetMachineFlag(const std::string& key, bool default_value) {
+ bool value = default_value;
+ chromeos::system::StatisticsProvider* provider =
+ chromeos::system::StatisticsProvider::GetInstance();
+ if (!provider->GetMachineFlag(key, &value)) {
+ LOG(WARNING) << "Failed to get machine flag " << key;
+ return default_value;
+ }
+
+ return value;
+}
+
} // namespace
DeviceCloudPolicyManagerChromeOS::DeviceCloudPolicyManagerChromeOS(
@@ -101,14 +117,11 @@ void DeviceCloudPolicyManagerChromeOS::StartEnrollment(
CHECK(device_management_service_);
core()->Disconnect();
- if (requisition_.empty())
- requisition_ = GetMachineStatistic(chromeos::kOemDeviceRequisitionKey);
-
enrollment_handler_.reset(
new EnrollmentHandlerChromeOS(
device_store_.get(), install_attributes_, CreateClient(), auth_token,
install_attributes_->GetDeviceId(), is_auto_enrollment,
- requisition_, allowed_device_modes,
+ GetDeviceRequisition(), allowed_device_modes,
base::Bind(&DeviceCloudPolicyManagerChromeOS::EnrollmentCompleted,
base::Unretained(this), callback)));
enrollment_handler_->StartEnrollment();
@@ -121,6 +134,47 @@ void DeviceCloudPolicyManagerChromeOS::CancelEnrollment() {
}
}
+std::string DeviceCloudPolicyManagerChromeOS::GetDeviceRequisition() const {
+ std::string requisition;
+ const PrefService::Preference* pref = local_state_->FindPreference(
+ prefs::kDeviceEnrollmentRequisition);
+ if (pref->IsDefaultValue())
+ requisition = GetMachineStatistic(chromeos::kOemDeviceRequisitionKey);
+ else
+ pref->GetValue()->GetAsString(&requisition);
+
+ return requisition;
+}
+
+void DeviceCloudPolicyManagerChromeOS::SetDeviceRequisition(
+ const std::string& requisition) {
+ if (local_state_) {
+ if (requisition.empty()) {
+ local_state_->ClearPref(prefs::kDeviceEnrollmentRequisition);
+ local_state_->ClearPref(prefs::kDeviceEnrollmentAutoStart);
+ local_state_->ClearPref(prefs::kDeviceEnrollmentCanExit);
+ } else {
+ local_state_->SetString(prefs::kDeviceEnrollmentRequisition, requisition);
+ local_state_->SetBoolean(prefs::kDeviceEnrollmentAutoStart, true);
+ local_state_->SetBoolean(prefs::kDeviceEnrollmentCanExit, false);
+ }
+ }
+}
+
+bool DeviceCloudPolicyManagerChromeOS::ShouldAutoStartEnrollment() const {
+ if (local_state_->HasPrefPath(prefs::kDeviceEnrollmentAutoStart))
+ return local_state_->GetBoolean(prefs::kDeviceEnrollmentAutoStart);
+
+ return GetMachineFlag(chromeos::kOemIsEnterpriseManagedKey, false);
+}
+
+bool DeviceCloudPolicyManagerChromeOS::CanExitEnrollment() const {
+ if (local_state_->HasPrefPath(prefs::kDeviceEnrollmentCanExit))
+ return local_state_->GetBoolean(prefs::kDeviceEnrollmentCanExit);
+
+ return GetMachineFlag(chromeos::kOemCanExitEnterpriseEnrollmentKey, true);
+}
+
void DeviceCloudPolicyManagerChromeOS::Shutdown() {
CloudPolicyManager::Shutdown();
device_status_provider_.reset();
@@ -134,6 +188,15 @@ void DeviceCloudPolicyManagerChromeOS::OnStoreLoaded(CloudPolicyStore* store) {
}
// static
+void DeviceCloudPolicyManagerChromeOS::RegisterPrefs(
+ PrefRegistrySimple* registry) {
+ registry->RegisterStringPref(prefs::kDeviceEnrollmentRequisition,
+ std::string());
+ registry->RegisterBooleanPref(prefs::kDeviceEnrollmentAutoStart, false);
+ registry->RegisterBooleanPref(prefs::kDeviceEnrollmentCanExit, true);
+}
+
+// static
std::string DeviceCloudPolicyManagerChromeOS::GetMachineID() {
std::string machine_id;
chromeos::system::StatisticsProvider* provider =
diff --git a/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h b/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h
index 5caba9f..005028d 100644
--- a/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h
+++ b/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h
@@ -23,6 +23,7 @@ class AttestationPolicyObserver;
}
}
+class PrefRegistrySimple;
class PrefService;
namespace policy {
@@ -62,12 +63,25 @@ class DeviceCloudPolicyManagerChromeOS : public CloudPolicyManager {
// Cancels a pending enrollment operation, if any.
void CancelEnrollment();
+ // Gets/Sets the device requisition.
+ std::string GetDeviceRequisition() const;
+ void SetDeviceRequisition(const std::string& requisition);
+
+ // Checks whether enterprise enrollment should be a regular step during OOBE.
+ bool ShouldAutoStartEnrollment() const;
+
+ // Checks whether the user can cancel enrollment.
+ bool CanExitEnrollment() const;
+
// CloudPolicyManager:
virtual void Shutdown() OVERRIDE;
// CloudPolicyStore::Observer:
virtual void OnStoreLoaded(CloudPolicyStore* store) OVERRIDE;
+ // Pref registration helper.
+ static void RegisterPrefs(PrefRegistrySimple* registry);
+
// Returns the device serial number, or an empty string if not available.
static std::string GetMachineID();
@@ -86,10 +100,6 @@ class DeviceCloudPolicyManagerChromeOS : public CloudPolicyManager {
void EnrollmentCompleted(const EnrollmentCallback& callback,
EnrollmentStatus status);
- // Requisition parameter to send to the server that indicates the intended
- // purpose for the device.
- std::string requisition_;
-
// Points to the same object as the base CloudPolicyManager::store(), but with
// actual device policy specific type.
scoped_ptr<DeviceCloudPolicyStoreChromeOS> device_store_;
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
index c8cda0a..82199f4 100644
--- a/chrome/browser/prefs/browser_prefs.cc
+++ b/chrome/browser/prefs/browser_prefs.cc
@@ -134,6 +134,7 @@
#include "chrome/browser/chromeos/login/user_manager.h"
#include "chrome/browser/chromeos/login/wallpaper_manager.h"
#include "chrome/browser/chromeos/policy/auto_enrollment_client.h"
+#include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h"
#include "chrome/browser/chromeos/policy/device_status_collector.h"
#include "chrome/browser/chromeos/preferences.h"
#include "chrome/browser/chromeos/proxy_config_service_impl.h"
@@ -270,6 +271,7 @@ void RegisterLocalState(PrefRegistrySimple* registry) {
chromeos::WallpaperManager::RegisterPrefs(registry);
chromeos::StartupUtils::RegisterPrefs(registry);
policy::AutoEnrollmentClient::RegisterPrefs(registry);
+ policy::DeviceCloudPolicyManagerChromeOS::RegisterPrefs(registry);
policy::DeviceStatusCollector::RegisterPrefs(registry);
#endif
diff --git a/chrome/browser/resources/chromeos/login/display_manager.js b/chrome/browser/resources/chromeos/login/display_manager.js
index 9988cb4..86c8ffa 100644
--- a/chrome/browser/resources/chromeos/login/display_manager.js
+++ b/chrome/browser/resources/chromeos/login/display_manager.js
@@ -29,6 +29,9 @@
/** @const */ var ACCELERATOR_RESET = 'reset';
/** @const */ var ACCELERATOR_LEFT = 'left';
/** @const */ var ACCELERATOR_RIGHT = 'right';
+/** @const */ var ACCELERATOR_DEVICE_REQUISITION = 'device_requisition';
+/** @const */ var ACCELERATOR_DEVICE_REQUISITION_REMORA =
+ 'device_requisition_remora';
/* Help topic identifiers. */
/** @const */ var HELP_TOPIC_ENTERPRISE_REPORTING = 2535613;
@@ -171,6 +174,14 @@ cr.define('cr.ui.login', function() {
currentStepId == SCREEN_ACCOUNT_PICKER) {
chrome.send('toggleResetScreen');
}
+ } else if (name == ACCELERATOR_DEVICE_REQUISITION) {
+ if (this.isOobeUI())
+ this.showDeviceRequisitionPrompt_();
+ } else if (name == ACCELERATOR_DEVICE_REQUISITION_REMORA) {
+ if (this.isOobeUI()) {
+ this.deviceRequisition_ = 'remora';
+ this.showDeviceRequisitionPrompt_();
+ }
}
if (!this.forceKeyboardFlow_)
@@ -493,6 +504,41 @@ cr.define('cr.ui.login', function() {
},
/**
+ * Shows the device requisition prompt.
+ */
+ showDeviceRequisitionPrompt_: function() {
+ if (!this.deviceRequisitionDialog_) {
+ this.deviceRequisitionDialog_ =
+ new cr.ui.dialogs.PromptDialog(document.body);
+ this.deviceRequisitionDialog_.setOkLabel(
+ loadTimeData.getString('deviceRequisitionPromptOk'));
+ this.deviceRequisitionDialog_.setCancelLabel(
+ loadTimeData.getString('deviceRequisitionPromptCancel'));
+ }
+ this.deviceRequisitionDialog_.show(
+ loadTimeData.getString('deviceRequisitionPromptText'),
+ this.deviceRequisition_,
+ this.onConfirmDeviceRequisitionPrompt_.bind(this));
+ },
+
+ /**
+ * Confirmation handle for the device requisition prompt.
+ * @param {string} value The value entered by the user.
+ */
+ onConfirmDeviceRequisitionPrompt_: function(value) {
+ this.deviceRequisition_ = value;
+ chrome.send('setDeviceRequisition', [value]);
+ },
+
+ /*
+ * Updates the device requisition string shown in the requisition prompt.
+ * @param {string} requisition The device requisition.
+ */
+ updateDeviceRequisition: function(requisition) {
+ this.deviceRequisition_ = requisition;
+ },
+
+ /**
* Returns true if Oobe UI is shown.
*/
isOobeUI: function() {
diff --git a/chrome/browser/resources/chromeos/login/login_common.js b/chrome/browser/resources/chromeos/login/login_common.js
index 0de9543..ed0c56c 100644
--- a/chrome/browser/resources/chromeos/login/login_common.js
+++ b/chrome/browser/resources/chromeos/login/login_common.js
@@ -215,6 +215,14 @@ cr.define('cr.ui', function() {
};
/**
+ * Updates the device requisition string shown in the requisition prompt.
+ * @param {string} requisition The device requisition.
+ */
+ Oobe.updateDeviceRequisition = function(requisition) {
+ Oobe.getInstance().updateDeviceRequisition(requisition);
+ };
+
+ /**
* Enforces focus on user pod of locked user.
*/
Oobe.forceLockedUserPodFocus = function() {
diff --git a/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc b/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc
index 3246254..52e3951 100644
--- a/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc
@@ -6,10 +6,13 @@
#include "ash/magnifier/magnifier_constants.h"
#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
#include "chrome/browser/chromeos/accessibility/magnification_manager.h"
#include "chrome/browser/chromeos/login/wizard_controller.h"
+#include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h"
#include "chrome/browser/chromeos/system/statistics_provider.h"
+#include "chrome/browser/policy/browser_policy_connector.h"
#include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_notification_types.h"
@@ -76,6 +79,14 @@ void CoreOobeHandler::DeclareLocalizedValues(LocalizedValuesBuilder* builder) {
builder->Add("largeCursorOption", IDS_OOBE_LARGE_CURSOR_OPTION);
builder->Add("highContrastOption", IDS_OOBE_HIGH_CONTRAST_MODE_OPTION);
builder->Add("screenMagnifierOption", IDS_OOBE_SCREEN_MAGNIFIER_OPTION);
+
+ // Strings for the device requisition prompt.
+ builder->Add("deviceRequisitionPromptCancel",
+ IDS_ENTERPRISE_DEVICE_REQUISITION_PROMPT_CANCEL);
+ builder->Add("deviceRequisitionPromptOk",
+ IDS_ENTERPRISE_DEVICE_REQUISITION_PROMPT_OK);
+ builder->Add("deviceRequisitionPromptText",
+ IDS_ENTERPRISE_DEVICE_REQUISITION_PROMPT_TEXT);
}
void CoreOobeHandler::Initialize() {
@@ -86,6 +97,7 @@ void CoreOobeHandler::Initialize() {
#else
version_info_updater_.StartUpdate(false);
#endif
+ UpdateDeviceRequisition();
}
void CoreOobeHandler::RegisterMessages() {
@@ -103,6 +115,8 @@ void CoreOobeHandler::RegisterMessages() {
&CoreOobeHandler::HandleEnableScreenMagnifier);
AddCallback(kJsApiEnableSpokenFeedback,
&CoreOobeHandler::HandleEnableSpokenFeedback);
+ AddCallback("setDeviceRequisition",
+ &CoreOobeHandler::HandleSetDeviceRequisition);
}
void CoreOobeHandler::HandleInitialized() {
@@ -142,6 +156,12 @@ void CoreOobeHandler::HandleEnableSpokenFeedback() {
web_ui(), ash::A11Y_NOTIFICATION_NONE);
}
+void CoreOobeHandler::HandleSetDeviceRequisition(
+ const std::string& requisition) {
+ g_browser_process->browser_policy_connector()->GetDeviceCloudPolicyManager()->
+ SetDeviceRequisition(requisition);
+}
+
void CoreOobeHandler::ShowOobeUI(bool show) {
if (show == show_oobe_ui_)
return;
@@ -206,6 +226,12 @@ void CoreOobeHandler::UpdateLabel(const std::string& id,
CallJS("cr.ui.Oobe.setLabelText", id, text);
}
+void CoreOobeHandler::UpdateDeviceRequisition() {
+ CallJS("cr.ui.Oobe.updateDeviceRequisition",
+ g_browser_process->browser_policy_connector()->
+ GetDeviceCloudPolicyManager()->GetDeviceRequisition());
+}
+
void CoreOobeHandler::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
diff --git a/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.h b/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.h
index a992728..087a099 100644
--- a/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.h
+++ b/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.h
@@ -63,6 +63,7 @@ class CoreOobeHandler : public BaseScreenHandler,
void HandleInitialized();
void HandleSkipUpdateEnrollAfterEula();
void HandleUpdateCurrentScreen(const std::string& screen);
+ void HandleSetDeviceRequisition(const std::string& requisition);
// Updates a11y menu state based on the current a11y features state(on/off).
void UpdateA11yState();
@@ -73,6 +74,9 @@ class CoreOobeHandler : public BaseScreenHandler,
// Updates label with specified id with specified text.
void UpdateLabel(const std::string& id, const std::string& text);
+ // Updates the device requisition string on the UI side.
+ void UpdateDeviceRequisition();
+
// content::NotificationObserver implementation:
virtual void Observe(int type,
const content::NotificationSource& source,
diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc
index b05f71a..254407d 100644
--- a/chrome/common/pref_names.cc
+++ b/chrome/common/pref_names.cc
@@ -2107,6 +2107,15 @@ const char kRebootAfterUpdate[] = "automatic_reboot.reboot_after_update";
// Public Accounts and kiosks.
const char kDeviceRobotAnyApiRefreshToken[] =
"device_robot_refresh_token.any-api";
+
+// Device requisition for enterprise enrollment.
+const char kDeviceEnrollmentRequisition[] = "enrollment.device_requisition";
+
+// Whether to automatically start the enterprise enrollment step during OOBE.
+const char kDeviceEnrollmentAutoStart[] = "enrollment.auto_start";
+
+// Whether the user may exit enrollment.
+const char kDeviceEnrollmentCanExit[] = "enrollment.can_exit";
#endif
// Whether there is a Flash version installed that supports clearing LSO data.
diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h
index 83ef2bd..34777e2 100644
--- a/chrome/common/pref_names.h
+++ b/chrome/common/pref_names.h
@@ -772,6 +772,9 @@ extern const char kOwnerTapToClickEnabled[];
extern const char kUptimeLimit[];
extern const char kRebootAfterUpdate[];
extern const char kDeviceRobotAnyApiRefreshToken[];
+extern const char kDeviceEnrollmentRequisition[];
+extern const char kDeviceEnrollmentAutoStart[];
+extern const char kDeviceEnrollmentCanExit[];
#endif
extern const char kClearPluginLSODataEnabled[];