Title: [97421] trunk/Source/WebKit/efl
Revision
97421
Author
[email protected]
Date
2011-10-13 16:37:35 -0700 (Thu, 13 Oct 2011)

Log Message

[EFL]: Move from FileChooserSettings deprecatedAcceptType to acceptMIMETypes
https://bugs.webkit.org/show_bug.cgi?id=70002

Patch by Raphael Kubo da Costa <[email protected]> on 2011-10-13
Reviewed by Joseph Pecoraro.

Adapt to the changes introduced in r97336 and r97338 by using a vector
of strings instead of a single string in runOpenPanel().

* WebCoreSupport/ChromeClientEfl.cpp:
(WebCore::ChromeClientEfl::runOpenPanel):
* ewk/ewk_private.h:
* ewk/ewk_view.cpp:
(ewk_view_run_open_panel): Change signature; accept a Vector<String>
instead of a char*. Build an Eina_List to pass for child classes.
* ewk/ewk_view.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit/efl/ChangeLog (97420 => 97421)


--- trunk/Source/WebKit/efl/ChangeLog	2011-10-13 23:22:53 UTC (rev 97420)
+++ trunk/Source/WebKit/efl/ChangeLog	2011-10-13 23:37:35 UTC (rev 97421)
@@ -1,3 +1,21 @@
+2011-10-13  Raphael Kubo da Costa  <[email protected]>
+
+        [EFL]: Move from FileChooserSettings deprecatedAcceptType to acceptMIMETypes
+        https://bugs.webkit.org/show_bug.cgi?id=70002
+
+        Reviewed by Joseph Pecoraro.
+
+        Adapt to the changes introduced in r97336 and r97338 by using a vector
+        of strings instead of a single string in runOpenPanel().
+
+        * WebCoreSupport/ChromeClientEfl.cpp:
+        (WebCore::ChromeClientEfl::runOpenPanel):
+        * ewk/ewk_private.h:
+        * ewk/ewk_view.cpp:
+        (ewk_view_run_open_panel): Change signature; accept a Vector<String>
+        instead of a char*. Build an Eina_List to pass for child classes.
+        * ewk/ewk_view.h:
+
 2011-10-13  Leandro Pereira  <[email protected]>
 
         Unreviewed; revert some changes introduced in r97329 which are

Modified: trunk/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp (97420 => 97421)


