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

Side by Side Diff: webkit/glue/web_intent_data.h

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

Powered by Google App Engine
This is Rietveld 408576698