| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 class SearchFieldCancelButtonElement FINAL : public HTMLDivElement { | 84 class SearchFieldCancelButtonElement FINAL : public HTMLDivElement { |
| 85 public: | 85 public: |
| 86 static PassRefPtr<SearchFieldCancelButtonElement> create(Document*); | 86 static PassRefPtr<SearchFieldCancelButtonElement> create(Document*); |
| 87 | 87 |
| 88 virtual void defaultEventHandler(Event*); | 88 virtual void defaultEventHandler(Event*); |
| 89 virtual bool willRespondToMouseClickEvents() OVERRIDE; | 89 virtual bool willRespondToMouseClickEvents() OVERRIDE; |
| 90 | 90 |
| 91 private: | 91 private: |
| 92 SearchFieldCancelButtonElement(Document*); | 92 SearchFieldCancelButtonElement(Document*); |
| 93 virtual const AtomicString& shadowPseudoId() const; | 93 virtual const AtomicString& shadowPseudoId() const; |
| 94 virtual void detach(); | 94 virtual void detach(const AttachContext& = AttachContext()) OVERRIDE; |
| 95 virtual bool isMouseFocusable() const { return false; } | 95 virtual bool isMouseFocusable() const { return false; } |
| 96 | 96 |
| 97 bool m_capturing; | 97 bool m_capturing; |
| 98 }; | 98 }; |
| 99 | 99 |
| 100 #if ENABLE(INPUT_SPEECH) | 100 #if ENABLE(INPUT_SPEECH) |
| 101 | 101 |
| 102 class InputFieldSpeechButtonElement FINAL | 102 class InputFieldSpeechButtonElement FINAL |
| 103 : public HTMLDivElement, | 103 : public HTMLDivElement, |
| 104 public SpeechInputListener { | 104 public SpeechInputListener { |
| 105 public: | 105 public: |
| 106 enum SpeechInputState { | 106 enum SpeechInputState { |
| 107 Idle, | 107 Idle, |
| 108 Recording, | 108 Recording, |
| 109 Recognizing, | 109 Recognizing, |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 static PassRefPtr<InputFieldSpeechButtonElement> create(Document*); | 112 static PassRefPtr<InputFieldSpeechButtonElement> create(Document*); |
| 113 virtual ~InputFieldSpeechButtonElement(); | 113 virtual ~InputFieldSpeechButtonElement(); |
| 114 | 114 |
| 115 virtual void detach(); | 115 virtual void detach(const AttachContext& = AttachContext()) OVERRIDE; |
| 116 virtual void defaultEventHandler(Event*); | 116 virtual void defaultEventHandler(Event*); |
| 117 virtual bool willRespondToMouseClickEvents(); | 117 virtual bool willRespondToMouseClickEvents(); |
| 118 virtual bool isInputFieldSpeechButtonElement() const { return true; } | 118 virtual bool isInputFieldSpeechButtonElement() const { return true; } |
| 119 SpeechInputState state() const { return m_state; } | 119 SpeechInputState state() const { return m_state; } |
| 120 void startSpeechInput(); | 120 void startSpeechInput(); |
| 121 void stopSpeechInput(); | 121 void stopSpeechInput(); |
| 122 | 122 |
| 123 // SpeechInputListener methods. | 123 // SpeechInputListener methods. |
| 124 void didCompleteRecording(int); | 124 void didCompleteRecording(int); |
| 125 void didCompleteRecognition(int); | 125 void didCompleteRecognition(int); |
| 126 void setRecognitionResult(int, const SpeechInputResultArray&); | 126 void setRecognitionResult(int, const SpeechInputResultArray&); |
| 127 | 127 |
| 128 private: | 128 private: |
| 129 InputFieldSpeechButtonElement(Document*); | 129 InputFieldSpeechButtonElement(Document*); |
| 130 SpeechInput* speechInput(); | 130 SpeechInput* speechInput(); |
| 131 void setState(SpeechInputState state); | 131 void setState(SpeechInputState state); |
| 132 virtual const AtomicString& shadowPseudoId() const; | 132 virtual const AtomicString& shadowPseudoId() const; |
| 133 virtual bool isMouseFocusable() const { return false; } | 133 virtual bool isMouseFocusable() const { return false; } |
| 134 virtual void attach(); | 134 virtual void attach(const AttachContext& = AttachContext()) OVERRIDE; |
| 135 | 135 |
| 136 bool m_capturing; | 136 bool m_capturing; |
| 137 SpeechInputState m_state; | 137 SpeechInputState m_state; |
| 138 int m_listenerId; | 138 int m_listenerId; |
| 139 SpeechInputResultArray m_results; | 139 SpeechInputResultArray m_results; |
| 140 }; | 140 }; |
| 141 | 141 |
| 142 inline InputFieldSpeechButtonElement* toInputFieldSpeechButtonElement(Element* e
lement) | 142 inline InputFieldSpeechButtonElement* toInputFieldSpeechButtonElement(Element* e
lement) |
| 143 { | 143 { |
| 144 ASSERT_WITH_SECURITY_IMPLICATION(!element || element->isInputFieldSpeechButt
onElement()); | 144 ASSERT_WITH_SECURITY_IMPLICATION(!element || element->isInputFieldSpeechButt
onElement()); |
| 145 return static_cast<InputFieldSpeechButtonElement*>(element); | 145 return static_cast<InputFieldSpeechButtonElement*>(element); |
| 146 } | 146 } |
| 147 | 147 |
| 148 #endif // ENABLE(INPUT_SPEECH) | 148 #endif // ENABLE(INPUT_SPEECH) |
| 149 | 149 |
| 150 } // namespace | 150 } // namespace |
| 151 | 151 |
| 152 #endif | 152 #endif |
| OLD | NEW |