Title: [134560] trunk/Source/WebKit/chromium
Revision
134560
Author
tk...@chromium.org
Date
2012-11-14 00:08:23 -0800 (Wed, 14 Nov 2012)

Log Message

[Chromium] Add API to expose WebCore::DateTimeChooser
https://bugs.webkit.org/show_bug.cgi?id=101196

Reviewed by Hajime Morita.

Add ability to open date/time choosers to WebViewClient.

- ExternalDateTimeChooser forwards DateTimeChooser requests from WebCore
  to WebViewClient, and waits for WebDateTimeChooerCompletion notifications.
- WebDateTimeChooserParams contains various information to create
  chooser UI.
- WebDateTimeChooserCompletion informs value selection by users to
  ExternalDateTimeChooser.

The design is very similar to existing WebFileChooserParams and
WebFileChooserCompletion.

These interfaces are used only if ENABLE_INPUT_MULTIPLE_FIELDS_UI is not
enabled, that is to say, in Chromium-Android port. Non-Android Chromium
ports use DateTimeChooserImpl and WebKit-internal choosers.

* WebKit.gyp: Add WebDateTimeChooserCompletion.h,
WebDateTimeChooserParams.h, ExternalDateTimeChooser.cpp, and
ExternalDateTimeChooser.h.
* public/WebDateTimeChooserCompletion.h: Added.
(WebDateTimeChooserCompletion):
(WebKit::WebDateTimeChooserCompletion::~WebDateTimeChooserCompletion):
* public/WebDateTimeChooserParams.h: Added.
(WebDateTimeChooserParams):
(WebKit::WebDateTimeChooserParams::WebDateTimeChooserParams):
* public/WebViewClient.h:
(WebKit): Add some forward declarations.
(WebKit::WebViewClient::openDateTimeChooser): Added.
* src/ChromeClientImpl.cpp:
(WebKit::ChromeClientImpl::openDateTimeChooser):
Creates ExternalDateTimeChooser if !ENABLE(INPUT_MULTIPLE_FIELDS_UI).
* src/ExternalDateTimeChooser.cpp: Added.
(WebDateTimeChooserCompletionImpl): An implementation of
WebDateTimeChooserCompletion. When didChooseValue or didCancelChooser is
called, it notifies to an ExternalDateTimeChooser and kill itself.
(WebKit::ExternalDateTimeChooser::~ExternalDateTimeChooser): Added.
(WebKit::ExternalDateTimeChooser::ExternalDateTimeChooser): Added.
(WebKit::ExternalDateTimeChooser::create):
Cretes an object, then asks the WebViewClient to open date/time chooser.
If an open request fails, an empty PassRefPtr<> is returned.
We don't ask to open in the constructor because open requests might fail
and it's hard for the constructor to tell the failure.
(WebKit::ExternalDateTimeChooser::openDateTimeChooser): Prepares a
WebDateTimeChooserParams and a WebDateTimeChooserCompletion, calls
WebViewClient::openDateTimeChooser, and kill the
WebDateTimeChooserCompletion if openDateTimeChooser fails.
(WebKit::ExternalDateTimeChooser::didChooseValue):
Called by WebDateTimeChooserCompletion.
We need to check m_client because the requester is already dead.
(WebKit::ExternalDateTimeChooser::didCancelChooser): Ditto.
(WebKit::ExternalDateTimeChooser::endChooser):
Called by the requester when it wants to close the chooser.
We don't close the chooser here, and just disconnect the association of
the client and this object.
* src/ExternalDateTimeChooser.h: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit/chromium/ChangeLog (134559 => 134560)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-11-14 08:04:02 UTC (rev 134559)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-11-14 08:08:23 UTC (rev 134560)
@@ -1,3 +1,66 @@
+2012-11-14  Kent Tamura  <tk...@chromium.org>
+
+        [Chromium] Add API to expose WebCore::DateTimeChooser
+        https://bugs.webkit.org/show_bug.cgi?id=101196
+
+        Reviewed by Hajime Morita.
+
+        Add ability to open date/time choosers to WebViewClient.
+
+        - ExternalDateTimeChooser forwards DateTimeChooser requests from WebCore
+          to WebViewClient, and waits for WebDateTimeChooerCompletion notifications.
+        - WebDateTimeChooserParams contains various information to create
+          chooser UI.
+        - WebDateTimeChooserCompletion informs value selection by users to
+          ExternalDateTimeChooser.
+
+        The design is very similar to existing WebFileChooserParams and
+        WebFileChooserCompletion.
+
+        These interfaces are used only if ENABLE_INPUT_MULTIPLE_FIELDS_UI is not
+        enabled, that is to say, in Chromium-Android port. Non-Android Chromium
+        ports use DateTimeChooserImpl and WebKit-internal choosers.
+
+        * WebKit.gyp: Add WebDateTimeChooserCompletion.h,
+        WebDateTimeChooserParams.h, ExternalDateTimeChooser.cpp, and
+        ExternalDateTimeChooser.h.
+        * public/WebDateTimeChooserCompletion.h: Added.
+        (WebDateTimeChooserCompletion):
+        (WebKit::WebDateTimeChooserCompletion::~WebDateTimeChooserCompletion):
+        * public/WebDateTimeChooserParams.h: Added.
+        (WebDateTimeChooserParams):
+        (WebKit::WebDateTimeChooserParams::WebDateTimeChooserParams):
+        * public/WebViewClient.h:
+        (WebKit): Add some forward declarations.
+        (WebKit::WebViewClient::openDateTimeChooser): Added.
+        * src/ChromeClientImpl.cpp:
+        (WebKit::ChromeClientImpl::openDateTimeChooser):
+        Creates ExternalDateTimeChooser if !ENABLE(INPUT_MULTIPLE_FIELDS_UI).
+        * src/ExternalDateTimeChooser.cpp: Added.
+        (WebDateTimeChooserCompletionImpl): An implementation of
+        WebDateTimeChooserCompletion. When didChooseValue or didCancelChooser is
+        called, it notifies to an ExternalDateTimeChooser and kill itself.
+        (WebKit::ExternalDateTimeChooser::~ExternalDateTimeChooser): Added.
+        (WebKit::ExternalDateTimeChooser::ExternalDateTimeChooser): Added.
+        (WebKit::ExternalDateTimeChooser::create):
+        Cretes an object, then asks the WebViewClient to open date/time chooser.
+        If an open request fails, an empty PassRefPtr<> is returned.
+        We don't ask to open in the constructor because open requests might fail
+        and it's hard for the constructor to tell the failure.
+        (WebKit::ExternalDateTimeChooser::openDateTimeChooser): Prepares a
+        WebDateTimeChooserParams and a WebDateTimeChooserCompletion, calls
+        WebViewClient::openDateTimeChooser, and kill the
+        WebDateTimeChooserCompletion if openDateTimeChooser fails.
+        (WebKit::ExternalDateTimeChooser::didChooseValue):
+        Called by WebDateTimeChooserCompletion.
+        We need to check m_client because the requester is already dead.
+        (WebKit::ExternalDateTimeChooser::didCancelChooser): Ditto.
+        (WebKit::ExternalDateTimeChooser::endChooser):
+        Called by the requester when it wants to close the chooser.
+        We don't close the chooser here, and just disconnect the association of
+        the client and this object.
+        * src/ExternalDateTimeChooser.h: Added.
+
 2012-11-13  Vincent Scheib  <sch...@chromium.org>
 
         Remove RuntimeEnabledFeatures::isPointerLockEnabled.

