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