Index: chrome/browser/ui/website_settings/permission_bubble_manager.h |
diff --git a/chrome/browser/ui/website_settings/permission_bubble_manager.h b/chrome/browser/ui/website_settings/permission_bubble_manager.h |
index 1c624b66f09a130df079e6db52d8a8e68d2960e0..37e8b88ec633ff0e0ce6ae0cf475602a645e7a90 100644 |
--- a/chrome/browser/ui/website_settings/permission_bubble_manager.h |
+++ b/chrome/browser/ui/website_settings/permission_bubble_manager.h |
@@ -8,6 +8,7 @@ |
#include <vector> |
#include "base/memory/weak_ptr.h" |
+#include "base/observer_list.h" |
msw
2015/06/05 01:52:00
Remove this
felt
2015/06/05 06:37:29
Done.
|
#include "chrome/browser/ui/website_settings/permission_bubble_view.h" |
#include "content/public/browser/web_contents_observer.h" |
#include "content/public/browser/web_contents_user_data.h" |
@@ -30,6 +31,12 @@ class PermissionBubbleManager |
public content::WebContentsUserData<PermissionBubbleManager>, |
public PermissionBubbleView::Delegate { |
public: |
+ class Observer { |
msw
2015/06/05 01:52:00
Remove this.
felt
2015/06/05 06:37:29
Done.
|
+ public: |
+ virtual ~Observer(); |
+ virtual void OnBubbleAdded(); |
+ }; |
+ |
// Return the enabled state of permissions bubbles. |
// Controlled by a flag and FieldTrial. |
static bool Enabled(); |
@@ -72,6 +79,14 @@ class PermissionBubbleManager |
friend class PermissionBubbleManagerTest; |
friend class PermissionContextBaseTests; |
friend class content::WebContentsUserData<PermissionBubbleManager>; |
+ friend class PushMessagingBrowserTest; |
msw
2015/06/05 01:52:00
Avoid friending by making the test setter public.
felt
2015/06/05 06:37:29
This makes me a little anxious... but I guess my c
|
+ |
+ enum AutoResponseType { |
+ NOT_TESTING, |
msw
2015/06/05 01:52:00
nit: maybe rename |NONE| (tests might want to clea
felt
2015/06/05 06:37:29
Done.
|
+ ACCEPT_ALL, |
+ DENY_ALL, |
+ DISMISS |
+ }; |
explicit PermissionBubbleManager(content::WebContents* web_contents); |
@@ -119,6 +134,13 @@ class PermissionBubbleManager |
bool HasUserGestureRequest( |
const std::vector<PermissionBubbleRequest*>& queue); |
+ // Do NOT use these methods in production code. Use these methods in browser |
+ // tests that need to accept or deny permissions when requested in |
+ // JavaScript. Your test needs to set set_auto_response_for_testing_only_ |
+ // and then the bubble will proceed as desired as soon as Show() is called. |
+ void set_auto_response_for_testing_only_(AutoResponseType response); |
msw
2015/06/05 01:52:00
Name this |set_auto_response_for_test|.
felt
2015/06/05 06:37:29
Done.
|
+ void DoAutoResponseForTesting(); |
+ |
// Whether to delay displaying the bubble until a request with a user gesture. |
// False by default, unless RequireUserGesture(bool) changes the value. |
bool require_user_gesture_; |
@@ -140,6 +162,8 @@ class PermissionBubbleManager |
std::vector<bool> accept_states_; |
+ AutoResponseType auto_response_for_testing_only_; |
msw
2015/06/05 01:52:00
Name this |auto_response_for_test_|
felt
2015/06/05 06:37:29
Done.
|
+ |
base::WeakPtrFactory<PermissionBubbleManager> weak_factory_; |
}; |