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

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

Issue 2385533002: Replace usage of GURL(origin.Serialize()) with origin.GetURL() (Closed)
Patch Set: sync to #424762 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
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 23 matching lines...) Expand all
34 #include "content/public/common/origin_util.h" 34 #include "content/public/common/origin_util.h"
35 #include "net/base/auth.h" 35 #include "net/base/auth.h"
36 #include "net/base/host_port_pair.h" 36 #include "net/base/host_port_pair.h"
37 #include "net/base/load_flags.h" 37 #include "net/base/load_flags.h"
38 #include "net/http/http_auth_scheme.h" 38 #include "net/http/http_auth_scheme.h"
39 #include "net/http/http_transaction_factory.h" 39 #include "net/http/http_transaction_factory.h"
40 #include "net/url_request/url_request.h" 40 #include "net/url_request/url_request.h"
41 #include "net/url_request/url_request_context.h" 41 #include "net/url_request/url_request_context.h"
42 #include "ui/base/l10n/l10n_util.h" 42 #include "ui/base/l10n/l10n_util.h"
43 #include "ui/gfx/text_elider.h" 43 #include "ui/gfx/text_elider.h"
44 #include "url/origin.h"
44 45
45 #if defined(ENABLE_EXTENSIONS) 46 #if defined(ENABLE_EXTENSIONS)
46 #include "components/guest_view/browser/guest_view_base.h" 47 #include "components/guest_view/browser/guest_view_base.h"
47 #include "extensions/browser/view_type_utils.h" 48 #include "extensions/browser/view_type_utils.h"
48 #endif 49 #endif
49 50
50 using autofill::PasswordForm; 51 using autofill::PasswordForm;
51 using content::BrowserThread; 52 using content::BrowserThread;
52 using content::NavigationController; 53 using content::NavigationController;
53 using content::RenderViewHost; 54 using content::RenderViewHost;
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 443
443 // static 444 // static
444 std::string LoginHandler::GetSignonRealm( 445 std::string LoginHandler::GetSignonRealm(
445 const GURL& url, 446 const GURL& url,
446 const net::AuthChallengeInfo& auth_info) { 447 const net::AuthChallengeInfo& auth_info) {
447 std::string signon_realm; 448 std::string signon_realm;
448 if (auth_info.is_proxy) { 449 if (auth_info.is_proxy) {
449 // Historically we've been storing the signon realm for proxies using 450 // Historically we've been storing the signon realm for proxies using
450 // net::HostPortPair::ToString(). 451 // net::HostPortPair::ToString().
451 net::HostPortPair host_port_pair = 452 net::HostPortPair host_port_pair =
452 net::HostPortPair::FromURL(GURL(auth_info.challenger.Serialize())); 453 net::HostPortPair::FromURL(auth_info.challenger.GetURL());
453 signon_realm = host_port_pair.ToString(); 454 signon_realm = host_port_pair.ToString();
454 signon_realm.append("/"); 455 signon_realm.append("/");
455 } else { 456 } else {
456 // Take scheme, host, and port from the url. 457 // Take scheme, host, and port from the url.
457 signon_realm = url.GetOrigin().spec(); 458 signon_realm = url.GetOrigin().spec();
458 // This ends with a "/". 459 // This ends with a "/".
459 } 460 }
460 signon_realm.append(auth_info.realm); 461 signon_realm.append(auth_info.realm);
461 return signon_realm; 462 return signon_realm;
462 } 463 }
463 464
464 // static 465 // static
465 PasswordForm LoginHandler::MakeInputForPasswordManager( 466 PasswordForm LoginHandler::MakeInputForPasswordManager(
466 const GURL& request_url, 467 const GURL& request_url,
467 const net::AuthChallengeInfo& auth_info) { 468 const net::AuthChallengeInfo& auth_info) {
468 PasswordForm dialog_form; 469 PasswordForm dialog_form;
469 if (base::LowerCaseEqualsASCII(auth_info.scheme, net::kBasicAuthScheme)) { 470 if (base::LowerCaseEqualsASCII(auth_info.scheme, net::kBasicAuthScheme)) {
470 dialog_form.scheme = PasswordForm::SCHEME_BASIC; 471 dialog_form.scheme = PasswordForm::SCHEME_BASIC;
471 } else if (base::LowerCaseEqualsASCII(auth_info.scheme, 472 } else if (base::LowerCaseEqualsASCII(auth_info.scheme,
472 net::kDigestAuthScheme)) { 473 net::kDigestAuthScheme)) {
473 dialog_form.scheme = PasswordForm::SCHEME_DIGEST; 474 dialog_form.scheme = PasswordForm::SCHEME_DIGEST;
474 } else { 475 } else {
475 dialog_form.scheme = PasswordForm::SCHEME_OTHER; 476 dialog_form.scheme = PasswordForm::SCHEME_OTHER;
476 } 477 }
477 if (auth_info.is_proxy) { 478 if (auth_info.is_proxy) {
478 dialog_form.origin = GURL(auth_info.challenger.Serialize()); 479 dialog_form.origin = auth_info.challenger.GetURL();
479 } else if (!auth_info.challenger.IsSameOriginWith(url::Origin(request_url))) { 480 } else if (!auth_info.challenger.IsSameOriginWith(url::Origin(request_url))) {
480 dialog_form.origin = GURL(); 481 dialog_form.origin = GURL();
481 NOTREACHED(); // crbug.com/32718 482 NOTREACHED(); // crbug.com/32718
482 } else { 483 } else {
483 dialog_form.origin = GURL(auth_info.challenger.Serialize()); 484 dialog_form.origin = auth_info.challenger.GetURL();
484 } 485 }
485 dialog_form.signon_realm = GetSignonRealm(dialog_form.origin, auth_info); 486 dialog_form.signon_realm = GetSignonRealm(dialog_form.origin, auth_info);
486 return dialog_form; 487 return dialog_form;
487 } 488 }
488 489
489 // static 490 // static
490 void LoginHandler::GetDialogStrings(const GURL& request_url, 491 void LoginHandler::GetDialogStrings(const GURL& request_url,
491 const net::AuthChallengeInfo& auth_info, 492 const net::AuthChallengeInfo& auth_info,
492 base::string16* authority, 493 base::string16* authority,
493 base::string16* explanation) { 494 base::string16* explanation) {
494 GURL authority_url; 495 GURL authority_url;
495 496
496 if (auth_info.is_proxy) { 497 if (auth_info.is_proxy) {
497 *authority = l10n_util::GetStringFUTF16( 498 *authority = l10n_util::GetStringFUTF16(
498 IDS_LOGIN_DIALOG_PROXY_AUTHORITY, 499 IDS_LOGIN_DIALOG_PROXY_AUTHORITY,
499 url_formatter::FormatOriginForSecurityDisplay( 500 url_formatter::FormatOriginForSecurityDisplay(
500 auth_info.challenger, url_formatter::SchemeDisplay::SHOW)); 501 auth_info.challenger, url_formatter::SchemeDisplay::SHOW));
501 authority_url = GURL(auth_info.challenger.Serialize()); 502 authority_url = auth_info.challenger.GetURL();
502 } else { 503 } else {
503 *authority = l10n_util::GetStringFUTF16( 504 *authority = l10n_util::GetStringFUTF16(
504 IDS_LOGIN_DIALOG_AUTHORITY, 505 IDS_LOGIN_DIALOG_AUTHORITY,
505 url_formatter::FormatUrlForSecurityDisplay(request_url)); 506 url_formatter::FormatUrlForSecurityDisplay(request_url));
506 authority_url = request_url; 507 authority_url = request_url;
507 } 508 }
508 509
509 if (!content::IsOriginSecure(authority_url)) { 510 if (!content::IsOriginSecure(authority_url)) {
510 // TODO(asanka): The string should be different for proxies and servers. 511 // TODO(asanka): The string should be different for proxies and servers.
511 // http://crbug.com/620756 512 // http://crbug.com/620756
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 bool is_main_frame = 651 bool is_main_frame =
651 (request->load_flags() & net::LOAD_MAIN_FRAME_DEPRECATED) != 0; 652 (request->load_flags() & net::LOAD_MAIN_FRAME_DEPRECATED) != 0;
652 LoginHandler* handler = LoginHandler::Create(auth_info, request); 653 LoginHandler* handler = LoginHandler::Create(auth_info, request);
653 BrowserThread::PostTask( 654 BrowserThread::PostTask(
654 BrowserThread::UI, FROM_HERE, 655 BrowserThread::UI, FROM_HERE,
655 base::Bind(&LoginHandler::LoginDialogCallback, request->url(), 656 base::Bind(&LoginHandler::LoginDialogCallback, request->url(),
656 base::RetainedRef(auth_info), base::RetainedRef(handler), 657 base::RetainedRef(auth_info), base::RetainedRef(handler),
657 is_main_frame)); 658 is_main_frame));
658 return handler; 659 return handler;
659 } 660 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/android/bluetooth_chooser_android.cc ('k') | components/subresource_filter/core/common/indexed_ruleset.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698