Source/WebCore/ChangeLog

 12012-02-21 MORITA Hajime <morrita@google.com>
 2
 3 INPUT_SPEECH should be implemented as a PageSupplement.
 4 https://bugs.webkit.org/show_bug.cgi?id=79051
 5
 6 Turned SpeechInput to a PageSupplement.
 7
 8 Reviewed by NOBODY (OOPS!).
 9
 10 No new tests. No behavior change.
 11
 12 * html/shadow/TextControlInnerElements.cpp:
 13 (WebCore::InputFieldSpeechButtonElement::speechInput):
 14 (WebCore::InputFieldSpeechButtonElement::attach):
 15 * page/Page.cpp:
 16 (WebCore::Page::Page):
 17 (WebCore::Page::PageClients::PageClients):
 18 * page/Page.h:
 19 (WebCore):
 20 (PageClients):
 21 (Page):
 22 * page/SpeechInput.cpp:
 23 (WebCore::SpeechInput::supplementName):
 24 (WebCore):
 25 (WebCore::provideSpeechInputTo):
 26 * page/SpeechInput.h:
 27 (SpeechInput):
 28 (WebCore::SpeechInput::from):
 29 * page/SpeechInputClient.h:
 30 (WebCore):
 31
1322012-02-20 MORITA Hajime <morrita@google.com>
233
334 MEDIA_STREAM should be implemented as a PageSupplement.

Source/WebKit/chromium/ChangeLog

 12012-02-21 MORITA Hajime <morrita@google.com>
 2
 3 INPUT_SPEECH should be implemented as a PageSupplement.
 4 https://bugs.webkit.org/show_bug.cgi?id=79051
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 * src/WebViewImpl.cpp:
 9 (WebKit::WebViewImpl::WebViewImpl):
 10
1112012-02-20 MORITA Hajime <morrita@google.com>
212
313 MEDIA_STREAM should be implemented as a PageSupplement.

Source/WebCore/html/shadow/TextControlInnerElements.cpp

@@void InputFieldSpeechButtonElement::setState(SpeechInputState state)
474474
475475SpeechInput* InputFieldSpeechButtonElement::speechInput()
476476{
477  return document()->page() ? document()->page()->speechInput() : 0;
 477 return SpeechInput::from(document()->page());
478478}
479479
480480void InputFieldSpeechButtonElement::didCompleteRecording(int)

