OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/renderer/pepper/pepper_browser_connection.h" | 5 #include "content/renderer/pepper/pepper_browser_connection.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "content/common/view_messages.h" | 10 #include "content/common/view_messages.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 bool PepperBrowserConnection::OnMessageReceived(const IPC::Message& msg) { | 28 bool PepperBrowserConnection::OnMessageReceived(const IPC::Message& msg) { |
29 // Check if the message is an in-process reply. | 29 // Check if the message is an in-process reply. |
30 if (PepperInProcessRouter::OnPluginMsgReceived(msg)) | 30 if (PepperInProcessRouter::OnPluginMsgReceived(msg)) |
31 return true; | 31 return true; |
32 | 32 |
33 bool handled = true; | 33 bool handled = true; |
34 IPC_BEGIN_MESSAGE_MAP(PepperBrowserConnection, msg) | 34 IPC_BEGIN_MESSAGE_MAP(PepperBrowserConnection, msg) |
35 IPC_MESSAGE_HANDLER(PpapiHostMsg_CreateResourceHostsFromHostReply, | 35 IPC_MESSAGE_HANDLER(PpapiHostMsg_CreateResourceHostsFromHostReply, |
36 OnMsgCreateResourceHostsFromHostReply) | 36 OnMsgCreateResourceHostsFromHostReply) |
37 IPC_MESSAGE_HANDLER(PpapiHostMsg_FileRef_GetInfoForRendererReply, | |
38 OnMsgFileRefGetInfoReply) | |
39 IPC_MESSAGE_UNHANDLED(handled = false) | 37 IPC_MESSAGE_UNHANDLED(handled = false) |
40 IPC_END_MESSAGE_MAP() | 38 IPC_END_MESSAGE_MAP() |
| 39 |
41 return handled; | 40 return handled; |
42 } | 41 } |
43 | 42 |
44 void PepperBrowserConnection::DidCreateInProcessInstance( | 43 void PepperBrowserConnection::DidCreateInProcessInstance( |
45 PP_Instance instance, | 44 PP_Instance instance, |
46 int render_view_id, | 45 int render_view_id, |
47 const GURL& document_url, | 46 const GURL& document_url, |
48 const GURL& plugin_url) { | 47 const GURL& plugin_url) { |
49 Send(new ViewHostMsg_DidCreateInProcessInstance( | 48 Send(new ViewHostMsg_DidCreateInProcessInstance( |
50 instance, | 49 instance, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 if (it != pending_create_map_.end()) { | 94 if (it != pending_create_map_.end()) { |
96 it->second.Run(pending_resource_host_ids); | 95 it->second.Run(pending_resource_host_ids); |
97 pending_create_map_.erase(it); | 96 pending_create_map_.erase(it); |
98 } else { | 97 } else { |
99 NOTREACHED(); | 98 NOTREACHED(); |
100 } | 99 } |
101 } | 100 } |
102 | 101 |
103 void PepperBrowserConnection::OnMsgFileRefGetInfoReply( | 102 void PepperBrowserConnection::OnMsgFileRefGetInfoReply( |
104 int32_t sequence_number, | 103 int32_t sequence_number, |
105 const std::vector<ppapi::FileRefDetailedInfo>& infos) { | 104 const std::vector<PP_Resource>& resources, |
| 105 const std::vector<PP_FileSystemType>& types, |
| 106 const std::vector<std::string>& file_system_url_specs, |
| 107 const std::vector<base::FilePath>& external_paths) { |
106 // Check that the message is destined for the plugin this object is associated | 108 // Check that the message is destined for the plugin this object is associated |
107 // with. | 109 // with. |
108 std::map<int32_t, FileRefGetInfoCallback>::iterator it = | 110 std::map<int32_t, FileRefGetInfoCallback>::iterator it = |
109 get_info_map_.find(sequence_number); | 111 get_info_map_.find(sequence_number); |
110 if (it != get_info_map_.end()) { | 112 if (it != get_info_map_.end()) { |
111 FileRefGetInfoCallback callback = it->second; | 113 FileRefGetInfoCallback callback = it->second; |
112 get_info_map_.erase(it); | 114 get_info_map_.erase(it); |
113 callback.Run(infos); | 115 callback.Run(resources, types, file_system_url_specs, external_paths); |
114 } else { | 116 } else { |
115 NOTREACHED(); | 117 NOTREACHED(); |
116 } | 118 } |
117 } | 119 } |
118 | 120 |
119 int32_t PepperBrowserConnection::GetNextSequence() { | 121 int32_t PepperBrowserConnection::GetNextSequence() { |
120 // Return the value with wraparound, making sure we don't make a sequence | 122 // Return the value with wraparound, making sure we don't make a sequence |
121 // number with a 0 ID. Note that signed wraparound is undefined in C++ so we | 123 // number with a 0 ID. Note that signed wraparound is undefined in C++ so we |
122 // manually check. | 124 // manually check. |
123 int32_t ret = next_sequence_number_; | 125 int32_t ret = next_sequence_number_; |
124 if (next_sequence_number_ == std::numeric_limits<int32_t>::max()) | 126 if (next_sequence_number_ == std::numeric_limits<int32_t>::max()) |
125 next_sequence_number_ = 1; // Skip 0 which is invalid. | 127 next_sequence_number_ = 1; // Skip 0 which is invalid. |
126 else | 128 else |
127 next_sequence_number_++; | 129 next_sequence_number_++; |
128 return ret; | 130 return ret; |
129 } | 131 } |
130 | 132 |
131 } // namespace content | 133 } // namespace content |
OLD | NEW |