| OLD | NEW |
| 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 14 matching lines...) Expand all Loading... |
| 25 #include "components/strings/grit/components_strings.h" | 25 #include "components/strings/grit/components_strings.h" |
| 26 #include "components/url_formatter/elide_url.h" | 26 #include "components/url_formatter/elide_url.h" |
| 27 #include "content/public/browser/browser_thread.h" | 27 #include "content/public/browser/browser_thread.h" |
| 28 #include "content/public/browser/notification_registrar.h" | 28 #include "content/public/browser/notification_registrar.h" |
| 29 #include "content/public/browser/notification_service.h" | 29 #include "content/public/browser/notification_service.h" |
| 30 #include "content/public/browser/render_frame_host.h" | 30 #include "content/public/browser/render_frame_host.h" |
| 31 #include "content/public/browser/resource_dispatcher_host.h" | 31 #include "content/public/browser/resource_dispatcher_host.h" |
| 32 #include "content/public/browser/resource_request_info.h" | 32 #include "content/public/browser/resource_request_info.h" |
| 33 #include "content/public/browser/web_contents.h" | 33 #include "content/public/browser/web_contents.h" |
| 34 #include "content/public/common/origin_util.h" | 34 #include "content/public/common/origin_util.h" |
| 35 #include "extensions/features/features.h" |
| 35 #include "net/base/auth.h" | 36 #include "net/base/auth.h" |
| 36 #include "net/base/host_port_pair.h" | 37 #include "net/base/host_port_pair.h" |
| 37 #include "net/base/load_flags.h" | 38 #include "net/base/load_flags.h" |
| 38 #include "net/http/http_auth_scheme.h" | 39 #include "net/http/http_auth_scheme.h" |
| 39 #include "net/http/http_transaction_factory.h" | 40 #include "net/http/http_transaction_factory.h" |
| 40 #include "net/url_request/url_request.h" | 41 #include "net/url_request/url_request.h" |
| 41 #include "net/url_request/url_request_context.h" | 42 #include "net/url_request/url_request_context.h" |
| 42 #include "ui/base/l10n/l10n_util.h" | 43 #include "ui/base/l10n/l10n_util.h" |
| 43 #include "ui/gfx/text_elider.h" | 44 #include "ui/gfx/text_elider.h" |
| 44 #include "url/origin.h" | 45 #include "url/origin.h" |
| 45 | 46 |
| 46 #if defined(ENABLE_EXTENSIONS) | 47 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 47 #include "components/guest_view/browser/guest_view_base.h" | 48 #include "components/guest_view/browser/guest_view_base.h" |
| 48 #include "extensions/browser/view_type_utils.h" | 49 #include "extensions/browser/view_type_utils.h" |
| 49 #endif | 50 #endif |
| 50 | 51 |
| 51 #if !defined(OS_ANDROID) | 52 #if !defined(OS_ANDROID) |
| 52 #include "chrome/browser/ui/blocked_content/app_modal_dialog_helper.h" | 53 #include "chrome/browser/ui/blocked_content/app_modal_dialog_helper.h" |
| 53 #endif | 54 #endif |
| 54 | 55 |
| 55 using autofill::PasswordForm; | 56 using autofill::PasswordForm; |
| 56 using content::BrowserThread; | 57 using content::BrowserThread; |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 } | 542 } |
| 542 | 543 |
| 543 base::string16 authority; | 544 base::string16 authority; |
| 544 base::string16 explanation; | 545 base::string16 explanation; |
| 545 GetDialogStrings(request_url, *auth_info, &authority, &explanation); | 546 GetDialogStrings(request_url, *auth_info, &authority, &explanation); |
| 546 | 547 |
| 547 password_manager::PasswordManager* password_manager = | 548 password_manager::PasswordManager* password_manager = |
| 548 handler->GetPasswordManagerForLogin(); | 549 handler->GetPasswordManagerForLogin(); |
| 549 | 550 |
| 550 if (!password_manager) { | 551 if (!password_manager) { |
| 551 #if defined(ENABLE_EXTENSIONS) | 552 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 552 // A WebContents in a <webview> (a GuestView type) does not have a password | 553 // A WebContents in a <webview> (a GuestView type) does not have a password |
| 553 // manager, but still needs to be able to show login prompts. | 554 // manager, but still needs to be able to show login prompts. |
| 554 const auto* guest = | 555 const auto* guest = |
| 555 guest_view::GuestViewBase::FromWebContents(parent_contents); | 556 guest_view::GuestViewBase::FromWebContents(parent_contents); |
| 556 if (guest && | 557 if (guest && |
| 557 extensions::GetViewType(guest->owner_web_contents()) != | 558 extensions::GetViewType(guest->owner_web_contents()) != |
| 558 extensions::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) { | 559 extensions::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) { |
| 559 handler->BuildViewWithoutPasswordManager(authority, explanation); | 560 handler->BuildViewWithoutPasswordManager(authority, explanation); |
| 560 return; | 561 return; |
| 561 } | 562 } |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 bool is_main_frame = | 660 bool is_main_frame = |
| 660 (request->load_flags() & net::LOAD_MAIN_FRAME_DEPRECATED) != 0; | 661 (request->load_flags() & net::LOAD_MAIN_FRAME_DEPRECATED) != 0; |
| 661 LoginHandler* handler = LoginHandler::Create(auth_info, request); | 662 LoginHandler* handler = LoginHandler::Create(auth_info, request); |
| 662 BrowserThread::PostTask( | 663 BrowserThread::PostTask( |
| 663 BrowserThread::UI, FROM_HERE, | 664 BrowserThread::UI, FROM_HERE, |
| 664 base::Bind(&LoginHandler::LoginDialogCallback, request->url(), | 665 base::Bind(&LoginHandler::LoginDialogCallback, request->url(), |
| 665 base::RetainedRef(auth_info), base::RetainedRef(handler), | 666 base::RetainedRef(auth_info), base::RetainedRef(handler), |
| 666 is_main_frame)); | 667 is_main_frame)); |
| 667 return handler; | 668 return handler; |
| 668 } | 669 } |
| OLD | NEW |