Home | History | Annotate | Download | only in browser
      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
      3 // found in the LICENSE file.
      4 
      5 #ifndef ANDROID_WEBVIEW_BROWSER_AW_LOGIN_DELEGATE_H_
      6 #define ANDROID_WEBVIEW_BROWSER_AW_LOGIN_DELEGATE_H_
      7 
      8 #include "android_webview/browser/aw_http_auth_handler_base.h"
      9 #include "base/memory/ref_counted.h"
     10 #include "base/memory/scoped_ptr.h"
     11 #include "base/strings/string16.h"
     12 #include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler.h"
     13 #include "content/public/browser/resource_dispatcher_host_login_delegate.h"
     14 
     15 namespace net {
     16 class AuthChallengeInfo;
     17 class URLRequest;
     18 }
     19 
     20 using data_reduction_proxy::DataReductionProxyAuthRequestHandler;
     21 
     22 namespace android_webview {
     23 
     24 class AwLoginDelegate :
     25     public content::ResourceDispatcherHostLoginDelegate {
     26  public:
     27   AwLoginDelegate(net::AuthChallengeInfo* auth_info,
     28                   net::URLRequest* request);
     29 
     30   virtual void Proceed(const base::string16& user,
     31                        const base::string16& password);
     32   virtual void Cancel();
     33 
     34   // from ResourceDispatcherHostLoginDelegate
     35   virtual void OnRequestCancelled() OVERRIDE;
     36 
     37  private:
     38   virtual ~AwLoginDelegate();
     39   void HandleHttpAuthRequestOnUIThread(bool first_auth_attempt);
     40   void CancelOnIOThread();
     41   void ProceedOnIOThread(const base::string16& user,
     42                          const base::string16& password);
     43   void DeleteAuthHandlerSoon();
     44 
     45   scoped_ptr<AwHttpAuthHandlerBase> aw_http_auth_handler_;
     46   scoped_refptr<net::AuthChallengeInfo> auth_info_;
     47   net::URLRequest* request_;
     48   int render_process_id_;
     49   int render_frame_id_;
     50   scoped_ptr<DataReductionProxyAuthRequestHandler> drp_auth_handler_;
     51 };
     52 
     53 }  // namespace android_webview
     54 
     55 #endif  // ANDROID_WEBVIEW_BROWSER_AW_LOGIN_DELEGATE_H_
     56