Modified: trunk/Source/WebKit/chromium/WebKit.gyp (134559 => 134560)


--- trunk/Source/WebKit/chromium/WebKit.gyp	2012-11-14 08:04:02 UTC (rev 134559)
+++ trunk/Source/WebKit/chromium/WebKit.gyp	2012-11-14 08:08:23 UTC (rev 134560)
@@ -130,6 +130,8 @@
                 'public/WebDataSource.h',
                 'public/WebDatabase.h',
                 'public/WebDatabaseObserver.h',
+                'public/WebDateTimeChooserCompletion.h',
+                'public/WebDateTimeChooserParams.h',
                 'public/WebDeliveredIntentClient.h',
                 'public/WebDevToolsAgent.h',
                 'public/WebDevToolsAgentClient.h',
@@ -384,6 +386,8 @@
                 'src/EditorClientImpl.h',
                 'src/EventListenerWrapper.cpp',
                 'src/EventListenerWrapper.h',
+                'src/ExternalDateTimeChooser.cpp',
+                'src/ExternalDateTimeChooser.h',
                 'src/ExternalPopupMenu.cpp',
                 'src/ExternalPopupMenu.h',
                 'src/FindInPageCoordinates.cpp',

Added: trunk/Source/WebKit/chromium/public/WebDateTimeChooserCompletion.h (0 => 134560)


