| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2008, 2010 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2010 Google Inc. All rights reserved. | 3 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 virtual bool supportsFocus() const OVERRIDE { return false; } | 94 virtual bool supportsFocus() const OVERRIDE { return false; } |
| 95 | 95 |
| 96 bool m_capturing; | 96 bool m_capturing; |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 #if ENABLE(INPUT_SPEECH) | 99 #if ENABLE(INPUT_SPEECH) |
| 100 | 100 |
| 101 class InputFieldSpeechButtonElement FINAL | 101 class InputFieldSpeechButtonElement FINAL |
| 102 : public HTMLDivElement, | 102 : public HTMLDivElement, |
| 103 public SpeechInputListener { | 103 public SpeechInputListener { |
| 104 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(InputFieldSpeechButtonElement); |
| 104 public: | 105 public: |
| 105 enum SpeechInputState { | 106 enum SpeechInputState { |
| 106 Idle, | 107 Idle, |
| 107 Recording, | 108 Recording, |
| 108 Recognizing, | 109 Recognizing, |
| 109 }; | 110 }; |
| 110 | 111 |
| 111 static PassRefPtr<InputFieldSpeechButtonElement> create(Document&); | 112 static PassRefPtr<InputFieldSpeechButtonElement> create(Document&); |
| 112 virtual ~InputFieldSpeechButtonElement(); | 113 virtual ~InputFieldSpeechButtonElement(); |
| 113 | 114 |
| 114 virtual void detach(const AttachContext& = AttachContext()) OVERRIDE; | 115 virtual void detach(const AttachContext& = AttachContext()) OVERRIDE; |
| 115 virtual void defaultEventHandler(Event*) OVERRIDE; | 116 virtual void defaultEventHandler(Event*) OVERRIDE; |
| 116 virtual bool willRespondToMouseClickEvents() OVERRIDE; | 117 virtual bool willRespondToMouseClickEvents() OVERRIDE; |
| 117 virtual bool isInputFieldSpeechButtonElement() const OVERRIDE { return true;
} | 118 virtual bool isInputFieldSpeechButtonElement() const OVERRIDE { return true;
} |
| 118 SpeechInputState state() const { return m_state; } | 119 SpeechInputState state() const { return m_state; } |
| 119 void startSpeechInput(); | 120 void startSpeechInput(); |
| 120 void stopSpeechInput(); | 121 void stopSpeechInput(); |
| 121 | 122 |
| 122 // SpeechInputListener methods. | 123 // SpeechInputListener methods. |
| 123 virtual void didCompleteRecording(int) OVERRIDE; | 124 virtual void didCompleteRecording(int) OVERRIDE; |
| 124 virtual void didCompleteRecognition(int) OVERRIDE; | 125 virtual void didCompleteRecognition(int) OVERRIDE; |
| 125 virtual void setRecognitionResult(int, const SpeechInputResultArray&) OVERRI
DE; | 126 virtual void setRecognitionResult(int, const SpeechInputResultArray&) OVERRI
DE; |
| 126 | 127 |
| 128 virtual void trace(Visitor*) OVERRIDE; |
| 129 |
| 127 private: | 130 private: |
| 128 InputFieldSpeechButtonElement(Document&); | 131 InputFieldSpeechButtonElement(Document&); |
| 129 SpeechInput* speechInput(); | 132 SpeechInput* speechInput(); |
| 130 void setState(SpeechInputState state); | 133 void setState(SpeechInputState state); |
| 131 virtual bool isMouseFocusable() const OVERRIDE { return false; } | 134 virtual bool isMouseFocusable() const OVERRIDE { return false; } |
| 132 virtual void attach(const AttachContext& = AttachContext()) OVERRIDE; | 135 virtual void attach(const AttachContext& = AttachContext()) OVERRIDE; |
| 133 | 136 |
| 134 bool m_capturing; | 137 bool m_capturing; |
| 135 SpeechInputState m_state; | 138 SpeechInputState m_state; |
| 136 int m_listenerId; | 139 int m_listenerId; |
| 137 WillBePersistentSpeechInputResultArray m_results; | 140 SpeechInputResultArray m_results; |
| 138 }; | 141 }; |
| 139 | 142 |
| 140 DEFINE_TYPE_CASTS(InputFieldSpeechButtonElement, Element, element, element->isIn
putFieldSpeechButtonElement(), element.isInputFieldSpeechButtonElement()); | 143 DEFINE_TYPE_CASTS(InputFieldSpeechButtonElement, Element, element, element->isIn
putFieldSpeechButtonElement(), element.isInputFieldSpeechButtonElement()); |
| 141 | 144 |
| 142 #endif // ENABLE(INPUT_SPEECH) | 145 #endif // ENABLE(INPUT_SPEECH) |
| 143 | 146 |
| 144 } // namespace | 147 } // namespace |
| 145 | 148 |
| 146 #endif | 149 #endif |
| OLD | NEW |