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_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" | |
|
please use gerrit instead
2015/08/07 23:02:28
might be able to get away with forward declaring b
hcarmona
2015/08/11 02:35:46
BubbleCloseReason prevents this.
| |
| 11 | |
| 12 class BubbleDelegate; | |
| 13 typedef base::WeakPtr<BubbleDelegate> BubbleReference; | |
|
please use gerrit instead
2015/08/07 23:02:28
ref to controller
hcarmona
2015/08/11 02:35:46
Done.
How can we prevent anyone who has a referen
| |
| 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 */ | |
|
please use gerrit instead
2015/08/07 23:02:28
//
hcarmona
2015/08/11 02:35:47
Done.
| |
| 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 // TODO(hcarmona): combine into a single function and use a callback. | |
| 36 void ShowMatchingBubbles(void* context); | |
| 37 void CloseMatchingBubbles(void* context, bool force, | |
| 38 BubbleCloseReason reason); | |
| 39 void UpdateMatchingBubbles(void* context); | |
| 40 | |
| 41 // Override and call Show on the controller when it's convenient. | |
| 42 virtual void ScheduleShowBubble( | |
| 43 base::WeakPtr<BubbleController> controller) = 0; | |
| 44 | |
| 45 ScopedVector<BubbleController> controllers_; | |
|
please use gerrit instead
2015/08/07 23:02:28
member vars and DISALLOW() should be private
hcarmona
2015/08/11 02:35:46
Done.
| |
| 46 | |
| 47 DISALLOW_COPY_AND_ASSIGN(BubbleManager); | |
| 48 }; | |
| 49 | |
| 50 #endif // COMPONENTS_BUBBLE_BUBBLE_MANAGER_H__ | |
| OLD | NEW |