OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2014 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 | |
5 #ifndef CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_MANAGER_H_ | |
6 #define CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_MANAGER_H_ | |
7 | |
8 #include "content/public/browser/web_contents_observer.h" | |
9 #include "content/public/browser/web_contents_user_data.h" | |
10 | |
11 class PermissionBubbleDelegate; | |
12 | |
13 // Provides access to permissions bubbles. Allows clients to add a delegate | |
14 // callback interface to the existing permission bubble configuration. | |
15 // Depending on the situation and policy, that may add new UI to an existing | |
16 // permission bubble, create and show a new permission bubble, or provide no | |
17 // visible UI action at all. (In that case, the delegate will be immediately | |
18 // informed that the permission request failed.) | |
19 // | |
20 // A PermissionBubbleManager is associated with a particular WebContents. | |
21 // Delegates attached to a particular WebContents' PBM should arrange to outlive | |
22 // 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
| |
23 // | |
24 // The PermissionBubbleManager should be addressed on the UI thread. | |
25 class PermissionBubbleManager | |
26 : public content::WebContentsObserver, | |
27 public content::WebContentsUserData<PermissionBubbleManager> { | |
28 public: | |
29 // Add a new consumer delegate to the permission bubble. Ownership of the | |
30 // delegate remains with the caller. The caller must arrange for the delegate | |
31 // 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
| |
32 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
| |
33 | |
34 // 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
| |
35 virtual void RemovePermissionBubbleDelegate( | |
36 PermissionBubbleDelegate* delegate); | |
37 | |
38 private: | |
39 friend class content::WebContentsUserData<PermissionBubbleManager>; | |
40 | |
41 explicit PermissionBubbleManager(content::WebContents* web_contents); | |
42 | |
43 // contents::WebContentsObserver: | |
44 virtual void WebContentsDestroyed( | |
45 content::WebContents* web_contents) OVERRIDE; | |
46 | |
47 std::vector<PermissionBubbleDelegate*> delegates_; | |
48 }; | |
49 | |
50 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_MANAGER_H_ | |
OLD | NEW |