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

Side by Side Diff: chrome/browser/ui/login/login_handler.cc

Issue 2392243002: Simplify origin logic in login_handler (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/login/login_handler.h" 5 #include "chrome/browser/ui/login/login_handler.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 const net::AuthChallengeInfo& auth_info) { 468 const net::AuthChallengeInfo& auth_info) {
469 PasswordForm dialog_form; 469 PasswordForm dialog_form;
470 if (base::LowerCaseEqualsASCII(auth_info.scheme, net::kBasicAuthScheme)) { 470 if (base::LowerCaseEqualsASCII(auth_info.scheme, net::kBasicAuthScheme)) {
471 dialog_form.scheme = PasswordForm::SCHEME_BASIC; 471 dialog_form.scheme = PasswordForm::SCHEME_BASIC;
472 } else if (base::LowerCaseEqualsASCII(auth_info.scheme, 472 } else if (base::LowerCaseEqualsASCII(auth_info.scheme,
473 net::kDigestAuthScheme)) { 473 net::kDigestAuthScheme)) {
474 dialog_form.scheme = PasswordForm::SCHEME_DIGEST; 474 dialog_form.scheme = PasswordForm::SCHEME_DIGEST;
475 } else { 475 } else {
476 dialog_form.scheme = PasswordForm::SCHEME_OTHER; 476 dialog_form.scheme = PasswordForm::SCHEME_OTHER;
477 } 477 }
478 if (auth_info.is_proxy) { 478 dialog_form.origin = auth_info.challenger.GetURL();
479 dialog_form.origin = auth_info.challenger.GetURL(); 479 DCHECK(auth_info.is_proxy ||
480 } else if (!auth_info.challenger.IsSameOriginWith(url::Origin(request_url))) { 480 auth_info.challenger.IsSameOriginWith(url::Origin(request_url)));
481 dialog_form.origin = GURL();
482 NOTREACHED(); // crbug.com/32718
483 } else {
484 dialog_form.origin = auth_info.challenger.GetURL();
485 }
486 dialog_form.signon_realm = GetSignonRealm(dialog_form.origin, auth_info); 481 dialog_form.signon_realm = GetSignonRealm(dialog_form.origin, auth_info);
487 return dialog_form; 482 return dialog_form;
488 } 483 }
489 484
490 // static 485 // static
491 void LoginHandler::GetDialogStrings(const GURL& request_url, 486 void LoginHandler::GetDialogStrings(const GURL& request_url,
492 const net::AuthChallengeInfo& auth_info, 487 const net::AuthChallengeInfo& auth_info,
493 base::string16* authority, 488 base::string16* authority,
494 base::string16* explanation) { 489 base::string16* explanation) {
495 GURL authority_url; 490 GURL authority_url;
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 bool is_main_frame = 646 bool is_main_frame =
652 (request->load_flags() & net::LOAD_MAIN_FRAME_DEPRECATED) != 0; 647 (request->load_flags() & net::LOAD_MAIN_FRAME_DEPRECATED) != 0;
653 LoginHandler* handler = LoginHandler::Create(auth_info, request); 648 LoginHandler* handler = LoginHandler::Create(auth_info, request);
654 BrowserThread::PostTask( 649 BrowserThread::PostTask(
655 BrowserThread::UI, FROM_HERE, 650 BrowserThread::UI, FROM_HERE,
656 base::Bind(&LoginHandler::LoginDialogCallback, request->url(), 651 base::Bind(&LoginHandler::LoginDialogCallback, request->url(),
657 base::RetainedRef(auth_info), base::RetainedRef(handler), 652 base::RetainedRef(auth_info), base::RetainedRef(handler),
658 is_main_frame)); 653 is_main_frame));
659 return handler; 654 return handler;
660 } 655 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698