OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef ANDROID_WEBVIEW_NATIVE_AW_HTTP_AUTH_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_CONTROLLER_MANAGER_H _ |
6 #define ANDROID_WEBVIEW_NATIVE_AW_HTTP_AUTH_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_CONTROLLER_MANAGER_H _ |
7 | 7 |
8 #include <jni.h> | 8 #include "base/memory/scoped_ptr.h" |
9 #include <string> | 9 #include "chrome/browser/ui/exclusive_access/exclusive_access_bubble_type.h" |
10 | 10 |
11 #include "android_webview/browser/aw_login_delegate.h" | 11 class Browser; |
12 #include "android_webview/browser/aw_http_auth_handler_base.h" | 12 class BrowserWindow; |
13 #include "base/android/jni_android.h" | 13 class FullscreenController; |
14 #include "base/android/scoped_java_ref.h" | 14 class GURL; |
15 #include "base/memory/ref_counted.h" | 15 class MouseLockController; |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 class WebContents; | 18 class WebContents; |
19 } | |
20 | |
21 // This class coordiates different exclusive access controllers and updates | |
scheib
2015/01/14 22:37:59
Define "Exclusive access" as if you've just run in
Sriram
2015/01/15 00:34:28
Done.
| |
22 // exclusive access control bubble accordingly. | |
23 class ExclusiveAccessControllerManager { | |
scheib
2015/01/14 22:37:59
Maybe just ExclusiveAccessManager
Sriram
2015/01/15 00:34:28
Done.
| |
24 public: | |
25 explicit ExclusiveAccessControllerManager(Browser* browser); | |
26 ~ExclusiveAccessControllerManager(); | |
27 | |
28 FullscreenController* GetFullscreenController(); | |
29 MouseLockController* GetMouseLockController(); | |
30 | |
31 ExclusiveAccessBubbleType GetExclusiveAccessExitBubbleType() const; | |
32 void UpdateExclusiveAccessExitBubbleContent(); | |
33 | |
34 GURL GetExclusiveAccessBubbleURL() const; | |
35 // Callbacks //////////////////////////////////////////////////////////////// | |
36 | |
37 // Called by Browser::TabDeactivated. | |
38 void OnTabDeactivated(content::WebContents* web_contents); | |
39 | |
40 // Called by Browser::ActiveTabChanged. | |
41 void OnTabDetachedFromView(content::WebContents* web_contents); | |
42 | |
43 // Called by Browser::TabClosingAt. | |
44 void OnTabClosing(content::WebContents* web_contents); | |
45 | |
46 // Called by Browser::PreHandleKeyboardEvent | |
47 bool HandleUserPressedEscape(); | |
48 | |
49 // Called by platform ExclusiveAccessExitBubble. | |
50 void OnAcceptExclusiveAccessPermission(); | |
51 void OnDenyExclusiveAccessPermission(); | |
52 | |
53 private: | |
54 Browser* browser_; | |
55 BrowserWindow* window_; | |
56 scoped_ptr<FullscreenController> fullscreen_controller_; | |
57 scoped_ptr<MouseLockController> mouse_lock_controller_; | |
58 | |
59 DISALLOW_COPY_AND_ASSIGN(ExclusiveAccessControllerManager); | |
19 }; | 60 }; |
20 | 61 |
21 namespace net { | 62 #endif // CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_CONTROLLER_MANAGE R_H_ |
22 class AuthChallengeInfo; | |
23 }; | |
24 | |
25 namespace android_webview { | |
26 | |
27 // Native class for Java class of same name and owns an instance | |
28 // of that Java object. | |
29 // One instance of this class is created per underlying AwLoginDelegate. | |
30 class AwHttpAuthHandler : public AwHttpAuthHandlerBase { | |
31 public: | |
32 AwHttpAuthHandler(AwLoginDelegate* login_delegate, | |
33 net::AuthChallengeInfo* auth_info, | |
34 bool first_auth_attempt); | |
35 virtual ~AwHttpAuthHandler(); | |
36 | |
37 // from AwHttpAuthHandler | |
38 virtual bool HandleOnUIThread(content::WebContents* web_contents) override; | |
39 | |
40 void Proceed(JNIEnv* env, jobject obj, jstring username, jstring password); | |
41 void Cancel(JNIEnv* env, jobject obj); | |
42 | |
43 private: | |
44 scoped_refptr<AwLoginDelegate> login_delegate_; | |
45 base::android::ScopedJavaGlobalRef<jobject> http_auth_handler_; | |
46 std::string host_; | |
47 std::string realm_; | |
48 }; | |
49 | |
50 bool RegisterAwHttpAuthHandler(JNIEnv* env); | |
51 | |
52 } // namespace android_webview | |
53 | |
54 #endif // ANDROID_WEBVIEW_NATIVE_AW_HTTP_AUTH_HANDLER_H_ | |
OLD | NEW |