@@void InputFieldSpeechButtonElement::setRecognitionResult(int, const SpeechInputR
520520void InputFieldSpeechButtonElement::attach()
521521{
522522 ASSERT(!m_listenerId);
523  m_listenerId = document()->page()->speechInput()->registerListener(this);
 523 if (SpeechInput* input = SpeechInput::from(document()->page()))
 524 m_listenerId = input->registerListener(this);
524525 HTMLDivElement::attach();
525526}
526527

Source/WebCore/page/Page.cpp

6767#include "ScrollingCoordinator.h"
6868#include "Settings.h"
6969#include "SharedBuffer.h"
70 #include "SpeechInput.h"
71 #include "SpeechInputClient.h"
7270#include "StorageArea.h"
7371#include "StorageNamespace.h"
7472#include "TextResourceDecoder.h"

@@Page::Page(PageClients& pageClients)
137135#if ENABLE(POINTER_LOCK)
138136 , m_pointerLockController(PointerLockController::create(this))
139137#endif
140 #if ENABLE(INPUT_SPEECH)
141  , m_speechInputClient(pageClients.speechInputClient)
142 #endif
143138 , m_settings(Settings::create(this))
144139 , m_progress(ProgressTracker::create())
145140 , m_backForwardController(BackForwardController::create(this, pageClients.backForwardClient))

@@double Page::minimumTimerInterval() const
950945 return m_minimumTimerInterval;
951946}
952947
953 #if ENABLE(INPUT_SPEECH)
954 SpeechInput* Page::speechInput()
955 {
956  ASSERT(m_speechInputClient);
957  if (!m_speechInput.get())
958  m_speechInput = SpeechInput::create(m_speechInputClient);
959  return m_speechInput.get();
960 }
961 #endif
962 
963948void Page::dnsPrefetchingStateChanged()
964949{
965950 for (Frame* frame = mainFrame(); frame; frame = frame->tree()->traverseNext())

@@Page::PageClients::PageClients()
10841069 , dragClient(0)
10851070 , inspectorClient(0)
10861071 , geolocationClient(0)
1087  , speechInputClient(0)
10881072 , notificationClient(0)
10891073{
10901074}

Source/WebCore/page/Page.h

@@namespace WebCore {
8383 class ScrollableArea;
8484 class ScrollingCoordinator;
8585 class Settings;
86  class SpeechInput;
87  class SpeechInputClient;
8886 class StorageNamespace;
8987#if ENABLE(NOTIFICATIONS)
9088 class NotificationPresenter;

@@namespace WebCore {
116114 InspectorClient* inspectorClient;
117115 GeolocationClient* geolocationClient;
118116 RefPtr<BackForwardList> backForwardClient;
119  SpeechInputClient* speechInputClient;
120117 NotificationPresenter* notificationClient;
121118 };
122119

@@namespace WebCore {
184181#if ENABLE(POINTER_LOCK)
185182 PointerLockController* pointerLockController() const { return m_pointerLockController.get(); }
186183#endif
187 #if ENABLE(INPUT_SPEECH)
188  SpeechInput* speechInput();
189 #endif
 184
190185 ScrollingCoordinator* scrollingCoordinator();
191186
192187 Settings* settings() const { return m_settings.get(); }

@@namespace WebCore {
380375#if ENABLE(POINTER_LOCK)
381376 OwnPtr<PointerLockController> m_pointerLockController;
382377#endif
383 #if ENABLE(INPUT_SPEECH)
384  SpeechInputClient* m_speechInputClient;
385  OwnPtr<SpeechInput> m_speechInput;
386 #endif
387378 RefPtr<ScrollingCoordinator> m_scrollingCoordinator;
388379
389380 OwnPtr<Settings> m_settings;

Source/WebCore/page/SpeechInput.cpp

@@void SpeechInput::cancelRecognition(int listenerId)
117117 m_client->cancelRecognition(listenerId);
118118}
119119
 120const AtomicString& SpeechInput::supplementName()
 121{
 122 DEFINE_STATIC_LOCAL(AtomicString, name, ("speechInput"));
 123 return name;
 124}
 125
 126void provideSpeechInputTo(Page* page, SpeechInputClient* client)
 127{
 128 PageSupplement::provideTo(page, SpeechInput::supplementName(), SpeechInput::create(client));
 129}
 130
120131} // namespace WebCore
121132
122133#endif // ENABLE(INPUT_SPEECH)

Source/WebCore/page/SpeechInput.h

3333
3434#if ENABLE(INPUT_SPEECH)
3535
 36#include "PageSupplement.h"
3637#include "SpeechInputListener.h"
3738#include <wtf/Forward.h>
3839#include <wtf/HashMap.h>

@@class SpeechInputListener;
4748// This class connects the input elements requiring speech input with the platform specific
4849// speech recognition engine. It provides methods for the input elements to activate speech
4950// recognition and methods for the speech recognition engine to return back the results.
50 class SpeechInput : public SpeechInputListener {
 51class SpeechInput : public SpeechInputListener,
 52 public PageSupplement {
5153 WTF_MAKE_NONCOPYABLE(SpeechInput);
5254public:
5355 virtual ~SpeechInput();
5456
5557 static PassOwnPtr<SpeechInput> create(SpeechInputClient*);
 58 static const AtomicString& supplementName();
 59 static SpeechInput* from(Frame* frame) { return static_cast<SpeechInput*>(PageSupplement::from(frame, supplementName())); }
 60 static SpeechInput* from(Page* page) { return static_cast<SpeechInput*>(PageSupplement::from(page, supplementName())); }
5661
5762 // Generates a unique ID for the given listener to be used for speech requests.
5863 // This should be the first call made by listeners before anything else.

Source/WebCore/page/SpeechInputClient.h

@@namespace WebCore {
4040class IntRect;
4141class SecurityOrigin;
4242class SpeechInputListener;
 43class Page;
4344
4445// Provides an interface for SpeechInput to call into the embedder.
4546class SpeechInputClient {

@@protected:
6566 virtual ~SpeechInputClient() { }
6667};
6768
 69void provideSpeechInputTo(Page*, SpeechInputClient*);
 70
6871} // namespace WebCore
6972
7073#endif // ENABLE(INPUT_SPEECH)

Source/WebKit/chromium/src/WebViewImpl.cpp

@@WebViewImpl::WebViewImpl(WebViewClient* client)
397397 pageClients.editorClient = &m_editorClientImpl;
398398 pageClients.dragClient = &m_dragClientImpl;
399399 pageClients.inspectorClient = &m_inspectorClientImpl;
400 #if ENABLE(INPUT_SPEECH)
401  pageClients.speechInputClient = m_speechInputClient.get();
402 #endif
403400 pageClients.geolocationClient = m_geolocationClientProxy.get();
404401#if ENABLE(NOTIFICATIONS)
405402 pageClients.notificationClient = notificationPresenterImpl();

@@WebViewImpl::WebViewImpl(WebViewClient* client)
410407#if ENABLE(MEDIA_STREAM)
411408 provideUserMediaTo(m_page.get(), &m_userMediaClientImpl);
412409#endif
 410#if ENABLE(INPUT_SPEECH)
 411 provideSpeechInputTo(m_page.get(), m_speechInputClient.get());
 412#endif
 413
413414 provideDeviceOrientationTo(m_page.get(), m_deviceOrientationClientProxy.get());
414415 m_geolocationClientProxy->setController(m_page->geolocationController());
415416