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.
5 #ifndef WEBKIT_GLUE_WEB_INTENT_DATA_H_
6 #define WEBKIT_GLUE_WEB_INTENT_DATA_H_
11 #include "base/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"
21 namespace webkit_glue
{
23 // Representation of the Web Intent data being initiated or delivered.
24 struct WEBKIT_GLUE_EXPORT WebIntentData
{
25 // The action of the intent.
27 // The MIME type of data in this intent payload.
29 // The serialized representation of the payload data. Wire format is from
30 // WebSerializedScriptValue.
32 // Any extra key-value pair metadata. (Not serialized.)
33 // Deprecated. Will be phased out in M25.
34 std::map
<string16
, string16
> extra_data
;
36 // Set to the service page if this intent data is from an explicit intent
37 // invocation. |service.is_valid()| will be false otherwise.
40 // Any suggested service url the client attached to the intent.
41 std::vector
<GURL
> suggestions
;
43 // String payload data. TODO(gbillock): should this be deprecated?
44 string16 unserialized_data
;
46 // The global message port IDs of any transferred MessagePorts.
47 std::vector
<int> message_port_ids
;
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.
54 // Length of the blob.
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
62 // Store the file system parameters to create a new file system.
63 std::string root_name
;
64 std::string filesystem_id
;
66 // These enum values indicate which payload data type should be used.
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.
74 // Which data payload to use when delivering the intent.
79 // NOTE! Constructors do not initialize message_port_ids. Caller must do this.
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
);
96 // Special copy constructor needed for ListValue support.
97 WebIntentData(const WebIntentData
& intent_data
);
102 void operator=(const WebIntentData
&);
105 } // namespace webkit_glue
107 #endif // WEBKIT_GLUE_WEB_INTENT_DATA_H_