018f5dcdd5e5d82126b6b0338ae469bc98db0cdd
[platform/framework/web/crosswalk.git] / src / xwalk / runtime / browser / android / xwalk_login_delegate.h
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 XWALK_RUNTIME_BROWSER_ANDROID_XWALK_LOGIN_DELEGATE_H_
6 #define XWALK_RUNTIME_BROWSER_ANDROID_XWALK_LOGIN_DELEGATE_H_
7
8 #include "xwalk/runtime/browser/android/xwalk_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 "content/public/browser/resource_dispatcher_host_login_delegate.h"
13
14 namespace net {
15 class AuthChallengeInfo;
16 class URLRequest;
17 }
18
19 namespace xwalk {
20
21 class XWalkLoginDelegate
22     : public content::ResourceDispatcherHostLoginDelegate {
23  public:
24   XWalkLoginDelegate(net::AuthChallengeInfo* auth_info,
25                      net::URLRequest* request);
26
27   virtual void Proceed(const base::string16& user, const base::string16& password);
28   virtual void Cancel();
29
30   // from ResourceDispatcherHostLoginDelegate
31   virtual void OnRequestCancelled() OVERRIDE;
32
33  private:
34   virtual ~XWalkLoginDelegate();
35   void HandleHttpAuthRequestOnUIThread(bool first_auth_attempt);
36   void CancelOnIOThread();
37   void ProceedOnIOThread(const base::string16& user, const base::string16& password);
38   void DeleteAuthHandlerSoon();
39
40   scoped_ptr<XWalkHttpAuthHandlerBase> xwalk_http_auth_handler_;
41   scoped_refptr<net::AuthChallengeInfo> auth_info_;
42   net::URLRequest* request_;
43   int render_process_id_;
44   int render_view_id_;
45 };
46
47 }  // namespace xwalk
48
49 #endif  // XWALK_RUNTIME_BROWSER_ANDROID_XWALK_LOGIN_DELEGATE_H_