OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/webui/signin/inline_login_ui.h" | 5 #include "chrome/browser/ui/webui/signin/inline_login_ui.h" |
6 | 6 |
7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
8 #include "chrome/common/url_constants.h" | 8 #include "chrome/common/url_constants.h" |
9 #include "content/public/browser/web_ui.h" | 9 #include "content/public/browser/web_ui.h" |
10 #include "content/public/browser/web_ui_data_source.h" | 10 #include "content/public/browser/web_ui_data_source.h" |
11 #include "grit/browser_resources.h" | 11 #include "grit/browser_resources.h" |
12 | 12 #include "grit/chromium_strings.h" |
13 #include "grit/generated_resources.h" | |
xiyuan
2014/01/07 21:51:56
nit: this is probably not needed.
guohui
2014/01/07 22:10:42
Done.
| |
13 #if defined(OS_CHROMEOS) | 14 #if defined(OS_CHROMEOS) |
14 #include "chrome/browser/ui/webui/chromeos/login/inline_login_handler_chromeos.h " | 15 #include "chrome/browser/ui/webui/chromeos/login/inline_login_handler_chromeos.h " |
15 #else | 16 #else |
16 #include "chrome/browser/extensions/tab_helper.h" | 17 #include "chrome/browser/extensions/tab_helper.h" |
17 #include "chrome/browser/ui/webui/signin/inline_login_handler_impl.h" | 18 #include "chrome/browser/ui/webui/signin/inline_login_handler_impl.h" |
18 #endif | 19 #endif |
19 | 20 |
20 namespace { | 21 namespace { |
21 | 22 |
22 content::WebUIDataSource* CreateWebUIDataSource() { | 23 content::WebUIDataSource* CreateWebUIDataSource() { |
23 content::WebUIDataSource* source = | 24 content::WebUIDataSource* source = |
24 content::WebUIDataSource::Create(chrome::kChromeUIChromeSigninHost); | 25 content::WebUIDataSource::Create(chrome::kChromeUIChromeSigninHost); |
25 source->SetUseJsonJSFormatV2(); | 26 source->SetUseJsonJSFormatV2(); |
26 source->SetJsonPath("strings.js"); | 27 source->SetJsonPath("strings.js"); |
27 | 28 |
28 source->SetDefaultResource(IDR_INLINE_LOGIN_HTML); | 29 source->SetDefaultResource(IDR_INLINE_LOGIN_HTML); |
29 source->AddResourcePath("inline_login.css", IDR_INLINE_LOGIN_CSS); | 30 source->AddResourcePath("inline_login.css", IDR_INLINE_LOGIN_CSS); |
30 source->AddResourcePath("inline_login.js", IDR_INLINE_LOGIN_JS); | 31 source->AddResourcePath("inline_login.js", IDR_INLINE_LOGIN_JS); |
32 | |
33 source->AddLocalizedString("title", IDS_CHROME_SIGNIN_TITLE); | |
31 return source; | 34 return source; |
32 }; | 35 }; |
33 | 36 |
34 } // empty namespace | 37 } // empty namespace |
35 | 38 |
36 InlineLoginUI::InlineLoginUI(content::WebUI* web_ui) | 39 InlineLoginUI::InlineLoginUI(content::WebUI* web_ui) |
37 : WebDialogUI(web_ui), | 40 : WebDialogUI(web_ui), |
38 auth_extension_(Profile::FromWebUI(web_ui)) { | 41 auth_extension_(Profile::FromWebUI(web_ui)) { |
39 Profile* profile = Profile::FromWebUI(web_ui); | 42 Profile* profile = Profile::FromWebUI(web_ui); |
40 content::WebUIDataSource::Add(profile, CreateWebUIDataSource()); | 43 content::WebUIDataSource::Add(profile, CreateWebUIDataSource()); |
41 | 44 |
42 #if defined(OS_CHROMEOS) | 45 #if defined(OS_CHROMEOS) |
43 web_ui->AddMessageHandler(new chromeos::InlineLoginHandlerChromeOS()); | 46 web_ui->AddMessageHandler(new chromeos::InlineLoginHandlerChromeOS()); |
44 #else | 47 #else |
45 web_ui->AddMessageHandler(new InlineLoginHandlerImpl()); | 48 web_ui->AddMessageHandler(new InlineLoginHandlerImpl()); |
46 // Required for intercepting extension function calls when the page is loaded | 49 // Required for intercepting extension function calls when the page is loaded |
47 // in a bubble (not a full tab, thus tab helpers are not registered | 50 // in a bubble (not a full tab, thus tab helpers are not registered |
48 // automatically). | 51 // automatically). |
49 extensions::TabHelper::CreateForWebContents(web_ui->GetWebContents()); | 52 extensions::TabHelper::CreateForWebContents(web_ui->GetWebContents()); |
50 #endif | 53 #endif |
51 } | 54 } |
52 | 55 |
53 InlineLoginUI::~InlineLoginUI() {} | 56 InlineLoginUI::~InlineLoginUI() {} |
OLD | NEW |