OLD | NEW |
---|---|
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 #include "webkit/glue/web_intent_data.h" | 5 #include "webkit/glue/web_intent_data.h" |
6 | 6 |
7 #include "content/common/webmessageportchannel_impl.h" | |
7 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIntent.h" | 8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIntent.h" |
9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMessagePortChannel .h" | |
10 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | |
11 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" | |
8 | 12 |
9 namespace webkit_glue { | 13 namespace webkit_glue { |
10 | 14 |
11 WebIntentData::WebIntentData() | 15 WebIntentData::WebIntentData() |
12 : blob_length(0), | 16 : blob_length(0), |
13 data_type(SERIALIZED) { | 17 data_type(SERIALIZED) { |
14 } | 18 } |
15 | 19 |
16 WebIntentData::~WebIntentData() { | 20 WebIntentData::~WebIntentData() { |
17 } | 21 } |
18 | 22 |
19 WebIntentData::WebIntentData(const WebKit::WebIntent& intent) | 23 WebIntentData::WebIntentData(const WebKit::WebIntent& intent) |
20 : action(intent.action()), | 24 : action(intent.action()), |
21 type(intent.type()), | 25 type(intent.type()), |
22 data(intent.data()), | 26 data(intent.data()), |
27 service(intent.service()), | |
23 blob_length(0), | 28 blob_length(0), |
24 data_type(SERIALIZED) { | 29 data_type(SERIALIZED) { |
30 WebKit::WebVector<WebKit::WebString> names = intent.extrasNames(); | |
darin (slow to review)
2012/04/30 18:31:25
it would help to get someone more familiar with Me
Greg Billock
2012/04/30 23:09:34
Sounds good. Should I split this off for separate
| |
31 for (size_t i = 0; i < names.size(); ++i) { | |
32 extra_data[names[i]] = intent.extrasValue(names[i]); | |
33 } | |
34 | |
35 // See WebMessagePortChannelImpl::postMessage() and ::OnMessagedQueued() | |
36 WebKit::WebMessagePortChannelArray* channels = | |
37 intent.messagePortChannelsRelease(); | |
38 if (channels) { | |
39 for (size_t i = 0; i < channels->size(); ++i) { | |
40 WebMessagePortChannelImpl* webchannel = | |
41 static_cast<WebMessagePortChannelImpl*>((*channels)[i]); | |
42 message_port_ids.push_back(webchannel->message_port_id()); | |
43 webchannel->QueueMessages(); // needed? | |
jam
2012/05/01 19:00:48
I don't quite remember why we needed this (it's be
| |
44 DCHECK(message_port_ids[i] != MSG_ROUTING_NONE); | |
45 } | |
46 delete channels; | |
47 } | |
25 } | 48 } |
26 | 49 |
27 WebIntentData::WebIntentData(const string16& action_in, | 50 WebIntentData::WebIntentData(const string16& action_in, |
28 const string16& type_in, | 51 const string16& type_in, |
29 const string16& unserialized_data_in) | 52 const string16& unserialized_data_in) |
30 : action(action_in), | 53 : action(action_in), |
31 type(type_in), | 54 type(type_in), |
32 unserialized_data(unserialized_data_in), | 55 unserialized_data(unserialized_data_in), |
33 blob_length(0), | 56 blob_length(0), |
34 data_type(UNSERIALIZED) { | 57 data_type(UNSERIALIZED) { |
35 } | 58 } |
36 | 59 |
37 WebIntentData::WebIntentData(const string16& action_in, | 60 WebIntentData::WebIntentData(const string16& action_in, |
38 const string16& type_in, | 61 const string16& type_in, |
39 const FilePath& blob_file_in, | 62 const FilePath& blob_file_in, |
40 int64 blob_length_in) | 63 int64 blob_length_in) |
41 : action(action_in), | 64 : action(action_in), |
42 type(type_in), | 65 type(type_in), |
43 blob_file(blob_file_in), | 66 blob_file(blob_file_in), |
44 blob_length(blob_length_in), | 67 blob_length(blob_length_in), |
45 data_type(BLOB) { | 68 data_type(BLOB) { |
46 } | 69 } |
47 | 70 |
48 } // namespace webkit_glue | 71 } // namespace webkit_glue |
OLD | NEW |