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/extensions/chrome_extension_web_contents_observer.h" | 7 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/sessions/session_tab_helper.h" |
9 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
10 #include "content/public/browser/web_ui.h" | 11 #include "content/public/browser/web_ui.h" |
11 #include "content/public/browser/web_ui_data_source.h" | 12 #include "content/public/browser/web_ui_data_source.h" |
12 #include "grit/browser_resources.h" | 13 #include "grit/browser_resources.h" |
13 #include "grit/chromium_strings.h" | 14 #include "grit/chromium_strings.h" |
14 #if defined(OS_CHROMEOS) | 15 #if defined(OS_CHROMEOS) |
15 #include "chrome/browser/ui/webui/chromeos/login/inline_login_handler_chromeos.h
" | 16 #include "chrome/browser/ui/webui/chromeos/login/inline_login_handler_chromeos.h
" |
16 #else | 17 #else |
17 #include "chrome/browser/extensions/tab_helper.h" | |
18 #include "chrome/browser/ui/webui/signin/inline_login_handler_impl.h" | 18 #include "chrome/browser/ui/webui/signin/inline_login_handler_impl.h" |
19 #endif | 19 #endif |
20 | 20 |
21 namespace { | 21 namespace { |
22 | 22 |
23 content::WebUIDataSource* CreateWebUIDataSource() { | 23 content::WebUIDataSource* CreateWebUIDataSource() { |
24 content::WebUIDataSource* source = | 24 content::WebUIDataSource* source = |
25 content::WebUIDataSource::Create(chrome::kChromeUIChromeSigninHost); | 25 content::WebUIDataSource::Create(chrome::kChromeUIChromeSigninHost); |
26 source->OverrideContentSecurityPolicyFrameSrc("frame-src chrome-extension:;"); | 26 source->OverrideContentSecurityPolicyFrameSrc("frame-src chrome-extension:;"); |
27 source->SetUseJsonJSFormatV2(); | 27 source->SetUseJsonJSFormatV2(); |
(...skipping 12 matching lines...) Expand all Loading... |
40 InlineLoginUI::InlineLoginUI(content::WebUI* web_ui) | 40 InlineLoginUI::InlineLoginUI(content::WebUI* web_ui) |
41 : WebDialogUI(web_ui), | 41 : WebDialogUI(web_ui), |
42 auth_extension_(Profile::FromWebUI(web_ui)) { | 42 auth_extension_(Profile::FromWebUI(web_ui)) { |
43 Profile* profile = Profile::FromWebUI(web_ui); | 43 Profile* profile = Profile::FromWebUI(web_ui); |
44 content::WebUIDataSource::Add(profile, CreateWebUIDataSource()); | 44 content::WebUIDataSource::Add(profile, CreateWebUIDataSource()); |
45 | 45 |
46 #if defined(OS_CHROMEOS) | 46 #if defined(OS_CHROMEOS) |
47 web_ui->AddMessageHandler(new chromeos::InlineLoginHandlerChromeOS()); | 47 web_ui->AddMessageHandler(new chromeos::InlineLoginHandlerChromeOS()); |
48 #else | 48 #else |
49 web_ui->AddMessageHandler(new InlineLoginHandlerImpl()); | 49 web_ui->AddMessageHandler(new InlineLoginHandlerImpl()); |
| 50 #endif |
| 51 content::WebContents* contents = web_ui->GetWebContents(); |
50 // Required for intercepting extension function calls when the page is loaded | 52 // Required for intercepting extension function calls when the page is loaded |
51 // in a bubble (not a full tab, thus tab helpers are not registered | 53 // in a bubble (not a full tab, thus tab helpers are not registered |
52 // automatically). | 54 // automatically). |
53 extensions::ChromeExtensionWebContentsObserver::CreateForWebContents( | 55 extensions::ChromeExtensionWebContentsObserver::CreateForWebContents( |
54 web_ui->GetWebContents()); | 56 contents); |
55 #endif | 57 // Ensure that the login UI has a tab ID, which will allow the GAIA auth |
| 58 // extension's background script to tell it apart from iframes injected by |
| 59 // other extensions. |
| 60 SessionTabHelper::CreateForWebContents(contents); |
56 } | 61 } |
57 | 62 |
58 InlineLoginUI::~InlineLoginUI() {} | 63 InlineLoginUI::~InlineLoginUI() {} |
OLD | NEW |