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 |
new file mode 100644 |
index 0000000000000000000000000000000000000000..21b1c70efb7e6dfce32db27c79978b61887949a6 |
--- /dev/null |
+++ b/chrome/browser/ui/website_settings/permission_bubble_manager.h |
@@ -0,0 +1,50 @@ |
+// Copyright (c) 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_MANAGER_H_ |
+#define CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_MANAGER_H_ |
+ |
+#include "content/public/browser/web_contents_observer.h" |
+#include "content/public/browser/web_contents_user_data.h" |
+ |
+class PermissionBubbleDelegate; |
+ |
+// Provides access to permissions bubbles. Allows clients to add a delegate |
+// callback interface to the existing permission bubble configuration. |
+// Depending on the situation and policy, that may add new UI to an existing |
+// permission bubble, create and show a new permission bubble, or provide no |
+// visible UI action at all. (In that case, the delegate will be immediately |
+// informed that the permission request failed.) |
+// |
+// A PermissionBubbleManager is associated with a particular WebContents. |
+// Delegates attached to a particular WebContents' PBM should arrange to outlive |
+// the associated WebContents. |
groby-ooo-7-16
2014/01/07 00:31:17
Why should permission requests outlive their WebCo
Greg Billock
2014/01/07 17:59:15
I botched this. I mean the "WebContents' PBM" but
groby-ooo-7-16
2014/01/07 19:44:57
Since the requests are managed by the PBM, I'm not
Greg Billock
2014/01/07 20:31:19
Take this case: tab 1 requests a permission. User
groby-ooo-7-16
2014/01/07 22:28:41
PBM is in the scope of tab1, no? It's tied to WebC
|
+// |
+// The PermissionBubbleManager should be addressed on the UI thread. |
+class PermissionBubbleManager |
+ : public content::WebContentsObserver, |
+ public content::WebContentsUserData<PermissionBubbleManager> { |
+ public: |
+ // Add a new consumer delegate to the permission bubble. Ownership of the |
+ // delegate remains with the caller. The caller must arrange for the delegate |
+ // to outlive the PermissionBubbleManager. |
groby-ooo-7-16
2014/01/07 00:31:17
Why? What is the benefit for the caller to keep ow
Greg Billock
2014/01/07 17:59:15
We need some sort of pathway to get back to them.
groby-ooo-7-16
2014/01/07 19:44:57
Why do we need to get back to them? What is the us
Greg Billock
2014/01/07 20:31:19
The "user allowed your permission request" use cas
groby-ooo-7-16
2014/01/07 22:28:41
But the caller doesn't need the object for the pat
|
+ virtual void AddPermissionBubbleDelegate(PermissionBubbleDelegate* delegate); |
groby-ooo-7-16
2014/01/07 00:31:17
This is requesting a permission - adding the deleg
Greg Billock
2014/01/07 17:59:15
Yeah, I toyed with a couple more focused names, bu
groby-ooo-7-16
2014/01/07 19:44:57
Let's not bikeshed on it right now (mostly because
Greg Billock
2014/01/07 20:31:19
I think you may have a different idea of the scope
groby-ooo-7-16
2014/01/07 22:28:41
I think my idea of the scope of the _delegate_ is
|
+ |
+ // Remove a consumer delegate from the permission bubble. |
groby-ooo-7-16
2014/01/07 00:31:17
In which case would this happen?
Greg Billock
2014/01/07 17:59:15
Not sure, but if history is any guide, it's sure t
groby-ooo-7-16
2014/01/07 19:44:57
Well, let's add it when it is :) (More lifecycle -
Greg Billock
2014/01/07 20:31:19
Sure, but then retraction becomes awkward, and you
groby-ooo-7-16
2014/01/07 22:28:41
But that means that this is handled individually b
|
+ virtual void RemovePermissionBubbleDelegate( |
+ PermissionBubbleDelegate* delegate); |
+ |
+ private: |
+ friend class content::WebContentsUserData<PermissionBubbleManager>; |
+ |
+ explicit PermissionBubbleManager(content::WebContents* web_contents); |
+ |
+ // contents::WebContentsObserver: |
+ virtual void WebContentsDestroyed( |
+ content::WebContents* web_contents) OVERRIDE; |
+ |
+ std::vector<PermissionBubbleDelegate*> delegates_; |
+}; |
+ |
+#endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_MANAGER_H_ |