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

Side by Side Diff: content/browser/ppapi_plugin_process_host.cc

Issue 11316316: Implement an IsAllowed function in the pepper PPB_Broker_Trusted API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years 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 #include "content/browser/ppapi_plugin_process_host.h" 5 #include "content/browser/ppapi_plugin_process_host.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/base_switches.h" 9 #include "base/base_switches.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 return plugin_host; 94 return plugin_host;
95 95
96 NOTREACHED(); // Init is not expected to fail. 96 NOTREACHED(); // Init is not expected to fail.
97 return NULL; 97 return NULL;
98 } 98 }
99 99
100 // static 100 // static
101 void PpapiPluginProcessHost::DidCreateOutOfProcessInstance( 101 void PpapiPluginProcessHost::DidCreateOutOfProcessInstance(
102 int plugin_process_id, 102 int plugin_process_id,
103 int32 pp_instance, 103 int32 pp_instance,
104 int render_process_id, 104 const PepperRendererInstanceData& instance_data) {
105 int render_view_id) {
106 for (PpapiPluginProcessHostIterator iter; !iter.Done(); ++iter) { 105 for (PpapiPluginProcessHostIterator iter; !iter.Done(); ++iter) {
107 if (iter->process_.get() && 106 if (iter->process_.get() &&
108 iter->process_->GetData().id == plugin_process_id) { 107 iter->process_->GetData().id == plugin_process_id) {
109 // Found the plugin. 108 // Found the plugin.
110 iter->host_impl_->AddInstanceForView(pp_instance, 109 iter->host_impl_->AddInstance(pp_instance, instance_data);
111 render_process_id, render_view_id);
112 return; 110 return;
113 } 111 }
114 } 112 }
115 // We'll see this passed with a 0 process ID for the browser tag stuff that 113 // We'll see this passed with a 0 process ID for the browser tag stuff that
116 // is currently in the process of being removed. 114 // is currently in the process of being removed.
117 // 115 //
118 // TODO(brettw) When old browser tag impl is removed 116 // TODO(brettw) When old browser tag impl is removed
119 // (PepperPluginDelegateImpl::CreateBrowserPluginModule passes a 0 plugin 117 // (PepperPluginDelegateImpl::CreateBrowserPluginModule passes a 0 plugin
120 // process ID) this should be converted to a NOTREACHED(). 118 // process ID) this should be converted to a NOTREACHED().
121 DCHECK(plugin_process_id == 0) 119 DCHECK(plugin_process_id == 0)
122 << "Renderer sent a bad plugin process host ID"; 120 << "Renderer sent a bad plugin process host ID";
123 } 121 }
124 122
125 // static 123 // static
126 void PpapiPluginProcessHost::DidDeleteOutOfProcessInstance( 124 void PpapiPluginProcessHost::DidDeleteOutOfProcessInstance(
127 int plugin_process_id, 125 int plugin_process_id,
128 int32 pp_instance) { 126 int32 pp_instance) {
129 for (PpapiPluginProcessHostIterator iter; !iter.Done(); ++iter) { 127 for (PpapiPluginProcessHostIterator iter; !iter.Done(); ++iter) {
130 if (iter->process_.get() && 128 if (iter->process_.get() &&
131 iter->process_->GetData().id == plugin_process_id) { 129 iter->process_->GetData().id == plugin_process_id) {
132 // Found the plugin. 130 // Found the plugin.
133 iter->host_impl_->DeleteInstanceForView(pp_instance); 131 iter->host_impl_->DeleteInstance(pp_instance);
134 return; 132 return;
135 } 133 }
136 } 134 }
137 // Note: It's possible that the plugin process has already been deleted by 135 // Note: It's possible that the plugin process has already been deleted by
138 // the time this message is received. For example, it could have crashed. 136 // the time this message is received. For example, it could have crashed.
139 // That's OK, we can just ignore this message. 137 // That's OK, we can just ignore this message.
140 } 138 }
141 139
142 bool PpapiPluginProcessHost::Send(IPC::Message* message) { 140 bool PpapiPluginProcessHost::Send(IPC::Message* message) {
143 return process_->Send(message); 141 return process_->Send(message);
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 362
365 // All requests should be processed FIFO, so the next item in the 363 // All requests should be processed FIFO, so the next item in the
366 // sent_requests_ queue should be the one that the plugin just created. 364 // sent_requests_ queue should be the one that the plugin just created.
367 Client* client = sent_requests_.front(); 365 Client* client = sent_requests_.front();
368 sent_requests_.pop(); 366 sent_requests_.pop();
369 367
370 client->OnPpapiChannelOpened(channel_handle, process_->GetData().id); 368 client->OnPpapiChannelOpened(channel_handle, process_->GetData().id);
371 } 369 }
372 370
373 } // namespace content 371 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/ppapi_plugin_process_host.h ('k') | content/browser/renderer_host/pepper/browser_ppapi_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698