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

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

Issue 1412453002: Remove enable-iframe-based-signin flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unneeded test class Created 5 years, 1 month 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
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 "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 return true; 55 return true;
56 } 56 }
57 57
58 content::WebUIDataSource* CreateWebUIDataSource() { 58 content::WebUIDataSource* CreateWebUIDataSource() {
59 content::WebUIDataSource* source = 59 content::WebUIDataSource* source =
60 content::WebUIDataSource::Create(chrome::kChromeUIChromeSigninHost); 60 content::WebUIDataSource::Create(chrome::kChromeUIChromeSigninHost);
61 source->OverrideContentSecurityPolicyFrameSrc("frame-src chrome-extension:;"); 61 source->OverrideContentSecurityPolicyFrameSrc("frame-src chrome-extension:;");
62 source->OverrideContentSecurityPolicyObjectSrc("object-src *;"); 62 source->OverrideContentSecurityPolicyObjectSrc("object-src *;");
63 source->SetJsonPath("strings.js"); 63 source->SetJsonPath("strings.js");
64 64
65 bool is_webview_signin_enabled = switches::IsEnableWebviewBasedSignin(); 65 source->SetDefaultResource(IDR_NEW_INLINE_LOGIN_HTML);
66 source->SetDefaultResource(is_webview_signin_enabled ?
67 IDR_NEW_INLINE_LOGIN_HTML : IDR_INLINE_LOGIN_HTML);
68 66
69 // Only add a filter when runing as test. 67 // Only add a filter when runing as test.
70 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 68 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
71 const bool is_running_test = command_line->HasSwitch(::switches::kTestName) || 69 const bool is_running_test = command_line->HasSwitch(::switches::kTestName) ||
72 command_line->HasSwitch(::switches::kTestType); 70 command_line->HasSwitch(::switches::kTestType);
73 if (is_running_test) 71 if (is_running_test)
74 source->SetRequestFilter(base::Bind(&HandleTestFileRequestCallback)); 72 source->SetRequestFilter(base::Bind(&HandleTestFileRequestCallback));
75 73
76 source->AddResourcePath("inline_login.css", IDR_INLINE_LOGIN_CSS); 74 source->AddResourcePath("inline_login.css", IDR_INLINE_LOGIN_CSS);
77 source->AddResourcePath("inline_login.js", IDR_INLINE_LOGIN_JS); 75 source->AddResourcePath("inline_login.js", IDR_INLINE_LOGIN_JS);
78 source->AddResourcePath("gaia_auth_host.js", is_webview_signin_enabled ? 76 source->AddResourcePath("gaia_auth_host.js", IDR_GAIA_AUTH_AUTHENTICATOR_JS);
79 IDR_GAIA_AUTH_AUTHENTICATOR_JS : IDR_GAIA_AUTH_HOST_JS);
80 77
81 source->AddLocalizedString("title", IDS_CHROME_SIGNIN_TITLE); 78 source->AddLocalizedString("title", IDS_CHROME_SIGNIN_TITLE);
82 return source; 79 return source;
83 } 80 }
84 81
85 void AddToSetIfIsAuthIframe(std::set<content::RenderFrameHost*>* frame_set, 82 void AddToSetIfIsAuthIframe(std::set<content::RenderFrameHost*>* frame_set,
86 const GURL& parent_origin, 83 const GURL& parent_origin,
87 const std::string& parent_frame_name, 84 const std::string& parent_frame_name,
88 content::RenderFrameHost* frame) { 85 content::RenderFrameHost* frame) {
89 content::RenderFrameHost* parent = frame->GetParent(); 86 content::RenderFrameHost* parent = frame->GetParent();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 } 127 }
131 128
132 InlineLoginUI::~InlineLoginUI() {} 129 InlineLoginUI::~InlineLoginUI() {}
133 130
134 // Gets the Gaia iframe within a WebContents. 131 // Gets the Gaia iframe within a WebContents.
135 content::RenderFrameHost* InlineLoginUI::GetAuthFrame( 132 content::RenderFrameHost* InlineLoginUI::GetAuthFrame(
136 content::WebContents* web_contents, 133 content::WebContents* web_contents,
137 const GURL& parent_origin, 134 const GURL& parent_origin,
138 const std::string& parent_frame_name) { 135 const std::string& parent_frame_name) {
139 std::set<content::RenderFrameHost*> frame_set; 136 std::set<content::RenderFrameHost*> frame_set;
140 bool is_webview = switches::IsEnableWebviewBasedSignin(); 137 bool is_webview = true;
141 #if defined(OS_CHROMEOS) 138 #if defined(OS_CHROMEOS)
142 is_webview = is_webview || chromeos::StartupUtils::IsWebviewSigninEnabled(); 139 is_webview = chromeos::StartupUtils::IsWebviewSigninEnabled();
143 #endif 140 #endif
144 if (is_webview) { 141 if (is_webview) {
145 guest_view::GuestViewManager* manager = 142 guest_view::GuestViewManager* manager =
146 guest_view::GuestViewManager::FromBrowserContext( 143 guest_view::GuestViewManager::FromBrowserContext(
147 web_contents->GetBrowserContext()); 144 web_contents->GetBrowserContext());
148 if (manager) { 145 if (manager) {
149 manager->ForEachGuest( 146 manager->ForEachGuest(
150 web_contents, 147 web_contents,
151 base::Bind(&AddToSetIfSigninWebview, &frame_set, parent_frame_name)); 148 base::Bind(&AddToSetIfSigninWebview, &frame_set, parent_frame_name));
152 } 149 }
153 } else { 150 } else {
154 web_contents->ForEachFrame( 151 web_contents->ForEachFrame(
155 base::Bind(&AddToSetIfIsAuthIframe, &frame_set, 152 base::Bind(&AddToSetIfIsAuthIframe, &frame_set,
156 parent_origin, parent_frame_name)); 153 parent_origin, parent_frame_name));
157 } 154 }
158 DCHECK_GE(1U, frame_set.size()); 155 DCHECK_GE(1U, frame_set.size());
159 if (!frame_set.empty()) 156 if (!frame_set.empty())
160 return *frame_set.begin(); 157 return *frame_set.begin();
161 158
162 return NULL; 159 return NULL;
163 } 160 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698