| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #include "chrome/browser/speech/speech_input_bubble.h" | 7 #include "chrome/browser/speech/speech_input_bubble.h" |
| 8 | 8 |
| 9 #import "base/scoped_nsobject.h" | 9 #import "base/scoped_nsobject.h" |
| 10 #import "chrome/browser/cocoa/speech_input_window_controller.h" | 10 #import "chrome/browser/cocoa/speech_input_window_controller.h" |
| 11 #include "chrome/browser/tab_contents/tab_contents.h" | 11 #include "chrome/browser/tab_contents/tab_contents.h" |
| 12 #include "chrome/browser/tab_contents/tab_contents_view.h" | 12 #include "chrome/browser/tab_contents/tab_contents_view.h" |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 // A class to bridge between the speech recognition C++ code and the Objective-C | 16 // A class to bridge between the speech recognition C++ code and the Objective-C |
| 17 // bubble implementation. See chrome/browser/speech/speech_input_bubble.h for | 17 // bubble implementation. See chrome/browser/speech/speech_input_bubble.h for |
| 18 // more information on how this gets used. | 18 // more information on how this gets used. |
| 19 class SpeechInputBubbleImpl : public SpeechInputBubble { | 19 class SpeechInputBubbleImpl : public SpeechInputBubbleBase { |
| 20 public: | 20 public: |
| 21 SpeechInputBubbleImpl(TabContents* tab_contents, | 21 SpeechInputBubbleImpl(TabContents* tab_contents, |
| 22 Delegate* delegate, | 22 Delegate* delegate, |
| 23 const gfx::Rect& element_rect); | 23 const gfx::Rect& element_rect); |
| 24 virtual ~SpeechInputBubbleImpl(); | 24 virtual ~SpeechInputBubbleImpl(); |
| 25 virtual void SetRecognizingMode(); | 25 virtual void Show(); |
| 26 virtual void Hide(); |
| 27 virtual void UpdateLayout(); |
| 26 | 28 |
| 27 private: | 29 private: |
| 28 scoped_nsobject<SpeechInputWindowController> window_; | 30 scoped_nsobject<SpeechInputWindowController> window_; |
| 29 }; | 31 }; |
| 30 | 32 |
| 31 SpeechInputBubbleImpl::SpeechInputBubbleImpl(TabContents* tab_contents, | 33 SpeechInputBubbleImpl::SpeechInputBubbleImpl(TabContents* tab_contents, |
| 32 Delegate* delegate, | 34 Delegate* delegate, |
| 33 const gfx::Rect& element_rect) { | 35 const gfx::Rect& element_rect) { |
| 34 // Find the screen coordinates for the given tab and position the bubble's | 36 // Find the screen coordinates for the given tab and position the bubble's |
| 35 // arrow anchor point inside that to point at the bottom-left of the html | 37 // arrow anchor point inside that to point at the bottom-left of the html |
| (...skipping 10 matching lines...) Expand all Loading... |
| 46 window_.reset([[SpeechInputWindowController alloc] | 48 window_.reset([[SpeechInputWindowController alloc] |
| 47 initWithParentWindow:tab_contents->view()->GetTopLevelNativeWindow() | 49 initWithParentWindow:tab_contents->view()->GetTopLevelNativeWindow() |
| 48 delegate:delegate | 50 delegate:delegate |
| 49 anchoredAt:anchor]); | 51 anchoredAt:anchor]); |
| 50 } | 52 } |
| 51 | 53 |
| 52 SpeechInputBubbleImpl::~SpeechInputBubbleImpl() { | 54 SpeechInputBubbleImpl::~SpeechInputBubbleImpl() { |
| 53 [window_.get() close]; | 55 [window_.get() close]; |
| 54 } | 56 } |
| 55 | 57 |
| 56 void SpeechInputBubbleImpl::SetRecognizingMode() { | 58 void SpeechInputBubbleImpl::Show() { |
| 57 [window_.get() didStartRecognition]; | 59 // TODO(satish): Implement. |
| 60 NOTREACHED(); |
| 61 } |
| 62 |
| 63 void SpeechInputBubbleImpl::Hide() { |
| 64 // TODO(satish): Implement. |
| 65 NOTREACHED(); |
| 66 } |
| 67 |
| 68 void SpeechInputBubbleImpl::UpdateLayout() { |
| 69 // TODO(satish): Implement. |
| 70 NOTREACHED(); |
| 58 } | 71 } |
| 59 | 72 |
| 60 } // namespace | 73 } // namespace |
| 61 | 74 |
| 62 SpeechInputBubble* SpeechInputBubble::CreateNativeBubble( | 75 SpeechInputBubble* SpeechInputBubble::CreateNativeBubble( |
| 63 TabContents* tab_contents, | 76 TabContents* tab_contents, |
| 64 Delegate* delegate, | 77 Delegate* delegate, |
| 65 const gfx::Rect& element_rect) { | 78 const gfx::Rect& element_rect) { |
| 66 return new SpeechInputBubbleImpl(tab_contents, delegate, element_rect); | 79 return new SpeechInputBubbleImpl(tab_contents, delegate, element_rect); |
| 67 } | 80 } |
| 68 | 81 |
| OLD | NEW |