| 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_close_reason.h" |
| 11 |
| 12 class BubbleDelegate; |
| 13 class BubbleManager; |
| 14 class BubbleUI; |
| 15 |
| 16 // BubbleController is responsible for the lifetime of the delegate and its UI. |
| 17 class BubbleController : public base::SupportsWeakPtr<BubbleController> { |
| 18 public: |
| 19 explicit BubbleController(BubbleManager* manager, |
| 20 scoped_ptr<BubbleDelegate> delegate); |
| 21 virtual ~BubbleController(); |
| 22 |
| 23 // Calls CloseBubble on the associated BubbleManager. |
| 24 bool CloseBubble(BubbleCloseReason reason); |
| 25 |
| 26 private: |
| 27 friend class BubbleManager; |
| 28 |
| 29 // Creates and shows the UI for the delegate. |
| 30 void Show(); |
| 31 |
| 32 // Notifies the bubble UI that it should update its anchor location. |
| 33 // Important when there's a UI change (ex: fullscreen transition). |
| 34 void UpdateAnchorPosition(); |
| 35 |
| 36 // Cleans up the delegate and its UI if it closed. |
| 37 // Returns true if the bubble was closed. |
| 38 bool ShouldClose(BubbleCloseReason reason); |
| 39 |
| 40 BubbleManager* manager_; |
| 41 scoped_ptr<BubbleDelegate> delegate_; |
| 42 scoped_ptr<BubbleUI> bubble_ui_; |
| 43 |
| 44 DISALLOW_COPY_AND_ASSIGN(BubbleController); |
| 45 }; |
| 46 |
| 47 #endif // COMPONENTS_BUBBLE_BUBBLE_CONTROLLER_H_ |
| OLD | NEW |