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

Unified Diff: content/renderer/pepper/pepper_file_chooser_host.h

Issue 10544089: Implement the file chooser as a new resource "host" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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
Index: content/renderer/pepper/pepper_file_chooser_host.h
diff --git a/content/renderer/pepper/pepper_file_chooser_host.h b/content/renderer/pepper/pepper_file_chooser_host.h
new file mode 100644
index 0000000000000000000000000000000000000000..402d0d6f1d5a3340057be0557d8f17e41668e9b7
--- /dev/null
+++ b/content/renderer/pepper/pepper_file_chooser_host.h
@@ -0,0 +1,63 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_RENDERER_PEPPER_PEPPER_FILE_CHOOSER_HOST_H_
+#define CONTENT_RENDERER_PEPPER_PEPPER_FILE_CHOOSER_HOST_H_
+
+#include <string>
+#include <vector>
+
+#include "base/basictypes.h"
+#include "base/memory/weak_ptr.h"
+#include "content/common/content_export.h"
+#include "ppapi/host/resource_host.h"
+#include "ppapi/proxy/resource_message_params.h"
+
+class RenderViewImpl;
+
+namespace content {
+
+class CONTENT_EXPORT PepperFileChooserHost
+ : public ppapi::host::ResourceHost,
+ public base::SupportsWeakPtr<PepperFileChooserHost> {
+ public:
+ // Structure to store the information of chosen files.
+ struct ChosenFileInfo {
+ ChosenFileInfo(const std::string& path, const std::string& display_name);
+ std::string path;
+ std::string display_name; // May be empty.
+ };
+
+ PepperFileChooserHost(ppapi::host::PpapiHost* host,
+ PP_Instance instance,
+ PP_Resource resource,
+ RenderViewImpl* render_view);
+ virtual ~PepperFileChooserHost();
+
+ virtual int32_t OnResourceMessageReceived(
+ const IPC::Message& msg,
+ ppapi::host::HostMessageContext* context) OVERRIDE;
+
+ void StoreChosenFiles(const std::vector<ChosenFileInfo>& files);
+
+ private:
+ class CompletionHandler;
+
+ int32_t OnMsgShow(ppapi::host::HostMessageContext* context,
+ bool save_as,
+ bool open_multiple,
+ const std::string& suggested_file_name,
+ const std::vector<std::string>& accept_mime_types);
+
+ RenderViewImpl* render_view_;
+
+ ppapi::proxy::ResourceMessageReplyParams reply_params_;
+ CompletionHandler* handler_;
+
+ DISALLOW_COPY_AND_ASSIGN(PepperFileChooserHost);
+};
+
+} // namespace ppapi
+
+#endif // CONTENT_RENDERER_PEPPER_PEPPER_FILE_CHOOSER_HOST_H_
« no previous file with comments | « content/renderer/pepper/content_renderer_pepper_host_factory.cc ('k') | content/renderer/pepper/pepper_file_chooser_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698