OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_BUBBLE_BUBBLE_CONTROLLER_H_ | 5 #ifndef COMPONENTS_BUBBLE_BUBBLE_CONTROLLER_H_ |
6 #define COMPONENTS_BUBBLE_BUBBLE_CONTROLLER_H_ | 6 #define COMPONENTS_BUBBLE_BUBBLE_CONTROLLER_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "components/bubble/bubble_close_reason.h" | 10 #include "components/bubble/bubble_close_reason.h" |
11 | 11 |
12 class BubbleDelegate; | 12 class BubbleDelegate; |
13 class BubbleManager; | 13 class BubbleManager; |
14 class BubbleUI; | 14 class BubbleUI; |
15 | 15 |
16 // BubbleController is responsible for the lifetime of the delegate and its UI. | 16 // BubbleController is responsible for the lifetime of the delegate and its UI. |
17 class BubbleController : public base::SupportsWeakPtr<BubbleController> { | 17 class BubbleController : public base::SupportsWeakPtr<BubbleController> { |
18 public: | 18 public: |
19 explicit BubbleController(BubbleManager* manager, | 19 explicit BubbleController(BubbleManager* manager, |
20 scoped_ptr<BubbleDelegate> delegate); | 20 scoped_ptr<BubbleDelegate> delegate); |
21 virtual ~BubbleController(); | 21 virtual ~BubbleController(); |
22 | 22 |
23 // Calls CloseBubble on the associated BubbleManager. | 23 // Calls CloseBubble on the associated BubbleManager. |
24 bool CloseBubble(BubbleCloseReason reason); | 24 bool CloseBubble(BubbleCloseReason reason); |
25 | 25 |
26 // Calls UpdateBubbleUI on the associated BubbleManager. | |
27 bool UpdateBubbleUI(); | |
groby-ooo-7-16
2015/09/03 17:30:01
Naming convention would make this UpdateBubbleUi.
hcarmona
2015/09/03 18:05:54
Fixed everywhere.
| |
28 | |
26 private: | 29 private: |
27 friend class BubbleManager; | 30 friend class BubbleManager; |
28 | 31 |
29 // Creates and shows the UI for the delegate. | 32 // Creates and shows the UI for the delegate. |
30 void Show(); | 33 void Show(); |
31 | 34 |
32 // Notifies the bubble UI that it should update its anchor location. | 35 // Notifies the bubble UI that it should update its anchor location. |
33 // Important when there's a UI change (ex: fullscreen transition). | 36 // Important when there's a UI change (ex: fullscreen transition). |
34 void UpdateAnchorPosition(); | 37 void UpdateAnchorPosition(); |
35 | 38 |
36 // Cleans up the delegate and its UI if it closed. | 39 // Cleans up the delegate and its UI if it closed. |
37 // Returns true if the bubble was closed. | 40 // Returns true if the bubble was closed. |
38 bool ShouldClose(BubbleCloseReason reason); | 41 bool ShouldClose(BubbleCloseReason reason); |
39 | 42 |
43 // Called by BubbleManager to notify the bubble to update its UI. | |
44 bool UpdateBubbleUIInternal(); | |
45 | |
40 BubbleManager* manager_; | 46 BubbleManager* manager_; |
41 scoped_ptr<BubbleDelegate> delegate_; | 47 scoped_ptr<BubbleDelegate> delegate_; |
42 scoped_ptr<BubbleUI> bubble_ui_; | 48 scoped_ptr<BubbleUI> bubble_ui_; |
43 | 49 |
44 DISALLOW_COPY_AND_ASSIGN(BubbleController); | 50 DISALLOW_COPY_AND_ASSIGN(BubbleController); |
45 }; | 51 }; |
46 | 52 |
47 #endif // COMPONENTS_BUBBLE_BUBBLE_CONTROLLER_H_ | 53 #endif // COMPONENTS_BUBBLE_BUBBLE_CONTROLLER_H_ |
OLD | NEW |