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 "ppapi/host/ppapi_host.h" | 5 #include "ppapi/host/ppapi_host.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ppapi/c/pp_errors.h" | 8 #include "ppapi/c/pp_errors.h" |
9 #include "ppapi/host/host_factory.h" | 9 #include "ppapi/host/host_factory.h" |
10 #include "ppapi/host/host_message_context.h" | 10 #include "ppapi/host/host_message_context.h" |
11 #include "ppapi/host/resource_host.h" | 11 #include "ppapi/host/resource_host.h" |
12 #include "ppapi/proxy/ppapi_messages.h" | 12 #include "ppapi/proxy/ppapi_messages.h" |
13 #include "ppapi/proxy/resource_message_params.h" | 13 #include "ppapi/proxy/resource_message_params.h" |
14 #include "ppapi/shared_impl/host_resource.h" | 14 #include "ppapi/shared_impl/host_resource.h" |
15 | 15 |
16 namespace ppapi { | 16 namespace ppapi { |
17 namespace host { | 17 namespace host { |
18 | 18 |
19 namespace { | 19 namespace { |
20 | 20 |
21 // Put a cap on the maximum number of resources so we don't explode if the | 21 // Put a cap on the maximum number of resources so we don't explode if the |
22 // renderer starts spamming us. | 22 // renderer starts spamming us. |
23 const size_t kMaxResourcesPerPlugin = 1 << 14; | 23 const size_t kMaxResourcesPerPlugin = 1 << 14; |
24 | 24 |
25 } // namespace | 25 } // namespace |
26 | 26 |
27 PpapiHost::PpapiHost(IPC::Sender* sender, HostFactory* host_factory) | 27 PpapiHost::PpapiHost(IPC::Sender* sender, |
| 28 HostFactory* host_factory, |
| 29 const PpapiPermissions& perms) |
28 : sender_(sender), | 30 : sender_(sender), |
29 host_factory_(host_factory) { | 31 host_factory_(host_factory), |
| 32 permissions_(perms) { |
30 } | 33 } |
31 | 34 |
32 PpapiHost::~PpapiHost() { | 35 PpapiHost::~PpapiHost() { |
33 } | 36 } |
34 | 37 |
35 bool PpapiHost::Send(IPC::Message* msg) { | 38 bool PpapiHost::Send(IPC::Message* msg) { |
36 return sender_->Send(msg); | 39 return sender_->Send(msg); |
37 } | 40 } |
38 | 41 |
39 bool PpapiHost::OnMessageReceived(const IPC::Message& msg) { | 42 bool PpapiHost::OnMessageReceived(const IPC::Message& msg) { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 resources_.erase(found); | 120 resources_.erase(found); |
118 } | 121 } |
119 | 122 |
120 ResourceHost* PpapiHost::GetResourceHost(PP_Resource resource) { | 123 ResourceHost* PpapiHost::GetResourceHost(PP_Resource resource) { |
121 ResourceMap::iterator found = resources_.find(resource); | 124 ResourceMap::iterator found = resources_.find(resource); |
122 return found == resources_.end() ? NULL : found->second.get(); | 125 return found == resources_.end() ? NULL : found->second.get(); |
123 } | 126 } |
124 | 127 |
125 } // namespace host | 128 } // namespace host |
126 } // namespace ppapi | 129 } // namespace ppapi |
OLD | NEW |