| 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..385fb31f0287319211189f6e923aa0746b7c382c
|
| --- /dev/null
|
| +++ b/components/bubble/bubble_delegate.h
|
| @@ -0,0 +1,69 @@
|
| +// 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 {
|
| + // Bubble was closed without any user interaction.
|
| + BUBBLE_CLOSE_IGNORE,
|
| +
|
| + // User did not interact with the bubble, but changed tab.
|
| + BUBBLE_CLOSE_TABSWITCH,
|
| +
|
| + // User did not interact with the bubble, but changed 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_NAVIGATION,
|
| +
|
| + // Window has entered fullscreen mode. Will also be called for immersive
|
| + // fullscreen.
|
| + BUBBLE_CLOSE_FULLSCREEN,
|
| +
|
| + // User selected the "Accept" option in a bubble.
|
| + BUBBLE_CLOSE_ACCEPT,
|
| +
|
| + // User selected the "Cancel" option in a bubble.
|
| + BUBBLE_CLOSE_CANCEL,
|
| +
|
| + // The bubble WILL be closed regardless of return value for |ShouldClose|.
|
| + // Ex: BubbleManager is being destroyed.
|
| + BUBBLE_CLOSE_FORCED,
|
| +};
|
| +
|
| +// Inherit from this class to define a bubble. A bubble is a small piece of UI
|
| +// that's intended to ask a user a question. Most bubbles are dismissed when
|
| +// they lose focus.
|
| +class BubbleDelegate {
|
| + public:
|
| + BubbleDelegate() {}
|
| + virtual ~BubbleDelegate() {}
|
| +
|
| + // 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.
|
| + // IMPORTANT: DO NOT SHOW OR HIDE OTHER BUBBLES IN THIS FUNCTION.
|
| + // If closing this bubble needs to chain with other bubbles, please chain in
|
| + // the destructor.
|
| + 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_
|
|
|