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

Side by Side Diff: components/bubble/bubble_delegate.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: Move DCHECK string into longer comment 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 unified diff | Download patch
« no previous file with comments | « components/bubble/bubble_controller.cc ('k') | components/bubble/bubble_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 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 COMPONENTS_BUBBLE_BUBBLE_DELEGATE_H_ 5 #ifndef COMPONENTS_BUBBLE_BUBBLE_DELEGATE_H_
6 #define COMPONENTS_BUBBLE_BUBBLE_DELEGATE_H_ 6 #define COMPONENTS_BUBBLE_BUBBLE_DELEGATE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "components/bubble/bubble_close_reason.h" 12 #include "components/bubble/bubble_close_reason.h"
13 13
14 class BubbleUi; 14 class BubbleUi;
15 15
16 namespace content {
17 class RenderFrameHost;
18 }
19
16 // Inherit from this class to define a bubble. A bubble is a small transient UI 20 // Inherit from this class to define a bubble. A bubble is a small transient UI
17 // surface anchored to a parent window. Most bubbles are dismissed when they 21 // surface anchored to a parent window. Most bubbles are dismissed when they
18 // lose focus. 22 // lose focus.
19 class BubbleDelegate { 23 class BubbleDelegate {
20 public: 24 public:
21 BubbleDelegate(); 25 BubbleDelegate();
22 virtual ~BubbleDelegate(); 26 virtual ~BubbleDelegate();
23 27
24 // Called by BubbleController to notify a bubble of an event that the bubble 28 // Called by BubbleController to notify a bubble of an event that the bubble
25 // might want to close on. Return true if the bubble should close for the 29 // might want to close on. Return true if the bubble should close for the
26 // specified reason. 30 // specified reason.
27 virtual bool ShouldClose(BubbleCloseReason reason) const; 31 virtual bool ShouldClose(BubbleCloseReason reason) const;
28 32
29 // Called by BubbleController to notify a bubble that it has closed. 33 // Called by BubbleController to notify a bubble that it has closed.
30 virtual void DidClose(); 34 virtual void DidClose();
31 35
32 // Called by BubbleController to build the UI that will represent this bubble. 36 // Called by BubbleController to build the UI that will represent this bubble.
33 // BubbleDelegate should not keep a reference to this newly created UI. 37 // BubbleDelegate should not keep a reference to this newly created UI.
34 virtual scoped_ptr<BubbleUi> BuildBubbleUi() = 0; 38 virtual scoped_ptr<BubbleUi> BuildBubbleUi() = 0;
35 39
36 // Called to update an existing UI. This is the same BubbleUi that was created 40 // Called to update an existing UI. This is the same BubbleUi that was created
37 // in |BuildBubbleUi|. 41 // in |BuildBubbleUi|.
38 // Return true to indicate the UI was updated. 42 // Return true to indicate the UI was updated.
39 virtual bool UpdateBubbleUi(BubbleUi* bubble_ui); 43 virtual bool UpdateBubbleUi(BubbleUi* bubble_ui);
40 44
41 // Used to identify a bubble for collecting metrics. 45 // Used to identify a bubble for collecting metrics.
42 virtual std::string GetName() const = 0; 46 virtual std::string GetName() const = 0;
43 47
48 // If this returns non-null, the bubble will be closed when the returned frame
49 // is destroyed.
50 virtual const content::RenderFrameHost* OwningFrame() const = 0;
51
44 private: 52 private:
45 DISALLOW_COPY_AND_ASSIGN(BubbleDelegate); 53 DISALLOW_COPY_AND_ASSIGN(BubbleDelegate);
46 }; 54 };
47 55
48 #endif // COMPONENTS_BUBBLE_BUBBLE_DELEGATE_H_ 56 #endif // COMPONENTS_BUBBLE_BUBBLE_DELEGATE_H_
OLDNEW
« no previous file with comments | « components/bubble/bubble_controller.cc ('k') | components/bubble/bubble_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698