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_ui.h"
7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/common/url_constants.h"
9 #include "content/public/browser/web_ui.h"
10 #include "content/public/browser/web_ui_data_source.h"
11 #include "grit/browser_resources.h"
12 #include "grit/chromium_strings.h"
13 #if defined(OS_CHROMEOS)
14 #include "chrome/browser/ui/webui/chromeos/login/inline_login_handler_chromeos.h"
16 #include "chrome/browser/extensions/tab_helper.h"
17 #include "chrome/browser/ui/webui/signin/inline_login_handler_impl.h"
22 content::WebUIDataSource
* CreateWebUIDataSource() {
23 content::WebUIDataSource
* source
=
24 content::WebUIDataSource::Create(chrome::kChromeUIChromeSigninHost
);
25 source
->SetUseJsonJSFormatV2();
26 source
->SetJsonPath("strings.js");
28 source
->SetDefaultResource(IDR_INLINE_LOGIN_HTML
);
29 source
->AddResourcePath("inline_login.css", IDR_INLINE_LOGIN_CSS
);
30 source
->AddResourcePath("inline_login.js", IDR_INLINE_LOGIN_JS
);
32 source
->AddLocalizedString("title", IDS_CHROME_SIGNIN_TITLE
);
38 InlineLoginUI::InlineLoginUI(content::WebUI
* web_ui
)
39 : WebDialogUI(web_ui
),
40 auth_extension_(Profile::FromWebUI(web_ui
)) {
41 Profile
* profile
= Profile::FromWebUI(web_ui
);
42 content::WebUIDataSource::Add(profile
, CreateWebUIDataSource());
44 #if defined(OS_CHROMEOS)
45 web_ui
->AddMessageHandler(new chromeos::InlineLoginHandlerChromeOS());
47 web_ui
->AddMessageHandler(new InlineLoginHandlerImpl());
48 // Required for intercepting extension function calls when the page is loaded
49 // in a bubble (not a full tab, thus tab helpers are not registered
51 extensions::TabHelper::CreateForWebContents(web_ui
->GetWebContents());
55 InlineLoginUI::~InlineLoginUI() {}