Commit 332bf4ae authored by achuith@chromium.org's avatar achuith@chromium.org

Support for guest signin and new user accounts in gaia signin screen.

BUG=chromium-os:18665,chromium-os:18702
TEST=Should see createAccount/guestSignin links to the right of the gaia signin iframe. chrome://settings/accounts has checkboxes to control the visibility of these links. Clicking these links should work as you'd expect.
Review URL: http://codereview.chromium.org/7497060

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96232 0039d316-1c4b-4281-b951-d872f2087c98
parent 9cce2d32
......@@ -161,6 +161,11 @@ void WebUILoginDisplay::LoginAsGuest() {
delegate_->LoginAsGuest();
}
void WebUILoginDisplay::CreateAccount() {
DCHECK(delegate_);
delegate_->CreateAccount();
}
void WebUILoginDisplay::RemoveUser(const std::string& username) {
UserManager::Get()->RemoveUser(username, this);
}
......
......@@ -75,6 +75,7 @@ class WebUILoginDisplay : public LoginDisplay,
virtual void Login(const std::string& username,
const std::string& password) OVERRIDE;
virtual void LoginAsGuest() OVERRIDE;
virtual void CreateAccount() OVERRIDE;
virtual void RemoveUser(const std::string& username) OVERRIDE;
virtual void ShowEnterpriseEnrollmentScreen() OVERRIDE;
virtual void SetWebUIHandler(
......
......@@ -3,4 +3,11 @@
marginwidth="0"
marginheight="0"
frameborder="0"
scrolling="no"></iframe></div>
scrolling="no"></iframe>
<div id="signin-right">
<div id="createAccount" class="signin-link"
i18n-content="createAccount"></div>
<div id="guestSignin" class="signin-link"
i18n-content="guestSignin"></div>
</div>
</div>
......@@ -34,6 +34,12 @@ cr.define('login', function() {
/** @inheritDoc */
decorate: function() {
$('createAccount').onclick = function() {
chrome.send('createAccount');
};
$('guestSignin').onclick = function() {
chrome.send('launchIncognito');
};
},
/**
......@@ -59,6 +65,9 @@ cr.define('login', function() {
frame.contentWindow.location.href = data.startUrl;
this.extension_url_ = data.startUrl;
// TODO(xiyuan): Pre-populate Gaia with data.email (if any).
$('createAccount').hidden = !data.createAccount;
$('guestSignin').hidden = !data.guestSignin;
},
/**
......
......@@ -14,6 +14,19 @@
height: 470px;
}
#signin-right {
float: right;
font-size: 12px;
margin-right: 80px;
width: 200px;
}
.signin-link {
color: #254f9b;
cursor: pointer;
margin-top: 20px;
}
#gaia-signin > iframe {
bottom: 0;
display: -webkit-box;
......@@ -22,7 +35,7 @@
position: absolute;
right: 0;
top: 0;
width: 100%;
width: 340px;
}
#email,
......
......@@ -93,6 +93,10 @@ void SigninScreenHandler::GetLocalizedStrings(
l10n_util::GetStringUTF16(IDS_LOGIN_OFFLINE_TITLE));
localized_strings->SetString("offlineMessageBody",
l10n_util::GetStringUTF16(IDS_LOGIN_OFFLINE_MESSAGE));
localized_strings->SetString("createAccount",
l10n_util::GetStringUTF16(IDS_CREATE_ACCOUNT_BUTTON));
localized_strings->SetString("guestSignin",
l10n_util::GetStringUTF16(IDS_BROWSE_WITHOUT_SIGNING_IN_BUTTON));
if (extension_driven_)
localized_strings->SetString("authType", "ext");
......@@ -151,6 +155,8 @@ void SigninScreenHandler::RegisterMessages() {
NewCallback(this, &SigninScreenHandler::HandleToggleEnrollmentScreen));
web_ui_->RegisterMessageCallback("launchHelpApp",
NewCallback(this, &SigninScreenHandler::HandleLaunchHelpApp));
web_ui_->RegisterMessageCallback("createAccount",
NewCallback(this, &SigninScreenHandler::HandleCreateAccount));
}
void SigninScreenHandler::HandleGetUsers(const base::ListValue* args) {
......@@ -240,6 +246,11 @@ void SigninScreenHandler::HandleShowAddUser(const base::ListValue* args) {
if (args && args->GetString(0, &email))
params.SetString("email", email);
params.SetBoolean("createAccount",
UserCrosSettingsProvider::cached_allow_new_user());
params.SetBoolean("guestSignin",
UserCrosSettingsProvider::cached_allow_guest());
ShowScreen(kGaiaSigninScreen, &params);
} else {
ShowScreen(kSigninScreen, NULL);
......@@ -335,4 +346,8 @@ void SigninScreenHandler::SendUserList(bool animated) {
users_list, animated_value);
}
void SigninScreenHandler::HandleCreateAccount(const base::ListValue* args) {
delegate_->CreateAccount();
}
} // namespace chromeos
......@@ -6,6 +6,8 @@
#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SIGNIN_SCREEN_HANDLER_H_
#pragma once
#include <string>
#include "base/memory/ref_counted.h"
#include "chrome/browser/chromeos/login/help_app_launcher.h"
#include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
......@@ -28,6 +30,8 @@ class LoginDisplayWebUIHandler {
const std::string& error_text,
const std::string& help_link_text,
HelpAppLauncher::HelpTopic help_topic_id) = 0;
protected:
virtual ~LoginDisplayWebUIHandler() {}
};
// An interface for SigninScreenHandler to call WebUILoginDisplay.
......@@ -46,6 +50,9 @@ class SigninScreenHandlerDelegate {
// Sign in into Guest session.
virtual void LoginAsGuest() = 0;
// Create a new Google account.
virtual void CreateAccount() = 0;
// Attempts to remove given user.
virtual void RemoveUser(const std::string& username) = 0;
......@@ -54,6 +61,9 @@ class SigninScreenHandlerDelegate {
// Let the delegate know about the handler it is supposed to be using.
virtual void SetWebUIHandler(LoginDisplayWebUIHandler* webui_handler) = 0;
protected:
virtual ~SigninScreenHandlerDelegate() {}
};
// A class that handles the WebUI hooks in sign-in screen in OobeDisplay
......@@ -114,6 +124,9 @@ class SigninScreenHandler : public BaseScreenHandler,
// Handles 'launchHelpApp' request.
void HandleLaunchHelpApp(const base::ListValue* args);
// Handle 'createAccount' request.
void HandleCreateAccount(const base::ListValue* args);
// Sends user list to account picker.
void SendUserList(bool animated);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment