https://bugs.webkit.org/show_bug.cgi?id=79051
Source/WebCore:
Turned SpeechInput to a PageSupplement.
Reviewed by Adam Barth.
No new tests. No behavior change.
* html/shadow/TextControlInnerElements.cpp:
(WebCore::InputFieldSpeechButtonElement::speechInput):
(WebCore::InputFieldSpeechButtonElement::attach):
* page/Page.cpp:
(WebCore::Page::Page):
(WebCore::Page::PageClients::PageClients):
* page/Page.h:
(WebCore):
(PageClients):
(Page):
* page/SpeechInput.cpp:
(WebCore::SpeechInput::supplementName):
(WebCore):
(WebCore::provideSpeechInputTo):
* page/SpeechInput.h:
(SpeechInput):
(WebCore::SpeechInput::from):
* page/SpeechInputClient.h:
(WebCore):
Source/WebKit/chromium:
Reviewed by Adam Barth.
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::WebViewImpl):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@108446
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-02-21 MORITA Hajime <morrita@google.com>
+
+ INPUT_SPEECH should be implemented as a PageSupplement.
+ https://bugs.webkit.org/show_bug.cgi?id=79051
+
+ Turned SpeechInput to a PageSupplement.
+
+ Reviewed by Adam Barth.
+
+ No new tests. No behavior change.
+
+ * html/shadow/TextControlInnerElements.cpp:
+ (WebCore::InputFieldSpeechButtonElement::speechInput):
+ (WebCore::InputFieldSpeechButtonElement::attach):
+ * page/Page.cpp:
+ (WebCore::Page::Page):
+ (WebCore::Page::PageClients::PageClients):
+ * page/Page.h:
+ (WebCore):
+ (PageClients):
+ (Page):
+ * page/SpeechInput.cpp:
+ (WebCore::SpeechInput::supplementName):
+ (WebCore):
+ (WebCore::provideSpeechInputTo):
+ * page/SpeechInput.h:
+ (SpeechInput):
+ (WebCore::SpeechInput::from):
+ * page/SpeechInputClient.h:
+ (WebCore):
+
2012-02-21 Alexandre Elias <aelias@google.com>
[chromium] Add three small zoom gesture features
SpeechInput* InputFieldSpeechButtonElement::speechInput()
{
- return document()->page() ? document()->page()->speechInput() : 0;
+ return SpeechInput::from(document()->page());
}
void InputFieldSpeechButtonElement::didCompleteRecording(int)
void InputFieldSpeechButtonElement::attach()
{
ASSERT(!m_listenerId);
- m_listenerId = document()->page()->speechInput()->registerListener(this);
+ if (SpeechInput* input = SpeechInput::from(document()->page()))
+ m_listenerId = input->registerListener(this);
HTMLDivElement::attach();
}
#include "ScrollingCoordinator.h"
#include "Settings.h"
#include "SharedBuffer.h"
-#include "SpeechInput.h"
-#include "SpeechInputClient.h"
#include "StorageArea.h"
#include "StorageNamespace.h"
#include "TextResourceDecoder.h"
#if ENABLE(POINTER_LOCK)
, m_pointerLockController(PointerLockController::create(this))
#endif
-#if ENABLE(INPUT_SPEECH)
- , m_speechInputClient(pageClients.speechInputClient)
-#endif
, m_settings(Settings::create(this))
, m_progress(ProgressTracker::create())
, m_backForwardController(BackForwardController::create(this, pageClients.backForwardClient))
return m_minimumTimerInterval;
}
-#if ENABLE(INPUT_SPEECH)
-SpeechInput* Page::speechInput()
-{
- ASSERT(m_speechInputClient);
- if (!m_speechInput.get())
- m_speechInput = SpeechInput::create(m_speechInputClient);
- return m_speechInput.get();
-}
-#endif
-
void Page::dnsPrefetchingStateChanged()
{
for (Frame* frame = mainFrame(); frame; frame = frame->tree()->traverseNext())
, dragClient(0)
, inspectorClient(0)
, geolocationClient(0)
- , speechInputClient(0)
, notificationClient(0)
{
}
class ScrollableArea;
class ScrollingCoordinator;
class Settings;
- class SpeechInput;
- class SpeechInputClient;
class StorageNamespace;
#if ENABLE(NOTIFICATIONS)
class NotificationPresenter;
InspectorClient* inspectorClient;
GeolocationClient* geolocationClient;
RefPtr<BackForwardList> backForwardClient;
- SpeechInputClient* speechInputClient;
NotificationPresenter* notificationClient;
};
#if ENABLE(POINTER_LOCK)
PointerLockController* pointerLockController() const { return m_pointerLockController.get(); }
#endif
-#if ENABLE(INPUT_SPEECH)
- SpeechInput* speechInput();
-#endif
+
ScrollingCoordinator* scrollingCoordinator();
Settings* settings() const { return m_settings.get(); }
#if ENABLE(POINTER_LOCK)
OwnPtr<PointerLockController> m_pointerLockController;
#endif
-#if ENABLE(INPUT_SPEECH)
- SpeechInputClient* m_speechInputClient;
- OwnPtr<SpeechInput> m_speechInput;
-#endif
RefPtr<ScrollingCoordinator> m_scrollingCoordinator;
OwnPtr<Settings> m_settings;
m_client->cancelRecognition(listenerId);
}
+const AtomicString& SpeechInput::supplementName()
+{
+ DEFINE_STATIC_LOCAL(AtomicString, name, ("SpeechInput"));
+ return name;
+}
+
+void provideSpeechInputTo(Page* page, SpeechInputClient* client)
+{
+ PageSupplement::provideTo(page, SpeechInput::supplementName(), SpeechInput::create(client));
+}
+
} // namespace WebCore
#endif // ENABLE(INPUT_SPEECH)
#if ENABLE(INPUT_SPEECH)
+#include "PageSupplement.h"
#include "SpeechInputListener.h"
#include <wtf/Forward.h>
#include <wtf/HashMap.h>
// This class connects the input elements requiring speech input with the platform specific
// speech recognition engine. It provides methods for the input elements to activate speech
// recognition and methods for the speech recognition engine to return back the results.
-class SpeechInput : public SpeechInputListener {
+class SpeechInput : public SpeechInputListener,
+ public PageSupplement {
WTF_MAKE_NONCOPYABLE(SpeechInput);
public:
virtual ~SpeechInput();
static PassOwnPtr<SpeechInput> create(SpeechInputClient*);
+ static const AtomicString& supplementName();
+ static SpeechInput* from(Frame* frame) { return static_cast<SpeechInput*>(PageSupplement::from(frame, supplementName())); }
+ static SpeechInput* from(Page* page) { return static_cast<SpeechInput*>(PageSupplement::from(page, supplementName())); }
// Generates a unique ID for the given listener to be used for speech requests.
// This should be the first call made by listeners before anything else.
class IntRect;
class SecurityOrigin;
class SpeechInputListener;
+class Page;
// Provides an interface for SpeechInput to call into the embedder.
class SpeechInputClient {
virtual ~SpeechInputClient() { }
};
+void provideSpeechInputTo(Page*, SpeechInputClient*);
+
} // namespace WebCore
#endif // ENABLE(INPUT_SPEECH)
+2012-02-21 MORITA Hajime <morrita@google.com>
+
+ INPUT_SPEECH should be implemented as a PageSupplement.
+ https://bugs.webkit.org/show_bug.cgi?id=79051
+
+ Reviewed by Adam Barth.
+
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::WebViewImpl):
+
2012-02-20 MORITA Hajime <morrita@google.com>
MEDIA_STREAM should be implemented as a PageSupplement.
pageClients.editorClient = &m_editorClientImpl;
pageClients.dragClient = &m_dragClientImpl;
pageClients.inspectorClient = &m_inspectorClientImpl;
-#if ENABLE(INPUT_SPEECH)
- pageClients.speechInputClient = m_speechInputClient.get();
-#endif
pageClients.geolocationClient = m_geolocationClientProxy.get();
#if ENABLE(NOTIFICATIONS)
pageClients.notificationClient = notificationPresenterImpl();
#if ENABLE(MEDIA_STREAM)
provideUserMediaTo(m_page.get(), &m_userMediaClientImpl);
#endif
+#if ENABLE(INPUT_SPEECH)
+ provideSpeechInputTo(m_page.get(), m_speechInputClient.get());
+#endif
+
provideDeviceOrientationTo(m_page.get(), m_deviceOrientationClientProxy.get());
m_geolocationClientProxy->setController(m_page->geolocationController());