| 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 #include "chrome/browser/tab_contents/tab_contents.h" | 5 #include "chrome/browser/tab_contents/tab_contents.h" |
| 6 #include "chrome/browser/speech/speech_input_bubble.h" | 6 #include "chrome/browser/speech/speech_input_bubble.h" |
| 7 #include "gfx/rect.h" | 7 #include "gfx/rect.h" |
| 8 | 8 |
| 9 SpeechInputBubble::FactoryMethod SpeechInputBubble::factory_ = NULL; | 9 SpeechInputBubble::FactoryMethod SpeechInputBubble::factory_ = NULL; |
| 10 const int SpeechInputBubble::kBubbleTargetOffsetX = 5; | 10 const int SpeechInputBubble::kBubbleTargetOffsetX = 5; |
| 11 | 11 |
| 12 SpeechInputBubble* SpeechInputBubble::Create(TabContents* tab_contents, | 12 SpeechInputBubble* SpeechInputBubble::Create(TabContents* tab_contents, |
| 13 Delegate* delegate, | 13 Delegate* delegate, |
| 14 const gfx::Rect& element_rect) { | 14 const gfx::Rect& element_rect) { |
| 15 if (factory_) | 15 if (factory_) |
| 16 return (*factory_)(tab_contents, delegate, element_rect); | 16 return (*factory_)(tab_contents, delegate, element_rect); |
| 17 | 17 |
| 18 // Has the tab already closed before bubble create request was processed? | 18 // Has the tab already closed before bubble create request was processed? |
| 19 if (!tab_contents) | 19 if (!tab_contents) |
| 20 return NULL; | 20 return NULL; |
| 21 | 21 |
| 22 return CreateNativeBubble(tab_contents, delegate, element_rect); | 22 return CreateNativeBubble(tab_contents, delegate, element_rect); |
| 23 } | 23 } |
| 24 |
| 25 SpeechInputBubbleBase::SpeechInputBubbleBase() |
| 26 : display_mode_(DISPLAY_MODE_RECORDING) { |
| 27 } |
| 28 |
| 29 void SpeechInputBubbleBase::SetRecordingMode() { |
| 30 display_mode_ = DISPLAY_MODE_RECORDING; |
| 31 UpdateLayout(); |
| 32 } |
| 33 |
| 34 void SpeechInputBubbleBase::SetRecognizingMode() { |
| 35 display_mode_ = DISPLAY_MODE_RECOGNIZING; |
| 36 UpdateLayout(); |
| 37 } |
| 38 |
| 39 void SpeechInputBubbleBase::SetMessage(const string16& text) { |
| 40 message_text_ = text; |
| 41 display_mode_ = DISPLAY_MODE_MESSAGE; |
| 42 UpdateLayout(); |
| 43 } |
| OLD | NEW |