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_CONTROLLER_H_ | |
| 6 #define COMPONENTS_BUBBLE_BUBBLE_CONTROLLER_H_ | |
| 7 | |
| 8 #include "base/memory/scoped_ptr.h" | |
| 9 #include "base/memory/weak_ptr.h" | |
| 10 #include "components/bubble/bubble_delegate.h" | |
| 11 | |
| 12 class BubbleUI; | |
| 13 | |
| 14 // BubbleController is responsible for the lifetime of the delegate and its UI. | |
| 15 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.
| |
| 16 public: | |
| 17 explicit BubbleController(scoped_ptr<BubbleDelegate> delegate); | |
| 18 virtual ~BubbleController(); | |
| 19 | |
| 20 private: | |
| 21 friend class BubbleManager; | |
| 22 | |
| 23 // Will create and show the UI for the delegate. | |
| 24 void Show(); | |
| 25 | |
| 26 // Will notify the bubble UI that it should update its anchor location. | |
| 27 // Important when there's a UI change (ex: fullscreen transition). | |
| 28 void UpdateAnchorPosition(); | |
| 29 | |
| 30 // Will clean up the delegate and its UI if it closed. | |
| 31 // Returns true if the bubble was closed. | |
| 32 bool ShouldClose(BubbleCloseReason reason); | |
| 33 | |
| 34 scoped_ptr<BubbleDelegate> delegate_; | |
| 35 scoped_ptr<BubbleUI> bubble_ui_; | |
| 36 | |
| 37 DISALLOW_COPY_AND_ASSIGN(BubbleController); | |
| 38 }; | |
| 39 | |
| 40 #endif // COMPONENTS_BUBBLE_BUBBLE_CONTROLLER_H_ | |
| OLD | NEW |