| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 | |
| 13 #include "device/vr/features/features.h" | |
| 14 #if BUILDFLAG(ENABLE_VR) | |
| 15 #include "chrome/browser/android/vr_shell/vr_tab_helper.h" | |
| 16 #endif // BUILDFLAG(ENABLE_VR) | |
| 17 | |
| 18 #include "chrome/browser/ui/android/chrome_http_auth_handler.h" | 12 #include "chrome/browser/ui/android/chrome_http_auth_handler.h" |
| 19 #include "chrome/browser/ui/android/view_android_helper.h" | 13 #include "chrome/browser/ui/android/view_android_helper.h" |
| 14 #include "chrome/browser/vr/vr_tab_helper.h" |
| 20 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
| 21 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
| 22 #include "net/base/auth.h" | 17 #include "net/base/auth.h" |
| 23 #include "ui/android/view_android.h" | 18 #include "ui/android/view_android.h" |
| 24 #include "ui/android/window_android.h" | 19 #include "ui/android/window_android.h" |
| 25 | 20 |
| 26 using content::BrowserThread; | 21 using content::BrowserThread; |
| 27 using net::URLRequest; | 22 using net::URLRequest; |
| 28 using net::AuthChallengeInfo; | 23 using net::AuthChallengeInfo; |
| 29 | 24 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 49 const base::string16& explanation, | 44 const base::string16& explanation, |
| 50 LoginModelData* login_model_data) override { | 45 LoginModelData* login_model_data) override { |
| 51 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 46 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 52 | 47 |
| 53 // Get pointer to TabAndroid | 48 // Get pointer to TabAndroid |
| 54 content::WebContents* web_contents = GetWebContentsForLogin(); | 49 content::WebContents* web_contents = GetWebContentsForLogin(); |
| 55 CHECK(web_contents); | 50 CHECK(web_contents); |
| 56 ViewAndroidHelper* view_helper = ViewAndroidHelper::FromWebContents( | 51 ViewAndroidHelper* view_helper = ViewAndroidHelper::FromWebContents( |
| 57 web_contents); | 52 web_contents); |
| 58 | 53 |
| 59 #if BUILDFLAG(ENABLE_VR) | 54 if (vr::VrTabHelper::IsInVr(web_contents)) { |
| 60 if (vr_shell::VrTabHelper::IsInVr(web_contents)) { | |
| 61 CancelAuth(); | 55 CancelAuth(); |
| 62 return; | 56 return; |
| 63 } | 57 } |
| 64 #endif | |
| 65 | 58 |
| 66 // Notify WindowAndroid that HTTP authentication is required. | 59 // Notify WindowAndroid that HTTP authentication is required. |
| 67 if (view_helper->GetViewAndroid() && | 60 if (view_helper->GetViewAndroid() && |
| 68 view_helper->GetViewAndroid()->GetWindowAndroid()) { | 61 view_helper->GetViewAndroid()->GetWindowAndroid()) { |
| 69 chrome_http_auth_handler_.reset( | 62 chrome_http_auth_handler_.reset( |
| 70 new ChromeHttpAuthHandler(authority, explanation)); | 63 new ChromeHttpAuthHandler(authority, explanation)); |
| 71 chrome_http_auth_handler_->Init(); | 64 chrome_http_auth_handler_->Init(); |
| 72 chrome_http_auth_handler_->SetObserver(this); | 65 chrome_http_auth_handler_->SetObserver(this); |
| 73 chrome_http_auth_handler_->ShowDialog( | 66 chrome_http_auth_handler_->ShowDialog( |
| 74 view_helper->GetViewAndroid() | 67 view_helper->GetViewAndroid() |
| (...skipping 19 matching lines...) Expand all Loading... |
| 94 | 87 |
| 95 private: | 88 private: |
| 96 std::unique_ptr<ChromeHttpAuthHandler> chrome_http_auth_handler_; | 89 std::unique_ptr<ChromeHttpAuthHandler> chrome_http_auth_handler_; |
| 97 }; | 90 }; |
| 98 | 91 |
| 99 // static | 92 // static |
| 100 LoginHandler* LoginHandler::Create(net::AuthChallengeInfo* auth_info, | 93 LoginHandler* LoginHandler::Create(net::AuthChallengeInfo* auth_info, |
| 101 net::URLRequest* request) { | 94 net::URLRequest* request) { |
| 102 return new LoginHandlerAndroid(auth_info, request); | 95 return new LoginHandlerAndroid(auth_info, request); |
| 103 } | 96 } |
| OLD | NEW |