OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef WEBKIT_GLUE_WEB_INTENT_DATA_H_ | |
6 #define WEBKIT_GLUE_WEB_INTENT_DATA_H_ | |
7 | |
8 #include <map> | |
9 #include <vector> | |
10 | |
11 #include "base/files/file_path.h" | |
12 #include "base/string16.h" | |
13 #include "base/values.h" | |
14 #include "googleurl/src/gurl.h" | |
15 #include "webkit/glue/webkit_glue_export.h" | |
16 | |
17 namespace WebKit { | |
18 class WebIntent; | |
19 } | |
20 | |
21 namespace webkit_glue { | |
22 | |
23 // Representation of the Web Intent data being initiated or delivered. | |
24 struct WEBKIT_GLUE_EXPORT WebIntentData { | |
25 // The action of the intent. | |
26 string16 action; | |
27 // The MIME type of data in this intent payload. | |
28 string16 type; | |
29 // The serialized representation of the payload data. Wire format is from | |
30 // WebSerializedScriptValue. | |
31 string16 data; | |
32 // Any extra key-value pair metadata. (Not serialized.) | |
33 // Deprecated. Will be phased out in M25. | |
34 std::map<string16, string16> extra_data; | |
35 | |
36 // Set to the service page if this intent data is from an explicit intent | |
37 // invocation. |service.is_valid()| will be false otherwise. | |
38 GURL service; | |
39 | |
40 // Any suggested service url the client attached to the intent. | |
41 std::vector<GURL> suggestions; | |
42 | |
43 // String payload data. TODO(gbillock): should this be deprecated? | |
44 string16 unserialized_data; | |
45 | |
46 // The global message port IDs of any transferred MessagePorts. | |
47 std::vector<int> message_port_ids; | |
48 | |
49 // The file of a payload blob. Together with |blob_length|, suitable | |
50 // arguments to WebBlob::createFromFile. Note: when mime_data has | |
51 // length==1, this blob will be set as the 'blob' member of the first | |
52 // object in the delivered data payload. | |
53 base::FilePath blob_file; | |
54 // Length of the blob. | |
55 int64 blob_length; | |
56 | |
57 // List of values to be passed as MIME data. These will be encoded as a | |
58 // serialized sequence of objects when delivered. Must contain | |
59 // DictionaryValues. | |
60 ListValue mime_data; | |
61 | |
62 // Store the file system parameters to create a new file system. | |
63 std::string root_name; | |
64 std::string filesystem_id; | |
65 | |
66 // These enum values indicate which payload data type should be used. | |
67 enum DataType { | |
68 SERIALIZED = 0, // The payload is serialized in |data|. | |
69 UNSERIALIZED = 1, // The payload is unserialized in |unserialized_data|. | |
70 BLOB = 2, // The payload is a blob. | |
71 FILESYSTEM = 3, // The payload is WebFileSystem. | |
72 MIME_TYPE = 4, // The payload is a MIME type. | |
73 }; | |
74 // Which data payload to use when delivering the intent. | |
75 DataType data_type; | |
76 | |
77 WebIntentData(); | |
78 | |
79 // NOTE! Constructors do not initialize message_port_ids. Caller must do this. | |
80 | |
81 WebIntentData(const WebKit::WebIntent& intent); | |
82 WebIntentData(const string16& action_in, | |
83 const string16& type_in); | |
84 WebIntentData(const string16& action_in, | |
85 const string16& type_in, | |
86 const string16& unserialized_data_in); | |
87 WebIntentData(const string16& action_in, | |
88 const string16& type_in, | |
89 const FilePath& blob_file_in, | |
90 int64 blob_length_in); | |
91 WebIntentData(const string16& action_in, | |
92 const string16& type_in, | |
93 const std::string& root_name_in, | |
94 const std::string& filesystem_id_in); | |
95 | |
96 // Special copy constructor needed for ListValue support. | |
97 WebIntentData(const WebIntentData& intent_data); | |
98 | |
99 ~WebIntentData(); | |
100 | |
101 private: | |
102 void operator=(const WebIntentData&); | |
103 }; | |
104 | |
105 } // namespace webkit_glue | |
106 | |
107 #endif // WEBKIT_GLUE_WEB_INTENT_DATA_H_ | |
OLD | NEW |