Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_BUBBLE_BUBBLE_DELEGATE_H_ | |
| 6 #define COMPONENTS_BUBBLE_BUBBLE_DELEGATE_H_ | |
| 7 | |
| 8 #include "base/memory/scoped_ptr.h" | |
| 9 | |
| 10 class BubbleUI; | |
| 11 | |
| 12 // List of reasons why a bubble might close. These correspond to various events | |
| 13 // from the UI. Not all platforms will receive all events. | |
| 14 enum BubbleCloseReason { | |
|
msw
2015/08/21 01:48:30
nit: maybe this belongs in its own file (that woul
hcarmona
2015/08/25 02:13:36
Done.
| |
| 15 // Bubble was closed without any user interaction. | |
| 16 BUBBLE_CLOSE_FOCUS_LOST, | |
| 17 | |
| 18 // User did not interact with the bubble, but changed tab. | |
| 19 BUBBLE_CLOSE_TABSWITCHED, | |
| 20 | |
| 21 // User did not interact with the bubble, but detached the tab. | |
| 22 BUBBLE_CLOSE_TABDETACHED, | |
| 23 | |
| 24 // User dismissed the bubble. (ESC, close, etc.) | |
| 25 BUBBLE_CLOSE_USER_DISMISSED, | |
| 26 | |
| 27 // There has been a navigation event. (Link, URL typed, refresh, etc.) | |
| 28 BUBBLE_CLOSE_NAVIGATED, | |
| 29 | |
| 30 // Window has entered fullscreen mode. Will also be called for immersive | |
|
msw
2015/08/21 01:48:30
nit: The parent window has entered or exited
hcarmona
2015/08/25 02:13:37
Done.
| |
| 31 // fullscreen. | |
| 32 BUBBLE_CLOSE_FULLSCREEN_TOGGLED, | |
|
msw
2015/08/21 01:48:30
I wonder if this should be used for other anchor w
hcarmona
2015/08/25 02:13:37
I'm a bit confused by what exactly this comment me
msw
2015/08/26 01:42:35
My thought was also that bubbles might need to upd
hcarmona
2015/08/26 17:25:57
Acknowledged.
| |
| 33 | |
| 34 // The user selected an affirmative response in the bubble. | |
| 35 BUBBLE_CLOSE_ACCEPTED, | |
| 36 | |
| 37 // The user selected a negative response in the bubble. | |
| 38 BUBBLE_CLOSE_CANCELED, | |
| 39 | |
| 40 // The bubble WILL be closed regardless of return value for |ShouldClose|. | |
| 41 // Ex: The bubble's parent window is being destroyed. | |
| 42 BUBBLE_CLOSE_FORCED, | |
| 43 }; | |
| 44 | |
| 45 // Inherit from this class to define a bubble. A bubble is a small transient UI | |
| 46 // surface anchored to a parent window. Most bubbles are dismissed when they | |
| 47 // lose focus. | |
| 48 class BubbleDelegate { | |
| 49 public: | |
| 50 BubbleDelegate() {} | |
|
msw
2015/08/21 01:48:30
nit: if you move the dtor definition, you may as w
hcarmona
2015/08/25 02:13:36
Done.
| |
| 51 virtual ~BubbleDelegate() {} | |
|
msw
2015/08/21 01:48:30
nit: this virtual dtor should be defined in the cc
hcarmona
2015/08/25 02:13:37
Done.
| |
| 52 | |
| 53 // Called by BubbleController to notify a bubble of an event that the bubble | |
| 54 // might want to close on. Return true if the bubble should close for the | |
| 55 // specified reason. | |
| 56 virtual bool ShouldClose(BubbleCloseReason reason); | |
| 57 | |
| 58 // Called by BubbleController to build the UI that will represent this bubble. | |
| 59 // BubbleDelegate should not keep a reference to this newly created UI. | |
| 60 virtual scoped_ptr<BubbleUI> BuildBubbleUI() = 0; | |
| 61 | |
| 62 private: | |
| 63 DISALLOW_COPY_AND_ASSIGN(BubbleDelegate); | |
| 64 }; | |
| 65 | |
| 66 #endif // COMPONENTS_BUBBLE_BUBBLE_DELEGATE_H_ | |
| OLD | NEW |