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

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

Issue 1368863002: Set SSL info when an HTTP auth dialog is triggered by direct navigation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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_prompt.h" 5 #include "chrome/browser/ui/login/login_prompt.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"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/prefs/pref_service.h" 12 #include "base/prefs/pref_service.h"
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "base/synchronization/lock.h" 15 #include "base/synchronization/lock.h"
16 #include "chrome/browser/chrome_notification_types.h" 16 #include "chrome/browser/chrome_notification_types.h"
17 #include "chrome/browser/password_manager/chrome_password_manager_client.h" 17 #include "chrome/browser/password_manager/chrome_password_manager_client.h"
18 #include "chrome/browser/prerender/prerender_contents.h" 18 #include "chrome/browser/prerender/prerender_contents.h"
19 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/browser/tab_contents/tab_util.h" 20 #include "chrome/browser/tab_contents/tab_util.h"
21 #include "chrome/browser/ui/login/login_interstitial_delegate.h" 21 #include "chrome/browser/ui/login/login_interstitial_delegate.h"
22 #include "chrome/common/pref_names.h" 22 #include "chrome/common/pref_names.h"
23 #include "chrome/grit/generated_resources.h" 23 #include "chrome/grit/generated_resources.h"
24 #include "components/password_manager/content/browser/content_password_manager_d river.h" 24 #include "components/password_manager/content/browser/content_password_manager_d river.h"
25 #include "components/password_manager/core/browser/browser_save_password_progres s_logger.h" 25 #include "components/password_manager/core/browser/browser_save_password_progres s_logger.h"
26 #include "components/password_manager/core/browser/password_manager.h" 26 #include "components/password_manager/core/browser/password_manager.h"
27 #include "components/url_formatter/elide_url.h" 27 #include "components/url_formatter/elide_url.h"
28 #include "content/public/browser/browser_thread.h" 28 #include "content/public/browser/browser_thread.h"
29 #include "content/public/browser/navigation_entry.h"
29 #include "content/public/browser/notification_registrar.h" 30 #include "content/public/browser/notification_registrar.h"
30 #include "content/public/browser/notification_service.h" 31 #include "content/public/browser/notification_service.h"
31 #include "content/public/browser/render_frame_host.h" 32 #include "content/public/browser/render_frame_host.h"
32 #include "content/public/browser/resource_dispatcher_host.h" 33 #include "content/public/browser/resource_dispatcher_host.h"
33 #include "content/public/browser/resource_request_info.h" 34 #include "content/public/browser/resource_request_info.h"
34 #include "content/public/browser/web_contents.h" 35 #include "content/public/browser/web_contents.h"
36 #include "content/public/common/ssl_status.h"
37 #include "grit/generated_resources.h"
35 #include "net/base/auth.h" 38 #include "net/base/auth.h"
36 #include "net/base/load_flags.h" 39 #include "net/base/load_flags.h"
37 #include "net/base/net_util.h" 40 #include "net/base/net_util.h"
38 #include "net/http/http_transaction_factory.h" 41 #include "net/http/http_transaction_factory.h"
42 #include "net/ssl/ssl_info.h"
39 #include "net/url_request/url_request.h" 43 #include "net/url_request/url_request.h"
40 #include "net/url_request/url_request_context.h" 44 #include "net/url_request/url_request_context.h"
41 #include "ui/base/l10n/l10n_util.h" 45 #include "ui/base/l10n/l10n_util.h"
42 #include "ui/gfx/text_elider.h" 46 #include "ui/gfx/text_elider.h"
43 47
44 #if defined(ENABLE_EXTENSIONS) 48 #if defined(ENABLE_EXTENSIONS)
45 #include "components/guest_view/browser/guest_view_base.h" 49 #include "components/guest_view/browser/guest_view_base.h"
46 #endif 50 #endif
47 51
48 using autofill::PasswordForm; 52 using autofill::PasswordForm;
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 // closed, so that interstitial should only be a login interstitial. 578 // closed, so that interstitial should only be a login interstitial.
575 if (is_main_frame && (parent_contents->ShowingInterstitialPage() || 579 if (is_main_frame && (parent_contents->ShowingInterstitialPage() ||
576 parent_contents->GetLastCommittedURL().GetOrigin() != 580 parent_contents->GetLastCommittedURL().GetOrigin() !=
577 request_url.GetOrigin())) { 581 request_url.GetOrigin())) {
578 // Show a blank interstitial for main-frame, cross origin requests 582 // Show a blank interstitial for main-frame, cross origin requests
579 // so that the correct URL is shown in the omnibox. 583 // so that the correct URL is shown in the omnibox.
580 base::Closure callback = base::Bind(&ShowLoginPrompt, 584 base::Closure callback = base::Bind(&ShowLoginPrompt,
581 request_url, 585 request_url,
582 make_scoped_refptr(auth_info), 586 make_scoped_refptr(auth_info),
583 make_scoped_refptr(handler)); 587 make_scoped_refptr(handler));
588 content::NavigationEntry* pending_entry =
589 parent_contents->GetController().GetPendingEntry();
590 const content::SSLStatus& ssl_status = pending_entry->GetSSL();
meacer 2015/09/25 18:15:46 Charlie and I had a chat about why this using the
584 // This is owned by the interstitial it creates. It cancels any existing 591 // This is owned by the interstitial it creates. It cancels any existing
585 // interstitial. 592 // interstitial.
586 new LoginInterstitialDelegate(parent_contents, 593 new LoginInterstitialDelegate(parent_contents, request_url, ssl_status,
587 request_url,
588 callback); 594 callback);
589 } else { 595 } else {
590 ShowLoginPrompt(request_url, 596 ShowLoginPrompt(request_url,
591 auth_info, 597 auth_info,
592 handler); 598 handler);
593 } 599 }
594 } 600 }
595 601
596 // ---------------------------------------------------------------------------- 602 // ----------------------------------------------------------------------------
597 // Public API 603 // Public API
598 604
599 LoginHandler* CreateLoginPrompt(net::AuthChallengeInfo* auth_info, 605 LoginHandler* CreateLoginPrompt(net::AuthChallengeInfo* auth_info,
600 net::URLRequest* request) { 606 net::URLRequest* request) {
601 bool is_main_frame = (request->load_flags() & net::LOAD_MAIN_FRAME) != 0; 607 bool is_main_frame = (request->load_flags() & net::LOAD_MAIN_FRAME) != 0;
602 LoginHandler* handler = LoginHandler::Create(auth_info, request); 608 LoginHandler* handler = LoginHandler::Create(auth_info, request);
603 BrowserThread::PostTask( 609 BrowserThread::PostTask(
604 BrowserThread::UI, FROM_HERE, 610 BrowserThread::UI, FROM_HERE,
605 base::Bind(&LoginDialogCallback, request->url(), 611 base::Bind(&LoginDialogCallback, request->url(),
606 make_scoped_refptr(auth_info), make_scoped_refptr(handler), 612 make_scoped_refptr(auth_info), make_scoped_refptr(handler),
607 is_main_frame)); 613 is_main_frame));
608 return handler; 614 return handler;
609 } 615 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/login/login_prompt.h ('k') | chrome/browser/ui/login/login_prompt_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698