| 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 { |
| 16 public: |
| 17 explicit BubbleController(scoped_ptr<BubbleDelegate> delegate); |
| 18 virtual ~BubbleController(); |
| 19 |
| 20 // Will create and show the UI for the delegate. |
| 21 void Show(); |
| 22 |
| 23 // Will notify the bubble UI that it should update its anchor location. |
| 24 // Important when there's a UI change (ex: fullscreen transition). |
| 25 void UpdateAnchorPosition(); |
| 26 |
| 27 // Should clean up the delegate and its UI if it closed. |
| 28 // Returns true if the bubble was closed. |
| 29 bool ShouldClose(BubbleCloseReason reason); |
| 30 |
| 31 base::WeakPtr<BubbleController> AsWeakPtr(); |
| 32 |
| 33 private: |
| 34 scoped_ptr<BubbleDelegate> delegate_; |
| 35 scoped_ptr<BubbleUI> bubble_ui_; |
| 36 |
| 37 base::WeakPtrFactory<BubbleController> weak_ptr_factory_; |
| 38 |
| 39 DISALLOW_COPY_AND_ASSIGN(BubbleController); |
| 40 }; |
| 41 |
| 42 #endif // COMPONENTS_BUBBLE_BUBBLE_CONTROLLER_H_ |
| OLD | NEW |