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

Side by Side Diff: chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc

Issue 317093002: Show confirmation dialog for unsecure signin (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: filter http request from native code instead of JS Created 6 years, 5 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/chromeos/login/gaia_screen_handler.h" 5 #include "chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/values.h" 10 #include "base/values.h"
11 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/browser_shutdown.h" 12 #include "chrome/browser/browser_shutdown.h"
13 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h"
14 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" 13 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h"
15 #include "chrome/browser/chromeos/login/users/user_manager.h" 14 #include "chrome/browser/chromeos/login/users/user_manager.h"
16 #include "chrome/browser/chromeos/profiles/profile_helper.h" 15 #include "chrome/browser/chromeos/profiles/profile_helper.h"
17 #include "chrome/browser/chromeos/settings/cros_settings.h" 16 #include "chrome/browser/chromeos/settings/cros_settings.h"
18 #include "chrome/browser/io_thread.h" 17 #include "chrome/browser/io_thread.h"
19 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" 18 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h"
19 #include "chrome/browser/ui/webui/signin/inline_login_ui.h"
20 #include "chromeos/chromeos_switches.h" 20 #include "chromeos/chromeos_switches.h"
21 #include "chromeos/settings/cros_settings_names.h" 21 #include "chromeos/settings/cros_settings_names.h"
22 #include "content/public/browser/browser_thread.h" 22 #include "content/public/browser/browser_thread.h"
23 #include "content/public/browser/render_frame_host.h" 23 #include "content/public/browser/render_frame_host.h"
24 #include "google_apis/gaia/gaia_auth_util.h" 24 #include "google_apis/gaia/gaia_auth_util.h"
25 #include "google_apis/gaia/gaia_switches.h" 25 #include "google_apis/gaia/gaia_switches.h"
26 #include "google_apis/gaia/gaia_urls.h" 26 #include "google_apis/gaia/gaia_urls.h"
27 #include "grit/chromium_strings.h" 27 #include "grit/chromium_strings.h"
28 #include "grit/generated_resources.h" 28 #include "grit/generated_resources.h"
29 #include "ui/base/l10n/l10n_util.h" 29 #include "ui/base/l10n/l10n_util.h"
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 321
322 void GaiaScreenHandler::HandleGaiaUIReady() { 322 void GaiaScreenHandler::HandleGaiaUIReady() {
323 if (focus_stolen_) { 323 if (focus_stolen_) {
324 // Set focus to the Gaia page. 324 // Set focus to the Gaia page.
325 // TODO(altimofeev): temporary solution, until focus parameters are 325 // TODO(altimofeev): temporary solution, until focus parameters are
326 // implemented on the Gaia side. 326 // implemented on the Gaia side.
327 // Do this only once. Any subsequent call would relod GAIA frame. 327 // Do this only once. Any subsequent call would relod GAIA frame.
328 focus_stolen_ = false; 328 focus_stolen_ = false;
329 const char code[] = 329 const char code[] =
330 "if (typeof gWindowOnLoad != 'undefined') gWindowOnLoad();"; 330 "if (typeof gWindowOnLoad != 'undefined') gWindowOnLoad();";
331 content::RenderFrameHost* frame = 331 content::RenderFrameHost* frame = InlineLoginUI::GetGaiaAuthIframe(
332 LoginDisplayHostImpl::GetGaiaAuthIframe(web_ui()->GetWebContents()); 332 web_ui()->GetWebContents(), NULL, "signin-frame");
guohui 2014/07/22 22:07:58 @xiyuan, do we have a known parent frame URL here?
xiyuan 2014/07/22 23:19:12 It should be the same as kGaiaExtOrigin in InlineL
guohui 2014/07/23 16:05:25 Changed the name to "GetAuthIframe", since it coul
333 frame->ExecuteJavaScript(base::ASCIIToUTF16(code)); 333 frame->ExecuteJavaScript(base::ASCIIToUTF16(code));
334 } 334 }
335 if (gaia_silent_load_) { 335 if (gaia_silent_load_) {
336 focus_stolen_ = true; 336 focus_stolen_ = true;
337 // Prevent focus stealing by the Gaia page. 337 // Prevent focus stealing by the Gaia page.
338 // TODO(altimofeev): temporary solution, until focus parameters are 338 // TODO(altimofeev): temporary solution, until focus parameters are
339 // implemented on the Gaia side. 339 // implemented on the Gaia side.
340 const char code[] = 340 const char code[] =
341 "var gWindowOnLoad = window.onload; " 341 "var gWindowOnLoad = window.onload; "
342 "window.onload=function() {};"; 342 "window.onload=function() {};";
343 content::RenderFrameHost* frame = 343 content::RenderFrameHost* frame = InlineLoginUI::GetGaiaAuthIframe(
344 LoginDisplayHostImpl::GetGaiaAuthIframe(web_ui()->GetWebContents()); 344 web_ui()->GetWebContents(), NULL, "signin-frame");
345 frame->ExecuteJavaScript(base::ASCIIToUTF16(code)); 345 frame->ExecuteJavaScript(base::ASCIIToUTF16(code));
346 346
347 // As we could miss and window.onload could already be called, restore 347 // As we could miss and window.onload could already be called, restore
348 // focus to current pod (see crbug/175243). 348 // focus to current pod (see crbug/175243).
349 DCHECK(signin_screen_handler_); 349 DCHECK(signin_screen_handler_);
350 signin_screen_handler_->RefocusCurrentPod(); 350 signin_screen_handler_->RefocusCurrentPod();
351 } 351 }
352 HandleFrameLoadingCompleted(0); 352 HandleFrameLoadingCompleted(0);
353 353
354 if (test_expects_complete_login_) 354 if (test_expects_complete_login_)
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 } 423 }
424 424
425 void GaiaScreenHandler::SubmitLoginFormForTest() { 425 void GaiaScreenHandler::SubmitLoginFormForTest() {
426 VLOG(2) << "Submit login form for test, user=" << test_user_; 426 VLOG(2) << "Submit login form for test, user=" << test_user_;
427 427
428 std::string code; 428 std::string code;
429 code += "document.getElementById('Email').value = '" + test_user_ + "';"; 429 code += "document.getElementById('Email').value = '" + test_user_ + "';";
430 code += "document.getElementById('Passwd').value = '" + test_pass_ + "';"; 430 code += "document.getElementById('Passwd').value = '" + test_pass_ + "';";
431 code += "document.getElementById('signIn').click();"; 431 code += "document.getElementById('signIn').click();";
432 432
433 content::RenderFrameHost* frame = 433 content::RenderFrameHost* frame = InlineLoginUI::GetGaiaAuthIframe(
434 LoginDisplayHostImpl::GetGaiaAuthIframe(web_ui()->GetWebContents()); 434 web_ui()->GetWebContents(), NULL, "signin-frame");
435 frame->ExecuteJavaScript(base::ASCIIToUTF16(code)); 435 frame->ExecuteJavaScript(base::ASCIIToUTF16(code));
436 436
437 // Test properties are cleared in HandleCompleteLogin because the form 437 // Test properties are cleared in HandleCompleteLogin because the form
438 // submission might fail and login will not be attempted after reloading 438 // submission might fail and login will not be attempted after reloading
439 // if they are cleared here. 439 // if they are cleared here.
440 } 440 }
441 441
442 void GaiaScreenHandler::SetSAMLPrincipalsAPIUsed(bool api_used) { 442 void GaiaScreenHandler::SetSAMLPrincipalsAPIUsed(bool api_used) {
443 using_saml_api_ = api_used; 443 using_saml_api_ = api_used;
444 UMA_HISTOGRAM_BOOLEAN("ChromeOS.SAML.APIUsed", api_used); 444 UMA_HISTOGRAM_BOOLEAN("ChromeOS.SAML.APIUsed", api_used);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 538
539 SigninScreenHandlerDelegate* GaiaScreenHandler::Delegate() { 539 SigninScreenHandlerDelegate* GaiaScreenHandler::Delegate() {
540 DCHECK(signin_screen_handler_); 540 DCHECK(signin_screen_handler_);
541 return signin_screen_handler_->delegate_; 541 return signin_screen_handler_->delegate_;
542 } 542 }
543 543
544 void GaiaScreenHandler::SetSigninScreenHandler(SigninScreenHandler* handler) { 544 void GaiaScreenHandler::SetSigninScreenHandler(SigninScreenHandler* handler) {
545 signin_screen_handler_ = handler; 545 signin_screen_handler_ = handler;
546 } 546 }
547 } // namespace chromeos 547 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698