1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/webui/signin/inline_login_handler.h"
8 #include "base/values.h"
9 #include "chrome/browser/browser_process.h"
10 #include "content/public/browser/web_ui.h"
11 #include "google_apis/gaia/gaia_urls.h"
13 InlineLoginHandler::InlineLoginHandler() {}
15 InlineLoginHandler::~InlineLoginHandler() {}
17 void InlineLoginHandler::RegisterMessages() {
18 web_ui()->RegisterMessageCallback("initialize",
19 base::Bind(&InlineLoginHandler::HandleInitializeMessage
,
20 base::Unretained(this)));
21 web_ui()->RegisterMessageCallback("completeLogin",
22 base::Bind(&InlineLoginHandler::HandleCompleteLoginMessage
,
23 base::Unretained(this)));
26 void InlineLoginHandler::HandleInitializeMessage(const base::ListValue
* args
) {
27 base::DictionaryValue params
;
29 const std::string
& app_locale
= g_browser_process
->GetApplicationLocale();
30 params
.SetString("hl", app_locale
);
31 GaiaUrls
* gaiaUrls
= GaiaUrls::GetInstance();
32 params
.SetString("gaiaUrl", gaiaUrls
->gaia_url().spec());
33 params
.SetInteger("authMode", kDefaultAuthMode
);
35 SetExtraInitParams(params
);
37 web_ui()->CallJavascriptFunction("inline.login.loadAuthExtension", params
);
40 void InlineLoginHandler::HandleCompleteLoginMessage(
41 const base::ListValue
* args
) {