--- trunk/Source/WebKit/chromium/public/WebDateTimeChooserCompletion.h	                        (rev 0)
+++ trunk/Source/WebKit/chromium/public/WebDateTimeChooserCompletion.h	2012-11-14 08:08:23 UTC (rev 134560)
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef WebDateTimeChooserCompletion_h
+#define WebDateTimeChooserCompletion_h
+
+#include "platform/WebString.h"
+
+namespace WebKit {
+
+// Gets called back when WebViewClient finished choosing a date/time value.
+class WebDateTimeChooserCompletion {
+public:
+
+    // Called with a date/time value in the HTML format. The callback instance
+    // is destroyed when this method is called.
+    virtual void didChooseValue(const WebString&) = 0;
+
+    // Called when a user closed the chooser without choosing a value. The
+    // callback instance is destroyed when this method is called.
+    virtual void didCancelChooser() = 0;
+
+protected:
+    virtual ~WebDateTimeChooserCompletion() { }
+};
+
+} // namespace WebKit
+
+#endif

Added: trunk/Source/WebKit/chromium/public/WebDateTimeChooserParams.h (0 => 134560)


--- trunk/Source/WebKit/chromium/public/WebDateTimeChooserParams.h	                        (rev 0)
+++ trunk/Source/WebKit/chromium/public/WebDateTimeChooserParams.h	2012-11-14 08:08:23 UTC (rev 134560)
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef WebDateTimeChooserParams_h
+#define WebDateTimeChooserParams_h
+
+#include "platform/WebRect.h"
+#include "platform/WebString.h"
+#include "platform/WebVector.h"
+
+namespace WebKit {
+
+// This class conveys various information to make date/time chooser UI.
+// See WebViewClient::openDateTimeChooser.
+struct WebDateTimeChooserParams {
+    // Input type string. This is one of "date", "datetime", "datetime-local",
+    // "month", "time", and "week".
+    WebString type;
+    // Bounding rectangle of the requester element.
+    WebRect anchorRectInScreen;
+    // The current value of the requester element.
+    WebString currentValue;
+    // <datalist> option values associated to the requester element. These
+    // values should not be shown to users. The vector size might be 0.
+    WebVector<WebString> suggestionValues;
+    // Localized values of <datalist> options associated to the requester
+    // element. These values should be shown to users. The vector size must be
+    // same as suggestionValues size.
+    WebVector<WebString> localizedSuggestionValues;
+    // <datalist> option labels associated to the requester element. These
+    // values should be shown to users. The vector size must be same as
+    // suggestionValues size.
+    WebVector<WebString> suggestionLabels;
+    // HTMLInputElement::min attribute value parsed in the valusAsNumber rule,
+    // that is to say, milliseconds from the epoch for non-month types and
+    // months from the epoch for month type. If the min attribute is missing,
+    // this field has the hard minimum limit.
+    double minimum;
+    // Similar to minimum.
+    double maximum;
+    // Step value represented in milliseconds for non-month types, and
+    // represetnted in months for month type.
+    double step;
+    // Step-base value represeted in milliseconds, or months.
+    double stepBase;
+    // True if the requester element has required attribute.
+    bool isRequired;
+    // True if the requester element is rendered in rtl direction.
+    bool isAnchorElementRTL;
+
+    WebDateTimeChooserParams()
+        : minimum(0)
+        , maximum(0)
+        , step(0)
+        , stepBase(0)
+        , isRequired(false)
+        , isAnchorElementRTL(false)
+    {
+    }
+};
+
+} // namespace WebKit
+
+#endif

Modified: trunk/Source/WebKit/chromium/public/WebViewClient.h (134559 => 134560)


--- trunk/Source/WebKit/chromium/public/WebViewClient.h	2012-11-14 08:04:02 UTC (rev 134559)
+++ trunk/Source/WebKit/chromium/public/WebViewClient.h	2012-11-14 08:08:23 UTC (rev 134560)
@@ -53,6 +53,7 @@
 class WebColorChooser;
 class WebColorChooserClient;
 class WebCompositorOutputSurface;
+class WebDateTimeChooserCompletion;
 class WebDeviceOrientationClient;
 class WebDragData;
 class WebElement;
@@ -83,6 +84,7 @@
 class WebWidget;
 struct WebConsoleMessage;
 struct WebContextMenuData;
+struct WebDateTimeChooserParams;
 struct WebPoint;
 struct WebPopupMenuInfo;
 struct WebRect;
@@ -222,6 +224,13 @@
     virtual bool runFileChooser(const WebFileChooserParams&,
                                 WebFileChooserCompletion*) { return false; }
 
+    // Ask users to choose date/time for the specified parameters. When a user
+    // chooses a value, an implemenattion of this function should call
+    // WebDateTimeChooserCompletion::didChooseValue or didCancelChooser. If the
+    // implementation opened date/time chooser UI successfully, it should return
+    // true. This function is used only if ExternalDateTimeChooser is used.
+    virtual bool openDateTimeChooser(const WebDateTimeChooserParams&, WebDateTimeChooserCompletion*) { return false; }
+
     // Displays a modal alert dialog containing the given message.  Returns
     // once the user dismisses the dialog.
     virtual void runModalAlertDialog(

Modified: trunk/Source/WebKit/chromium/src/ChromeClientImpl.cpp (134559 => 134560)


--- trunk/Source/WebKit/chromium/src/ChromeClientImpl.cpp	2012-11-14 08:04:02 UTC (rev 134559)
+++ trunk/Source/WebKit/chromium/src/ChromeClientImpl.cpp	2012-11-14 08:08:23 UTC (rev 134560)
@@ -46,6 +46,7 @@
 #include "DateTimeChooserImpl.h"
 #include "Document.h"
 #include "DocumentLoader.h"
+#include "ExternalDateTimeChooser.h"
 #include "ExternalPopupMenu.h"
 #include "FileChooser.h"
 #include "FileIconLoader.h"
@@ -692,8 +693,7 @@
 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
     return DateTimeChooserImpl::create(this, pickerClient, parameters);
 #else
-    notImplemented();
-    return PassRefPtr<DateTimeChooser>();
+    return ExternalDateTimeChooser::create(this, m_webView->client(), pickerClient, parameters);
 #endif
 }
 #endif

Added: trunk/Source/WebKit/chromium/src/ExternalDateTimeChooser.cpp (0 => 134560)


