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.
5 #ifndef XWALK_RUNTIME_BROWSER_ANDROID_XWALK_LOGIN_DELEGATE_H_
6 #define XWALK_RUNTIME_BROWSER_ANDROID_XWALK_LOGIN_DELEGATE_H_
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"
15 class AuthChallengeInfo;
21 class XWalkLoginDelegate
22 : public content::ResourceDispatcherHostLoginDelegate {
24 XWalkLoginDelegate(net::AuthChallengeInfo* auth_info,
25 net::URLRequest* request);
27 virtual void Proceed(const base::string16& user,
28 const base::string16& password);
29 virtual void Cancel();
31 // from ResourceDispatcherHostLoginDelegate
32 void OnRequestCancelled() override;
35 virtual ~XWalkLoginDelegate();
36 void HandleHttpAuthRequestOnUIThread(bool first_auth_attempt);
37 void CancelOnIOThread();
38 void ProceedOnIOThread(const base::string16& user,
39 const base::string16& password);
40 void DeleteAuthHandlerSoon();
42 scoped_ptr<XWalkHttpAuthHandlerBase> xwalk_http_auth_handler_;
43 scoped_refptr<net::AuthChallengeInfo> auth_info_;
44 net::URLRequest* request_;
45 int render_process_id_;
51 #endif // XWALK_RUNTIME_BROWSER_ANDROID_XWALK_LOGIN_DELEGATE_H_