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 { | |
| 15 // Bubble was closed without any user interaction. | |
| 16 BUBBLE_CLOSE_IGNORE, | |
|
msw
2015/08/18 17:26:19
nit: maybe rename IGNORE to LOST_FOCUS?
hcarmona
2015/08/18 23:08:48
Done.
| |
| 17 | |
| 18 // User did not interact with the bubble, but changed tab. | |
| 19 BUBBLE_CLOSE_TABSWITCH, | |
|
msw
2015/08/18 17:26:19
nit: maybe rename this TABSWITCHED to match TABDET
hcarmona
2015/08/18 23:08:48
Done.
| |
| 20 | |
| 21 // User did not interact with the bubble, but changed tab. | |
|
msw
2015/08/18 17:26:19
nit: s/changed/detached the/ ?
hcarmona
2015/08/18 23:08:48
Done.
| |
| 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_NAVIGATION, | |
| 29 | |
| 30 // Window has entered fullscreen mode. Will also be called for immersive | |
|
msw
2015/08/18 17:26:19
nit: "entered or exited" or maybe toggled?
hcarmona
2015/08/18 23:08:48
Done.
| |
| 31 // fullscreen. | |
| 32 BUBBLE_CLOSE_FULLSCREEN, | |
| 33 | |
| 34 // User selected the "Accept" option in a bubble. | |
|
msw
2015/08/18 17:26:19
nit: Consider "The user selected an affirmative re
hcarmona
2015/08/18 23:08:48
Done.
| |
| 35 BUBBLE_CLOSE_ACCEPT, | |
| 36 | |
| 37 // User selected the "Cancel" option in a bubble. | |
|
msw
2015/08/18 17:26:19
nit: Consider "The user selected a negative respon
hcarmona
2015/08/18 23:08:48
Done.
| |
| 38 BUBBLE_CLOSE_CANCEL, | |
| 39 | |
| 40 // The bubble WILL be closed regardless of return value for |ShouldClose|. | |
| 41 // Ex: BubbleManager is being destroyed. | |
|
msw
2015/08/18 17:26:19
nit: "The associated BubbleManager" or maybe "The
hcarmona
2015/08/18 23:08:48
Done.
| |
| 42 BUBBLE_CLOSE_FORCED, | |
| 43 }; | |
| 44 | |
| 45 // Inherit from this class to define a bubble. A bubble is a small piece of UI | |
|
msw
2015/08/18 17:26:19
nit: maybe remove "A bubble is a small piece of UI
hcarmona
2015/08/18 23:08:48
Done.
| |
| 46 // that's intended to ask a user a question. Most bubbles are dismissed when | |
| 47 // they lose focus. | |
| 48 class BubbleDelegate { | |
| 49 public: | |
| 50 BubbleDelegate() {} | |
| 51 virtual ~BubbleDelegate() {} | |
| 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 // IMPORTANT: DO NOT SHOW OR HIDE OTHER BUBBLES IN THIS FUNCTION. | |
|
msw
2015/08/18 17:26:19
I wonder how tough it would be to support this, an
hcarmona
2015/08/18 23:08:48
It doesn't sound very hard to fix this. I like you
msw
2015/08/19 00:18:11
I think it would be good to tackle in this CL, unl
hcarmona
2015/08/20 02:34:31
Done.
| |
| 57 // If closing this bubble needs to chain with other bubbles, please chain in | |
|
msw
2015/08/18 17:26:19
nit: consider "If closing this bubble should show
hcarmona
2015/08/18 23:08:48
Done.
| |
| 58 // the destructor. | |
| 59 virtual bool ShouldClose(BubbleCloseReason reason); | |
| 60 | |
| 61 // Called by BubbleController to build the UI that will represent this bubble. | |
| 62 // BubbleDelegate should not keep a reference to this newly created UI. | |
| 63 virtual scoped_ptr<BubbleUI> BuildBubbleUI() = 0; | |
| 64 | |
| 65 private: | |
| 66 DISALLOW_COPY_AND_ASSIGN(BubbleDelegate); | |
| 67 }; | |
| 68 | |
| 69 #endif // COMPONENTS_BUBBLE_BUBBLE_DELEGATE_H_ | |
| OLD | NEW |