| 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_prompt.h" | 5 #include "chrome/browser/ui/login/login_prompt.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 TabAndroid* tab_android = TabAndroid::FromWebContents(web_contents); | 48 TabAndroid* tab_android = TabAndroid::FromWebContents(web_contents); |
| 49 | 49 |
| 50 // Notify TabAndroid that HTTP authentication is required for current page. | 50 // Notify TabAndroid that HTTP authentication is required for current page. |
| 51 if (tab_android) { | 51 if (tab_android) { |
| 52 chrome_http_auth_handler_.reset(new ChromeHttpAuthHandler(explanation)); | 52 chrome_http_auth_handler_.reset(new ChromeHttpAuthHandler(explanation)); |
| 53 chrome_http_auth_handler_->Init(); | 53 chrome_http_auth_handler_->Init(); |
| 54 chrome_http_auth_handler_->SetObserver(this); | 54 chrome_http_auth_handler_->SetObserver(this); |
| 55 | 55 |
| 56 tab_android->OnReceivedHttpAuthRequest( | 56 tab_android->OnReceivedHttpAuthRequest( |
| 57 chrome_http_auth_handler_.get()->GetJavaObject(), | 57 chrome_http_auth_handler_.get()->GetJavaObject(), |
| 58 ASCIIToUTF16(auth_info()->challenger.ToString()), | 58 base::ASCIIToUTF16(auth_info()->challenger.ToString()), |
| 59 UTF8ToUTF16(auth_info()->realm)); | 59 base::UTF8ToUTF16(auth_info()->realm)); |
| 60 | 60 |
| 61 // Register to receive a callback to OnAutofillDataAvailable(). | 61 // Register to receive a callback to OnAutofillDataAvailable(). |
| 62 SetModel(manager); | 62 SetModel(manager); |
| 63 NotifyAuthNeeded(); | 63 NotifyAuthNeeded(); |
| 64 } else { | 64 } else { |
| 65 CancelAuth(); | 65 CancelAuth(); |
| 66 LOG(WARNING) << "HTTP Authentication failed because TabAndroid is " | 66 LOG(WARNING) << "HTTP Authentication failed because TabAndroid is " |
| 67 "missing"; | 67 "missing"; |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 | 70 |
| 71 protected: | 71 protected: |
| 72 virtual ~LoginHandlerAndroid() {} | 72 virtual ~LoginHandlerAndroid() {} |
| 73 | 73 |
| 74 virtual void CloseDialog() OVERRIDE {} | 74 virtual void CloseDialog() OVERRIDE {} |
| 75 | 75 |
| 76 private: | 76 private: |
| 77 scoped_ptr<ChromeHttpAuthHandler> chrome_http_auth_handler_; | 77 scoped_ptr<ChromeHttpAuthHandler> chrome_http_auth_handler_; |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 // static | 80 // static |
| 81 LoginHandler* LoginHandler::Create(net::AuthChallengeInfo* auth_info, | 81 LoginHandler* LoginHandler::Create(net::AuthChallengeInfo* auth_info, |
| 82 net::URLRequest* request) { | 82 net::URLRequest* request) { |
| 83 return new LoginHandlerAndroid(auth_info, request); | 83 return new LoginHandlerAndroid(auth_info, request); |
| 84 } | 84 } |
| OLD | NEW |