http_auth_handler_impl.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Copyright 2020 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. #ifndef WEBLAYER_BROWSER_HTTP_AUTH_HANDLER_IMPL_H_
  5. #define WEBLAYER_BROWSER_HTTP_AUTH_HANDLER_IMPL_H_
  6. #include "base/android/scoped_java_ref.h"
  7. #include "content/public/browser/content_browser_client.h"
  8. #include "content/public/browser/login_delegate.h"
  9. #include "url/gurl.h"
  10. namespace weblayer {
  11. // Implements support for http auth.
  12. class HttpAuthHandlerImpl : public content::LoginDelegate {
  13. public:
  14. HttpAuthHandlerImpl(const net::AuthChallengeInfo& auth_info,
  15. content::WebContents* web_contents,
  16. bool first_auth_attempt,
  17. LoginAuthRequiredCallback callback);
  18. ~HttpAuthHandlerImpl() override;
  19. void Proceed(JNIEnv* env,
  20. const base::android::JavaParamRef<jstring>& username,
  21. const base::android::JavaParamRef<jstring>& password);
  22. void Cancel(JNIEnv* env);
  23. private:
  24. void CloseDialog();
  25. GURL url_;
  26. LoginAuthRequiredCallback callback_;
  27. base::android::ScopedJavaGlobalRef<jobject> java_impl_;
  28. };
  29. } // namespace weblayer
  30. #endif // WEBLAYER_BROWSER_HTTP_AUTH_HANDLER_IMPL_H_