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

Unified Diff: chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc

Issue 438493002: Added ConsumerManagementService class to handle enroll state and device owner info in boot lockbox. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@signin
Patch Set: Call FlushAndSignBootAttributes() in SetOwner(). Created 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc
diff --git a/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc
index a48a272c0dfb93e2cac00262a5c991c208796bf5..71820d4fd62e5322ac0d203136629d14cb4b8eeb 100644
--- a/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc
@@ -13,6 +13,8 @@
#include "chrome/browser/chromeos/login/ui/login_display_host_impl.h"
#include "chrome/browser/chromeos/login/ui/user_adding_screen.h"
#include "chrome/browser/chromeos/login/users/user_manager.h"
+#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
+#include "chrome/browser/chromeos/policy/consumer_management_service.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/chromeos/settings/cros_settings.h"
#include "chrome/browser/io_thread.h"
@@ -290,13 +292,43 @@ void GaiaScreenHandler::HandleCompleteLogin(const std::string& typed_email,
const std::string& password,
bool using_saml) {
std::string owner_email = UserManager::Get()->GetOwnerEmail();
- if (is_enrolling_consumer_management_ && typed_email != owner_email) {
- // Show Gaia signin page again since we only allow the owner to sign in.
- populated_email_ = owner_email;
- ShowGaia(is_enrolling_consumer_management_);
- return;
+ if (is_enrolling_consumer_management_) {
+ if (typed_email == owner_email) {
+ policy::BrowserPolicyConnectorChromeOS* connector = g_browser_process
bartfab (slow) 2014/08/04 18:44:55 While I was working on another screen handler last
davidyu 2014/08/05 07:27:00 Done.
+ ->platform_part()->browser_policy_connector_chromeos();
bartfab (slow) 2014/08/04 18:44:55 Nit 1: Move the -> operator to the previous line.
davidyu 2014/08/05 07:27:00 Done.
+ connector->GetConsumerManagementService()->SetOwner(
+ owner_email,
+ base::Bind(&GaiaScreenHandler::OnSetOwnerDone,
bartfab (slow) 2014/08/04 18:44:56 Nit: #include "base/bind.h"
davidyu 2014/08/05 07:27:00 Done.
+ weak_factory_.GetWeakPtr(),
+ typed_email, password, using_saml));
bartfab (slow) 2014/08/04 18:44:55 Nit: Add a return statement after this. That way,
davidyu 2014/08/05 07:27:00 Done.
+ } else {
+ // Show Gaia signin page again since we only allow the owner to sign in.
bartfab (slow) 2014/08/04 18:44:56 Nit: s/signin/sign-in/
davidyu 2014/08/05 07:27:00 Done.
+ populated_email_ = owner_email;
+ ShowGaia(is_enrolling_consumer_management_);
+ return;
+ }
+ } else {
+ DoCompleteLogin(typed_email, password, using_saml);
+ }
+}
+
+void GaiaScreenHandler::OnSetOwnerDone(const std::string& typed_email,
+ const std::string& password,
+ bool using_saml,
+ bool result) {
bartfab (slow) 2014/08/04 18:44:55 Nit: |result| is unclear. Better call this |succes
davidyu 2014/08/05 07:27:00 Done.
+ if (!result) {
+ LOG(ERROR) << "Failed to write owner email to boot lockbox.";
bartfab (slow) 2014/08/04 18:44:56 Nit: s/email/e-mail/
davidyu 2014/08/05 07:27:00 Done.
+ policy::BrowserPolicyConnectorChromeOS* connector = g_browser_process
+ ->platform_part()->browser_policy_connector_chromeos();
bartfab (slow) 2014/08/04 18:44:55 Nit: Move the -> operator to the previous line.
davidyu 2014/08/05 07:27:00 Done.
+ connector->GetConsumerManagementService()->SetEnrollState(
+ policy::ConsumerManagementService::ENROLL_BOOT_LOCKBOX_FAILED);
}
+ DoCompleteLogin(typed_email, password, using_saml);
+}
+void GaiaScreenHandler::DoCompleteLogin(const std::string& typed_email,
+ const std::string& password,
+ bool using_saml) {
if (!Delegate())
return;

Powered by Google App Engine
This is Rietveld 408576698