Index: chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc |
diff --git a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc |
index baef5d8cb15e5c94da2005daa1ec5721e5d87071..163f11bb0c1053773a1f585622277cd261c77cdf 100644 |
--- a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc |
+++ b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc |
@@ -294,6 +294,7 @@ SigninScreenHandler::SigninScreenHandler( |
native_window_delegate_(NULL), |
show_on_init_(false), |
oobe_ui_(false), |
+ focus_stolen_(false), |
gaia_silent_load_(false), |
is_account_picker_showing_first_time_(false), |
dns_cleared_(false), |
@@ -1052,6 +1053,8 @@ void SigninScreenHandler::ShowSigninScreenIfReady() { |
gaia_silent_load_network_ != active_network_path)) { |
// Network has changed. Force Gaia reload. |
gaia_silent_load_ = false; |
+ // Gaia page will be realoded, so focus isn't stolen anymore. |
+ focus_stolen_ = false; |
} |
// Note that LoadAuthExtension clears |email_|. |
@@ -1071,7 +1074,8 @@ void SigninScreenHandler::ShowSigninScreenIfReady() { |
// The variable is assigned to false because silently loaded Gaia page was |
// used. |
gaia_silent_load_ = false; |
- HandleLoginWebuiReady(); |
+ if (focus_stolen_) |
+ HandleLoginWebuiReady(); |
} |
UpdateState(ErrorScreenActor::ERROR_REASON_UPDATE); |
@@ -1358,16 +1362,16 @@ void SigninScreenHandler::SendUserList(bool animated) { |
bool has_owner = owner.size() > 0; |
size_t max_non_owner_users = has_owner ? kMaxUsers - 1 : kMaxUsers; |
size_t non_owner_count = 0; |
- policy::BrowserPolicyConnectorChromeOS* connector = |
- g_browser_process->platform_part()-> |
- browser_policy_connector_chromeos(); |
- bool is_enterprise_managed = connector->IsEnterpriseManaged(); |
for (UserList::const_iterator it = users.begin(); it != users.end(); ++it) { |
const std::string& email = (*it)->email(); |
bool is_owner = (email == owner); |
bool is_public_account = |
((*it)->GetType() == User::USER_TYPE_PUBLIC_ACCOUNT); |
+ policy::BrowserPolicyConnectorChromeOS* connector = |
Nikita (slow)
2014/04/03 11:46:11
You don't need this code move, it seems to be rela
|
+ g_browser_process->platform_part()-> |
+ browser_policy_connector_chromeos(); |
+ bool is_enterprise_managed = connector->IsEnterpriseManaged(); |
if ((is_public_account && !is_signin_to_add) || |
is_owner || |
@@ -1438,7 +1442,28 @@ void SigninScreenHandler::HandleWallpaperReady() { |
} |
void SigninScreenHandler::HandleLoginWebuiReady() { |
+ if (focus_stolen_) { |
+ // Set focus to the Gaia page. |
+ // TODO(altimofeev): temporary solution, until focus parameters are |
+ // implemented on the Gaia side. |
+ // Do this only once. Any subsequent call would relod GAIA frame. |
+ focus_stolen_ = false; |
+ const char code[] = |
+ "if (typeof gWindowOnLoad != 'undefined) gWindowOnLoad();"; |
+ content::RenderFrameHost* frame = |
+ LoginDisplayHostImpl::GetGaiaAuthIframe(web_ui()->GetWebContents()); |
+ frame->ExecuteJavaScript(base::ASCIIToUTF16(code)); |
+ } |
if (gaia_silent_load_) { |
+ focus_stolen_ = true; |
+ // Prevent focus stealing by the Gaia page. |
+ // TODO(altimofeev): temporary solution, until focus parameters are |
+ // implemented on the Gaia side. |
+ const char code[] = "var gWindowOnLoad = window.onload; " |
+ "window.onload=function() {};"; |
+ content::RenderFrameHost* frame = |
+ LoginDisplayHostImpl::GetGaiaAuthIframe(web_ui()->GetWebContents()); |
+ frame->ExecuteJavaScript(base::ASCIIToUTF16(code)); |
// As we could miss and window.onload could already be called, restore |
// focus to current pod (see crbug/175243). |
RefocusCurrentPod(); |