Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Unified Diff: components/bubble/bubble_manager.h

Issue 1572743002: Make sure bubbles in Views default to close before their RenderFrameHosts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: Add a test and only allow one filter in CloseAllMatchingBubbles. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/bubble/bubble_manager.h
diff --git a/components/bubble/bubble_manager.h b/components/bubble/bubble_manager.h
index 3e2d838f8902dc708ad4482302665377f02fe069..5182381ec6d9c93d08f19605a4a0cbd5d63933cf 100644
--- a/components/bubble/bubble_manager.h
+++ b/components/bubble/bubble_manager.h
@@ -15,6 +15,10 @@
class BubbleDelegate;
+namespace content {
+class RenderFrameHost;
+}
+
// Inherit from BubbleManager to show, update, and close bubbles.
// Any class that inherits from BubbleManager should capture any events that
// should dismiss a bubble or update its anchor point.
@@ -69,6 +73,10 @@ class BubbleManager {
// Will close any open bubbles and prevent new ones from being shown.
void FinalizePendingRequests();
+ // Closes bubbles that declare |frame| as their owner, with
+ // a reason of BUBBLE_CLOSE_FRAME_DESTROYED.
+ void CloseBubblesOwnedBy(const content::RenderFrameHost* frame);
+
private:
enum ManagerState {
SHOW_BUBBLES,
@@ -76,10 +84,12 @@ class BubbleManager {
ITERATING_BUBBLES,
};
- // All bubbles will get a close event for the specified |reason| if |match| is
- // nullptr, otherwise only the bubble held by |match| will get a close event.
- // Any bubble that is closed will also be deleted.
- bool CloseAllMatchingBubbles(BubbleController* match,
+ // All matching bubbles will get a close event for the specified |reason|. Any
+ // bubble that is closed will also be deleted. Bubbles match if 1) |bubble| is
+ // null or it refers to the bubble, and 2) |owner| is null or owns the bubble.
+ // At most one can be non-null.
+ bool CloseAllMatchingBubbles(BubbleController* bubble,
+ const content::RenderFrameHost* owner,
BubbleCloseReason reason);
base::ObserverList<BubbleManagerObserver> observers_;

Powered by Google App Engine
This is Rietveld 408576698