blob: af27768e5418e0715c29c01165745a89f9aefb55 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
// 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/host_message_context.h"
#include "ppapi/host/resource_host.h"
#include "ppapi/proxy/resource_message_params.h"
namespace content {
class RendererPpapiHost;
class RenderViewImpl;
class CONTENT_EXPORT PepperFileChooserHost
: public ppapi::host::ResourceHost,
public base::SupportsWeakPtr<PepperFileChooserHost> {
public:
// Structure to store the information about 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(RendererPpapiHost* host,
PP_Instance instance,
PP_Resource resource);
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 OnShow(ppapi::host::HostMessageContext* context,
bool save_as,
bool open_multiple,
const std::string& suggested_file_name,
const std::vector<std::string>& accept_mime_types);
// Non-owning pointer.
RendererPpapiHost* renderer_ppapi_host_;
ppapi::host::ReplyMessageContext reply_context_;
CompletionHandler* handler_;
DISALLOW_COPY_AND_ASSIGN(PepperFileChooserHost);
};
} // namespace content
#endif // CONTENT_RENDERER_PEPPER_PEPPER_FILE_CHOOSER_HOST_H_
|