Chromium Code Reviews| Index: chrome/browser/speech/speech_input_bubble_controller.h |
| diff --git a/chrome/browser/speech/speech_input_bubble_controller.h b/chrome/browser/speech/speech_input_bubble_controller.h |
| index 0a2033357fc5c95f4404706cf1c99e7188adb169..692d837d1ff4ed462cd2ec66ecb60e2b2f996722 100644 |
| --- a/chrome/browser/speech/speech_input_bubble_controller.h |
| +++ b/chrome/browser/speech/speech_input_bubble_controller.h |
| @@ -11,10 +11,12 @@ |
| #include "base/ref_counted.h" |
| #include "base/scoped_ptr.h" |
| #include "chrome/browser/speech/speech_input_bubble.h" |
| +#include "chrome/common/notification_observer.h" |
| namespace gfx { |
| class Rect; |
| } |
| +class NotificationRegistrar; |
| namespace speech_input { |
| @@ -25,7 +27,8 @@ namespace speech_input { |
| // that bubble are reported to the delegate. |
| class SpeechInputBubbleController |
| : public base::RefCountedThreadSafe<SpeechInputBubbleController>, |
| - public SpeechInputBubbleDelegate { |
| + public SpeechInputBubbleDelegate, |
| + public NotificationObserver { |
| public: |
| // All methods of this delegate are called in the IO thread. |
| class Delegate { |
| @@ -73,6 +76,11 @@ class SpeechInputBubbleController |
| virtual void InfoBubbleButtonClicked(SpeechInputBubble::Button button); |
| virtual void InfoBubbleFocusChanged(); |
| + // NotificationObserver implementation. |
| + virtual void Observe(NotificationType type, |
| + const NotificationSource& source, |
| + const NotificationDetails& details); |
| + |
| private: |
| // The various calls received by this object and handled in the UI thread. |
| enum RequestType { |
| @@ -91,6 +99,11 @@ class SpeechInputBubbleController |
| const string16& text, |
| float volume); |
| + // Whether the given bubble (IDed by caller_id) is the only one in our list |
| + // linked to that TabContents. Returns false if there are more such bubbles |
| + // in our list. |
| + bool IsOnlyBubbleForTab(int caller_id); |
| + |
| // Only accessed in the IO thread. |
| Delegate* delegate_; |
| @@ -102,7 +115,10 @@ class SpeechInputBubbleController |
| // Map of caller-ids to bubble objects. The bubbles are weak pointers owned by |
| // this object and get destroyed by |CloseBubble|. |
| - std::map<int, SpeechInputBubble*> bubbles_; |
| + typedef std::map<int, SpeechInputBubble*> BubbleCallerIdMap; |
| + BubbleCallerIdMap bubbles_; |
| + |
| + scoped_ptr<NotificationRegistrar> registrar_; |
|
bulach
2011/01/06 12:32:39
I think this is normally used directly rather than
Satish
2011/01/06 12:57:02
A few reviewers suggested in the past to reduce th
|
| }; |
| // This typedef is to workaround the issue with certain versions of |