--- trunk/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp	2011-10-13 23:22:53 UTC (rev 97420)
+++ trunk/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp	2011-10-13 23:37:35 UTC (rev 97421)
@@ -428,13 +428,12 @@
 void ChromeClientEfl::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> prpFileChooser)
 {
     RefPtr<FileChooser> chooser = prpFileChooser;
-    bool confirm;
     Eina_List* selectedFilenames = 0;
     void* filename;
     Vector<String> filenames;
 
-    CString accept = chooser->settings().deprecatedAcceptTypes.utf8();
-    confirm = ewk_view_run_open_panel(m_view, kit(frame), chooser->settings().allowsMultipleFiles, accept.data(), &selectedFilenames);
+    const FileChooserSettings& settings = chooser->settings();
+    bool confirm = ewk_view_run_open_panel(m_view, kit(frame), settings.allowsMultipleFiles, settings.acceptMIMETypes, &selectedFilenames);
 
     if (!confirm)
         return;

Modified: trunk/Source/WebKit/efl/ewk/ewk_private.h (97420 => 97421)


--- trunk/Source/WebKit/efl/ewk/ewk_private.h	2011-10-13 23:22:53 UTC (rev 97420)
+++ trunk/Source/WebKit/efl/ewk/ewk_private.h	2011-10-13 23:37:35 UTC (rev 97421)
@@ -121,7 +121,7 @@
 Eina_Bool ewk_view_should_interrupt_javascript(Evas_Object* o);
 uint64_t ewk_view_exceeded_database_quota(Evas_Object* o, Evas_Object* frame, const char* databaseName, uint64_t current_size, uint64_t expected_size);
 
-Eina_Bool ewk_view_run_open_panel(Evas_Object* o, Evas_Object* frame, Eina_Bool allows_multiple_files, const char* accept_types, Eina_List** selected_filenames);
+Eina_Bool ewk_view_run_open_panel(Evas_Object* ewkView, Evas_Object* frame, bool allowsMultipleFiles, const Vector<String>& acceptMIMETypes, Eina_List** selectedFilenames);
 
 void ewk_view_repaint(Evas_Object* o, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h);
 void ewk_view_scroll(Evas_Object* o, Evas_Coord dx, Evas_Coord dy, Evas_Coord sx, Evas_Coord sy, Evas_Coord sw, Evas_Coord sh, Evas_Coord cx, Evas_Coord cy, Evas_Coord cw, Evas_Coord ch, Eina_Bool main_frame);

Modified: trunk/Source/WebKit/efl/ewk/ewk_view.cpp (97420 => 97421)


--- trunk/Source/WebKit/efl/ewk/ewk_view.cpp	2011-10-13 23:22:53 UTC (rev 97420)
+++ trunk/Source/WebKit/efl/ewk/ewk_view.cpp	2011-10-13 23:37:35 UTC (rev 97421)
@@ -3253,30 +3253,37 @@
  * @internal
  * Open panel to choose a file.
  *
- * @param o View.
+ * @param ewkView View.
  * @param frame Frame in which operation is required.
- * @param allows_multiple_files @c EINA_TRUE when more than one file may be
- * selected, @c EINA_FALSE otherwise
- * @param accept_types accept mime types
- * @selected_filenames List of files selected.
+ * @param allowsMultipleFiles @c true when more than one file may be selected, @c false otherwise.
+ * @param acceptMIMETypes List of accepted mime types. It is passed to child objects as an Eina_List of char pointers that is freed automatically.
+ * @param selectedFilenames List of files selected.
  *
  * @return @EINA_FALSE if user canceled file selection; @EINA_TRUE if confirmed.
  */
-Eina_Bool ewk_view_run_open_panel(Evas_Object* ewkView, Evas_Object* frame, Eina_Bool allowsMultipleFiles, const char* acceptTypes, Eina_List** selectedFilenames)
+Eina_Bool ewk_view_run_open_panel(Evas_Object* ewkView, Evas_Object* frame, bool allowsMultipleFiles, const WTF::Vector<WTF::String>& acceptMIMETypes, Eina_List** selectedFilenames)
 {
     DBG("ewkView=%p frame=%p allows_multiple_files=%d", ewkView, frame, allowsMultipleFiles);
     EWK_VIEW_SD_GET_OR_RETURN(ewkView, sd, EINA_FALSE);
     EINA_SAFETY_ON_NULL_RETURN_VAL(sd->api, EINA_FALSE);
-    Eina_Bool confirm;
 
     if (!sd->api->run_open_panel)
         return EINA_FALSE;
 
     *selectedFilenames = 0;
 
-    confirm = sd->api->run_open_panel(sd, frame, allowsMultipleFiles, acceptTypes, selectedFilenames);
+    Eina_List* cAcceptMIMETypes = 0;
+    for (WTF::Vector<WTF::String>::const_iterator it = acceptMIMETypes.begin(); it != acceptMIMETypes.end(); ++it)
+        cAcceptMIMETypes = eina_list_append(cAcceptMIMETypes, strdup((*it).utf8().data()));
+
+    bool confirm = sd->api->run_open_panel(sd, frame, allowsMultipleFiles, cAcceptMIMETypes, selectedFilenames);
     if (!confirm && *selectedFilenames)
         ERR("Canceled file selection, but selected filenames != 0. Free names before return.");
+
+    void* item = 0;
+    EINA_LIST_FREE(cAcceptMIMETypes, item)
+        free(item);
+
     return confirm;
 }
 

Modified: trunk/Source/WebKit/efl/ewk/ewk_view.h (97420 => 97421)


--- trunk/Source/WebKit/efl/ewk/ewk_view.h	2011-10-13 23:22:53 UTC (rev 97420)
+++ trunk/Source/WebKit/efl/ewk/ewk_view.h	2011-10-13 23:37:35 UTC (rev 97421)
@@ -156,7 +156,7 @@
     Eina_Bool (*should_interrupt_javascript)(Ewk_View_Smart_Data *sd);
     uint64_t (*exceeded_database_quota)(Ewk_View_Smart_Data *sd, Evas_Object *frame, const char *databaseName, uint64_t current_size, uint64_t expected_size);
 
-    Eina_Bool (*run_open_panel)(Ewk_View_Smart_Data *sd, Evas_Object *frame, Eina_Bool allows_multiple_files, const char *accept_types, Eina_List **selected_filenames);
+    Eina_Bool (*run_open_panel)(Ewk_View_Smart_Data *sd, Evas_Object *frame, Eina_Bool allows_multiple_files, Eina_List *accept_types, Eina_List **selected_filenames);
 
     Eina_Bool (*navigation_policy_decision)(Ewk_View_Smart_Data *sd, Ewk_Frame_Resource_Request *request);
     Eina_Bool (*focus_can_cycle)(Ewk_View_Smart_Data *sd, Ewk_Focus_Direction direction);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to