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

Side by Side Diff: content/renderer/pepper/renderer_ppapi_host_impl.cc

Issue 10909138: Convert the async device ID getter to a chrome resource host (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 3 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
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 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" 5 #include "content/renderer/pepper/renderer_ppapi_host_impl.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/renderer/pepper/pepper_in_process_resource_creation.h" 8 #include "content/renderer/pepper/pepper_in_process_resource_creation.h"
9 #include "content/renderer/pepper/pepper_in_process_router.h" 9 #include "content/renderer/pepper/pepper_in_process_router.h"
10 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h" 10 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h"
11 #include "content/renderer/render_view_impl.h" 11 #include "content/renderer/render_view_impl.h"
12 #include "ppapi/proxy/host_dispatcher.h" 12 #include "ppapi/proxy/host_dispatcher.h"
13 #include "webkit/plugins/ppapi/host_globals.h" 13 #include "webkit/plugins/ppapi/host_globals.h"
14 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" 14 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
15 15
16 using webkit::ppapi::HostGlobals; 16 using webkit::ppapi::HostGlobals;
17 using webkit::ppapi::PluginInstance; 17 using webkit::ppapi::PluginInstance;
18 18
19 namespace content { 19 namespace content {
20 20
21 // Out-of-process constructor. 21 // Out-of-process constructor.
22 RendererPpapiHostImpl::RendererPpapiHostImpl( 22 RendererPpapiHostImpl::RendererPpapiHostImpl(
23 webkit::ppapi::PluginModule* module, 23 webkit::ppapi::PluginModule* module,
24 ppapi::proxy::HostDispatcher* dispatcher, 24 ppapi::proxy::HostDispatcher* dispatcher,
25 const ppapi::PpapiPermissions& permissions) 25 const ppapi::PpapiPermissions& permissions)
26 : module_(module), 26 : module_(module) {
27 host_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
28 // Hook the PpapiHost up to the dispatcher for out-of-process communication. 27 // Hook the PpapiHost up to the dispatcher for out-of-process communication.
29 ppapi_host_.reset( 28 ppapi_host_.reset(
30 new ppapi::host::PpapiHost(dispatcher, &host_factory_, permissions)); 29 new ppapi::host::PpapiHost(dispatcher, permissions));
30 ppapi_host_->AddHostFactoryFilter(scoped_ptr<ppapi::host::HostFactory>(
31 new ContentRendererPepperHostFactory(this)));
31 dispatcher->AddFilter(ppapi_host_.get()); 32 dispatcher->AddFilter(ppapi_host_.get());
32 } 33 }
33 34
34 // In-process constructor. 35 // In-process constructor.
35 RendererPpapiHostImpl::RendererPpapiHostImpl( 36 RendererPpapiHostImpl::RendererPpapiHostImpl(
36 webkit::ppapi::PluginModule* module, 37 webkit::ppapi::PluginModule* module,
37 const ppapi::PpapiPermissions& permissions) 38 const ppapi::PpapiPermissions& permissions)
38 : module_(module), 39 : module_(module) {
39 host_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
40 // Hook the host up to the in-process router. 40 // Hook the host up to the in-process router.
41 in_process_router_.reset(new PepperInProcessRouter(this)); 41 in_process_router_.reset(new PepperInProcessRouter(this));
42 ppapi_host_.reset(new ppapi::host::PpapiHost( 42 ppapi_host_.reset(new ppapi::host::PpapiHost(
43 in_process_router_->GetRendererToPluginSender(), 43 in_process_router_->GetRendererToPluginSender(), permissions));
44 &host_factory_, permissions)); 44 ppapi_host_->AddHostFactoryFilter(scoped_ptr<ppapi::host::HostFactory>(
45 new ContentRendererPepperHostFactory(this)));
45 } 46 }
46 47
47 RendererPpapiHostImpl::~RendererPpapiHostImpl() { 48 RendererPpapiHostImpl::~RendererPpapiHostImpl() {
48 } 49 }
49 50
50 // static 51 // static
51 RendererPpapiHostImpl* RendererPpapiHostImpl::CreateOnModuleForOutOfProcess( 52 RendererPpapiHostImpl* RendererPpapiHostImpl::CreateOnModuleForOutOfProcess(
52 webkit::ppapi::PluginModule* module, 53 webkit::ppapi::PluginModule* module,
53 ppapi::proxy::HostDispatcher* dispatcher, 54 ppapi::proxy::HostDispatcher* dispatcher,
54 const ppapi::PpapiPermissions& permissions) { 55 const ppapi::PpapiPermissions& permissions) {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 PP_Instance pp_instance) const { 122 PP_Instance pp_instance) const {
122 PluginInstance* instance = HostGlobals::Get()->GetInstance(pp_instance); 123 PluginInstance* instance = HostGlobals::Get()->GetInstance(pp_instance);
123 if (!instance) 124 if (!instance)
124 return NULL; 125 return NULL;
125 if (instance->module() != module_) 126 if (instance->module() != module_)
126 return NULL; 127 return NULL;
127 return instance; 128 return instance;
128 } 129 }
129 130
130 } // namespace content 131 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698