Chromium Code Reviews| Index: components/bubble/bubble_delegate.h |
| diff --git a/components/bubble/bubble_delegate.h b/components/bubble/bubble_delegate.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2afdfb9c89e6be153b13bc242f2cac8ba623d7db |
| --- /dev/null |
| +++ b/components/bubble/bubble_delegate.h |
| @@ -0,0 +1,66 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef COMPONENTS_BUBBLE_BUBBLE_DELEGATE_H_ |
| +#define COMPONENTS_BUBBLE_BUBBLE_DELEGATE_H_ |
| + |
| +#include "base/memory/scoped_ptr.h" |
| + |
| +class BubbleUI; |
| + |
| +// List of reasons why a bubble might close. These correspond to various events |
| +// from the UI. Not all platforms will receive all events. |
| +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.
|
| + // Bubble was closed without any user interaction. |
| + BUBBLE_CLOSE_FOCUS_LOST, |
| + |
| + // User did not interact with the bubble, but changed tab. |
| + BUBBLE_CLOSE_TABSWITCHED, |
| + |
| + // User did not interact with the bubble, but detached the tab. |
| + BUBBLE_CLOSE_TABDETACHED, |
| + |
| + // User dismissed the bubble. (ESC, close, etc.) |
| + BUBBLE_CLOSE_USER_DISMISSED, |
| + |
| + // There has been a navigation event. (Link, URL typed, refresh, etc.) |
| + BUBBLE_CLOSE_NAVIGATED, |
| + |
| + // 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.
|
| + // fullscreen. |
| + 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.
|
| + |
| + // The user selected an affirmative response in the bubble. |
| + BUBBLE_CLOSE_ACCEPTED, |
| + |
| + // The user selected a negative response in the bubble. |
| + BUBBLE_CLOSE_CANCELED, |
| + |
| + // The bubble WILL be closed regardless of return value for |ShouldClose|. |
| + // Ex: The bubble's parent window is being destroyed. |
| + BUBBLE_CLOSE_FORCED, |
| +}; |
| + |
| +// Inherit from this class to define a bubble. A bubble is a small transient UI |
| +// surface anchored to a parent window. Most bubbles are dismissed when they |
| +// lose focus. |
| +class BubbleDelegate { |
| + public: |
| + 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.
|
| + 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.
|
| + |
| + // Called by BubbleController to notify a bubble of an event that the bubble |
| + // might want to close on. Return true if the bubble should close for the |
| + // specified reason. |
| + virtual bool ShouldClose(BubbleCloseReason reason); |
| + |
| + // Called by BubbleController to build the UI that will represent this bubble. |
| + // BubbleDelegate should not keep a reference to this newly created UI. |
| + virtual scoped_ptr<BubbleUI> BuildBubbleUI() = 0; |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(BubbleDelegate); |
| +}; |
| + |
| +#endif // COMPONENTS_BUBBLE_BUBBLE_DELEGATE_H_ |