| 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_MANAGER_H__ |
| 6 #define COMPONENTS_BUBBLE_BUBBLE_MANAGER_H__ |
| 7 |
| 8 #include "base/memory/scoped_vector.h" |
| 9 #include "base/memory/weak_ptr.h" |
| 10 #include "components/bubble/bubble_controller.h" |
| 11 |
| 12 class BubbleDelegate; |
| 13 typedef base::WeakPtr<BubbleDelegate> BubbleReference; |
| 14 |
| 15 /** |
| 16 * BubbleManager should exist per profile. |
| 17 * Showing bubbles should go through the BubbleManager. |
| 18 * |
| 19 * This class assumes that we won't be showing a lot of bubbles simultaneously. |
| 20 * If this assumption ever stops being true, please file a bug against whatever |
| 21 * is bombarding the user with many bubbles at the same time. |
| 22 */ |
| 23 class BubbleManager { |
| 24 public: |
| 25 virtual ~BubbleManager(); |
| 26 |
| 27 BubbleReference ShowBubble(scoped_ptr<BubbleDelegate> bubble); |
| 28 void CloseBubble(BubbleReference bubble); |
| 29 |
| 30 protected: |
| 31 // This class should be subclassed to hook into all the appropriate events. |
| 32 BubbleManager(); |
| 33 |
| 34 // For mass updating of bubbles: |
| 35 void ShowMatchingBubbles(void* context); |
| 36 void CloseMatchingBubbles(void* context, bool force, |
| 37 BubbleCloseReason reason); |
| 38 void UpdateMatchingBubbles(void* context); |
| 39 |
| 40 // Override and call Show on the controller when it's convenient. |
| 41 virtual void ScheduleShowBubble( |
| 42 base::WeakPtr<BubbleController> controller) = 0; |
| 43 |
| 44 ScopedVector<BubbleController> controllers_; |
| 45 |
| 46 DISALLOW_COPY_AND_ASSIGN(BubbleManager); |
| 47 }; |
| 48 |
| 49 #endif // COMPONENTS_BUBBLE_BUBBLE_MANAGER_H__ |
| OLD | NEW |