summaryrefslogtreecommitdiffstats
path: root/android_webview/browser/aw_login_delegate.h
blob: d4404ec55cbb20005b58eb8220c690174e7b80f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ANDROID_WEBVIEW_BROWSER_AW_LOGIN_DELEGATE_H_
#define ANDROID_WEBVIEW_BROWSER_AW_LOGIN_DELEGATE_H_

#include "android_webview/browser/aw_http_auth_handler_base.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/string16.h"
#include "content/public/browser/resource_dispatcher_host_login_delegate.h"

namespace net {
class AuthChallengeInfo;
class URLRequest;
}

namespace android_webview {

class AwLoginDelegate :
    public content::ResourceDispatcherHostLoginDelegate {
 public:
  AwLoginDelegate(net::AuthChallengeInfo* auth_info,
                  net::URLRequest* request);

  virtual void Proceed(const string16& user, const string16& password);
  virtual void Cancel();

  // from ResourceDispatcherHostLoginDelegate
  virtual void OnRequestCancelled() OVERRIDE;

 private:
  virtual ~AwLoginDelegate();
  void HandleHttpAuthRequestOnUIThread(bool first_auth_attempt);
  void CancelOnIOThread();
  void ProceedOnIOThread(const string16& user, const string16& password);
  void DeleteAuthHandlerSoon();

  scoped_ptr<AwHttpAuthHandlerBase> aw_http_auth_handler_;
  scoped_refptr<net::AuthChallengeInfo> auth_info_;
  net::URLRequest* request_;
  int render_process_id_;
  int render_view_id_;
};

}  // namespace android_webview

#endif  // ANDROID_WEBVIEW_BROWSER_AW_LOGIN_DELEGATE_H_