Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Side by Side Diff: chrome/browser/ui/webui/signin/inline_login_ui.cc

Issue 134263005: Implement inline signin with iframe (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make embedded view messaging work Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include "grit/chromium_strings.h" 12 #include "grit/chromium_strings.h"
13 #if defined(OS_CHROMEOS) 13 #if defined(OS_CHROMEOS)
14 #include "chrome/browser/ui/webui/chromeos/login/inline_login_handler_chromeos.h " 14 #include "chrome/browser/ui/webui/chromeos/login/inline_login_handler_chromeos.h "
15 #else 15 #else
16 #include "chrome/browser/extensions/tab_helper.h" 16 #include "chrome/browser/extensions/tab_helper.h"
17 #include "chrome/browser/ui/webui/signin/inline_login_handler_impl.h" 17 #include "chrome/browser/ui/webui/signin/inline_login_handler_impl.h"
18 #endif 18 #endif
19 19
20 namespace { 20 namespace {
21 21
22 content::WebUIDataSource* CreateWebUIDataSource() { 22 content::WebUIDataSource* CreateWebUIDataSource() {
23 content::WebUIDataSource* source = 23 content::WebUIDataSource* source =
24 content::WebUIDataSource::Create(chrome::kChromeUIChromeSigninHost); 24 content::WebUIDataSource::Create(chrome::kChromeUIChromeSigninHost);
25 source->OverrideContentSecurityPolicyFrameSrc("frame-src chrome-extension:;");
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);
31 32
32 source->AddLocalizedString("title", IDS_CHROME_SIGNIN_TITLE); 33 source->AddLocalizedString("title", IDS_CHROME_SIGNIN_TITLE);
33 return source; 34 return source;
34 }; 35 };
35 36
36 } // empty namespace 37 } // empty namespace
37 38
38 InlineLoginUI::InlineLoginUI(content::WebUI* web_ui) 39 InlineLoginUI::InlineLoginUI(content::WebUI* web_ui)
39 : WebDialogUI(web_ui), 40 : WebDialogUI(web_ui),
40 auth_extension_(Profile::FromWebUI(web_ui)) { 41 auth_extension_(Profile::FromWebUI(web_ui)) {
41 Profile* profile = Profile::FromWebUI(web_ui); 42 Profile* profile = Profile::FromWebUI(web_ui);
42 content::WebUIDataSource::Add(profile, CreateWebUIDataSource()); 43 content::WebUIDataSource::Add(profile, CreateWebUIDataSource());
43 44
44 #if defined(OS_CHROMEOS) 45 #if defined(OS_CHROMEOS)
45 web_ui->AddMessageHandler(new chromeos::InlineLoginHandlerChromeOS()); 46 web_ui->AddMessageHandler(new chromeos::InlineLoginHandlerChromeOS());
46 #else 47 #else
47 web_ui->AddMessageHandler(new InlineLoginHandlerImpl()); 48 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
50 // automatically).
51 extensions::TabHelper::CreateForWebContents(web_ui->GetWebContents());
guohui 2014/02/11 22:29:57 To fix the embedded signin flow, instead of creati
xiyuan 2014/02/11 22:39:55 We need "ExtensionWebContentsObserver". But this l
guohui 2014/02/11 23:22:43 I had similar issue before when implementing the e
Roger Tawa OOO till Jul 10th 2014/02/12 03:07:12 Implemented Xiyuan's suggestion here.
52 #endif 49 #endif
53 } 50 }
54 51
55 InlineLoginUI::~InlineLoginUI() {} 52 InlineLoginUI::~InlineLoginUI() {}
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/signin/inline_login_handler_impl.cc ('k') | content/browser/webui/url_data_manager_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698