| Index: components/bubble/bubble_manager.h
|
| diff --git a/components/bubble/bubble_manager.h b/components/bubble/bubble_manager.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..0a7ada341e39bd734c8747aa27886e675fa58500
|
| --- /dev/null
|
| +++ b/components/bubble/bubble_manager.h
|
| @@ -0,0 +1,60 @@
|
| +// 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_MANAGER_H_
|
| +#define COMPONENTS_BUBBLE_BUBBLE_MANAGER_H_
|
| +
|
| +#include "base/memory/scoped_ptr.h"
|
| +#include "base/memory/scoped_vector.h"
|
| +#include "base/memory/weak_ptr.h"
|
| +#include "components/bubble/bubble_delegate.h"
|
| +
|
| +class BubbleController;
|
| +
|
| +// TODO(hcarmona): Don't expose BubbleController functions to users of this API.
|
| +typedef base::WeakPtr<BubbleController> BubbleReference;
|
| +
|
| +// Inherit from BubbleManager to show, update, and close bubbles.
|
| +// Any class that inherits from BubbleManager should capture any events that
|
| +// should dismiss a bubble or update its anchor point.
|
| +// This class assumes that we won't be showing a lot of bubbles simultaneously.
|
| +// TODO(hcarmona): Handle simultaneous bubbles. http://crbug.com/366937
|
| +class BubbleManager {
|
| + public:
|
| + virtual ~BubbleManager();
|
| +
|
| + // Shows a specific bubble and returns a reference to it.
|
| + // This reference should be used through the BubbleManager.
|
| + BubbleReference ShowBubble(scoped_ptr<BubbleDelegate> bubble);
|
| +
|
| + // Close a specific bubble with a given reason.
|
| + // Returns true if the bubble was actually closed.
|
| + bool CloseBubble(BubbleReference bubble, BubbleCloseReason reason);
|
| +
|
| + // Notify all bubbles that their anchor or parent may have changed.
|
| + void UpdateAllBubbleAnchors();
|
| +
|
| + protected:
|
| + BubbleManager();
|
| +
|
| + // Notify all bubbles of a potential close event.
|
| + void CloseAllBubbles(BubbleCloseReason reason);
|
| +
|
| + // Show a specific bubble.
|
| + virtual void ShowBubbleUI(base::WeakPtr<BubbleController> controller);
|
| +
|
| + // Close a specific bubble.
|
| + virtual bool ShouldClose(base::WeakPtr<BubbleController> controller,
|
| + BubbleCloseReason reason);
|
| +
|
| + // Update a specific bubble's anchor position.
|
| + virtual void UpdateAnchorPosition(base::WeakPtr<BubbleController> controller);
|
| +
|
| + private:
|
| + ScopedVector<BubbleController> controllers_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(BubbleManager);
|
| +};
|
| +
|
| +#endif // COMPONENTS_BUBBLE_BUBBLE_MANAGER_H_
|
|
|