Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1945)

Unified Diff: content/renderer/render_view.cc

Issue 6623015: Add a path for a web page to request the enumeration of a directory. This, t... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/render_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_view.cc
===================================================================
--- content/renderer/render_view.cc (revision 79702)
+++ content/renderer/render_view.cc (working copy)
@@ -1025,6 +1025,8 @@
IPC_MESSAGE_HANDLER(ViewMsg_InstallMissingPlugin, OnInstallMissingPlugin)
IPC_MESSAGE_HANDLER(ViewMsg_DisplayPrerenderedPage,
OnDisplayPrerenderedPage)
+ IPC_MESSAGE_HANDLER(ViewMsg_EnumerateDirectoryResponse,
+ OnEnumerateDirectoryResponse)
IPC_MESSAGE_HANDLER(ViewMsg_RunFileChooserResponse, OnFileChooserResponse)
IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode)
IPC_MESSAGE_HANDLER(ViewMsg_GetAllSavableResourceLinksForCurrentPage,
@@ -2313,6 +2315,17 @@
return ScheduleFileChooser(ipc_params, chooser_completion);
}
+bool RenderView::enumerateDirectory(
+ const WebString& path,
+ WebFileChooserCompletion* chooser_completion) {
+ int id = enumeration_completion_id_++;
+ enumeration_completions_[id] = chooser_completion;
+ return Send(new ViewHostMsg_EnumerateDirectory(
+ routing_id_,
+ id,
+ webkit_glue::WebStringToFilePath(path)));
+}
+
void RenderView::runModalAlertDialog(
WebFrame* frame, const WebString& message) {
RunJavaScriptMessage(ui::MessageBoxFlags::kIsJavascriptAlert,
@@ -4457,6 +4470,20 @@
}
}
+void RenderView::OnEnumerateDirectoryResponse(
+ int id,
+ const std::vector<FilePath>& paths) {
+ if (!enumeration_completions_[id])
+ return;
+
+ WebVector<WebString> ws_file_names(paths.size());
+ for (size_t i = 0; i < paths.size(); ++i)
+ ws_file_names[i] = webkit_glue::FilePathToWebString(paths[i]);
+
+ enumeration_completions_[id]->didChooseFile(ws_file_names);
+ enumeration_completions_.erase(id);
+}
+
void RenderView::OnFileChooserResponse(const std::vector<FilePath>& paths) {
// This could happen if we navigated to a different page before the user
// closed the chooser.
« no previous file with comments | « content/renderer/render_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698