--- trunk/Source/WebKit/chromium/src/ExternalDateTimeChooser.cpp	                        (rev 0)
+++ trunk/Source/WebKit/chromium/src/ExternalDateTimeChooser.cpp	2012-11-14 08:08:23 UTC (rev 134560)
@@ -0,0 +1,137 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "config.h"
+#if ENABLE(DATE_AND_TIME_INPUT_TYPES) && !ENABLE(INPUT_MULTIPLE_FIELDS_UI)
+#include "ExternalDateTimeChooser.h"
+
+#include "ChromeClientImpl.h"
+#include "DateTimeChooserClient.h"
+#include "WebDateTimeChooserCompletion.h"
+#include "WebDateTimeChooserParams.h"
+#include "WebViewClient.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+class WebDateTimeChooserCompletionImpl : public WebDateTimeChooserCompletion {
+public:
+    WebDateTimeChooserCompletionImpl(ExternalDateTimeChooser* chooser)
+        : m_chooser(chooser)
+    {
+    }
+
+private:
+    virtual void didChooseValue(const WebString& value) OVERRIDE
+    {
+        m_chooser->didChooseValue(value);
+        delete this;
+    }
+
+    virtual void didCancelChooser() OVERRIDE
+    {
+        m_chooser->didCancelChooser();
+        delete this;
+    }
+
+    RefPtr<ExternalDateTimeChooser> m_chooser;
+};
+
+ExternalDateTimeChooser::~ExternalDateTimeChooser()
+{
+}
+
+ExternalDateTimeChooser::ExternalDateTimeChooser(WebCore::DateTimeChooserClient* client)
+    : m_client(client)
+{
+    ASSERT(client);
+}
+
+PassRefPtr<ExternalDateTimeChooser> ExternalDateTimeChooser::create(ChromeClientImpl* chromeClient, WebViewClient* webViewClient, WebCore::DateTimeChooserClient* client, const WebCore::DateTimeChooserParameters& parameters)
+{
+    ASSERT(chromeClient);
+    RefPtr<ExternalDateTimeChooser> chooser = adoptRef(new ExternalDateTimeChooser(client));
+    if (!chooser->openDateTimeChooser(chromeClient, webViewClient, parameters))
+        chooser.clear();
+    return chooser.release();
+}
+
+bool ExternalDateTimeChooser::openDateTimeChooser(ChromeClientImpl* chromeClient, WebViewClient* webViewClient, const DateTimeChooserParameters& parameters)
+{
+    if (!webViewClient)
+        return false;
+
+    WebDateTimeChooserParams webParams;
+    webParams.type = parameters.type;
+    webParams.anchorRectInScreen = chromeClient->rootViewToScreen(parameters.anchorRectInRootView);
+    webParams.currentValue = parameters.currentValue;
+    webParams.suggestionValues = parameters.suggestionValues;
+    webParams.localizedSuggestionValues = parameters.localizedSuggestionValues;
+    webParams.suggestionLabels = parameters.suggestionLabels;
+    webParams.minimum = parameters.minimum;
+    webParams.maximum = parameters.maximum;
+    webParams.step = parameters.step;
+    webParams.stepBase = parameters.stepBase;
+    webParams.isRequired = parameters.required;
+    webParams.isAnchorElementRTL = parameters.isAnchorElementRTL;
+
+    WebDateTimeChooserCompletion* completion = new WebDateTimeChooserCompletionImpl(this);
+    if (webViewClient->openDateTimeChooser(webParams, completion))
+        return true;
+    // We can't open a chooser. Calling
+    // WebDateTimeChooserCompletionImpl::didCancelChooser to delete the
+    // WebDateTimeChooserCompletionImpl object and deref this.
+    completion->didCancelChooser();
+    return false;
+}
+
+void ExternalDateTimeChooser::didChooseValue(const WebString& value)
+{
+    if (m_client)
+        m_client->didChooseValue(value);
+    // didChooseValue might run _javascript_ code, and endChooser() might be
+    // called. However DateTimeChooserCompletionImpl still has one reference to
+    // this object.
+    if (m_client)
+        m_client->didEndChooser();
+}
+
+void ExternalDateTimeChooser::didCancelChooser()
+{
+    if (m_client)
+        m_client->didEndChooser();
+}
+
+void ExternalDateTimeChooser::endChooser()
+{
+    DateTimeChooserClient* client = m_client;
+    m_client = 0;
+    client->didEndChooser();
+}
+
+}
+
+#endif

Added: trunk/Source/WebKit/chromium/src/ExternalDateTimeChooser.h (0 => 134560)


--- trunk/Source/WebKit/chromium/src/ExternalDateTimeChooser.h	                        (rev 0)
+++ trunk/Source/WebKit/chromium/src/ExternalDateTimeChooser.h	2012-11-14 08:08:23 UTC (rev 134560)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef ExternalDateTimeChooser_h
+#define ExternalDateTimeChooser_h
+
+#if ENABLE(DATE_AND_TIME_INPUT_TYPES) && !ENABLE(INPUT_MULTIPLE_FIELDS_UI)
+#include "DateTimeChooser.h"
+
+namespace WebCore {
+class DateTimeChooserClient;
+}
+
+namespace WebKit {
+
+class ChromeClientImpl;
+class WebString;
+class WebViewClient;
+
+class ExternalDateTimeChooser : public WebCore::DateTimeChooser {
+public:
+    static PassRefPtr<ExternalDateTimeChooser> create(ChromeClientImpl*, WebViewClient*, WebCore::DateTimeChooserClient*, const WebCore::DateTimeChooserParameters&);
+    virtual ~ExternalDateTimeChooser();
+
+    // The following functions are for DateTimeChooserCompletion.
+    void didChooseValue(const WebString&);
+    void didCancelChooser();
+
+private:
+    ExternalDateTimeChooser(WebCore::DateTimeChooserClient*);
+    bool openDateTimeChooser(ChromeClientImpl*, WebViewClient*, const WebCore::DateTimeChooserParameters&);
+
+    // DateTimeChooer function:
+    virtual void endChooser() OVERRIDE;
+
+    WebCore::DateTimeChooserClient* m_client;
+};
+
+}
+#endif
+
+#endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to