Chromium Code Reviews| Index: components/bubble/bubble_controller.h |
| diff --git a/components/bubble/bubble_controller.h b/components/bubble/bubble_controller.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..26a7f02402821682ce161147c9aaa9f7da91d8f0 |
| --- /dev/null |
| +++ b/components/bubble/bubble_controller.h |
| @@ -0,0 +1,40 @@ |
| +// 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_CONTROLLER_H_ |
| +#define COMPONENTS_BUBBLE_BUBBLE_CONTROLLER_H_ |
| + |
| +#include "base/memory/scoped_ptr.h" |
| +#include "base/memory/weak_ptr.h" |
| +#include "components/bubble/bubble_delegate.h" |
| + |
| +class BubbleUI; |
| + |
| +// BubbleController is responsible for the lifetime of the delegate and its UI. |
| +class BubbleController : public base::SupportsWeakPtr<BubbleController> { |
|
msw
2015/08/21 01:48:30
If users hold WeakPtrs to BubbleControllers, they'
hcarmona
2015/08/25 02:13:36
I added |CloseBubble| so it can be called on the b
msw
2015/08/26 01:42:35
Acknowledged.
|
| + public: |
| + explicit BubbleController(scoped_ptr<BubbleDelegate> delegate); |
| + virtual ~BubbleController(); |
| + |
| + private: |
| + friend class BubbleManager; |
| + |
| + // Will create and show the UI for the delegate. |
| + void Show(); |
| + |
| + // Will notify the bubble UI that it should update its anchor location. |
| + // Important when there's a UI change (ex: fullscreen transition). |
| + void UpdateAnchorPosition(); |
| + |
| + // Will clean up the delegate and its UI if it closed. |
| + // Returns true if the bubble was closed. |
| + bool ShouldClose(BubbleCloseReason reason); |
| + |
| + scoped_ptr<BubbleDelegate> delegate_; |
| + scoped_ptr<BubbleUI> bubble_ui_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(BubbleController); |
| +}; |
| + |
| +#endif // COMPONENTS_BUBBLE_BUBBLE_CONTROLLER_H_ |