| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/plugin/webplugin_delegate_stub.h" | 5 #include "chrome/plugin/webplugin_delegate_stub.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "chrome/common/child_process_logging.h" | 10 #include "chrome/common/child_process_logging.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 delegate_->PluginDestroyed(); | 39 delegate_->PluginDestroyed(); |
| 40 | 40 |
| 41 delete webplugin_; | 41 delete webplugin_; |
| 42 } | 42 } |
| 43 | 43 |
| 44 private: | 44 private: |
| 45 WebPluginDelegateImpl* delegate_; | 45 WebPluginDelegateImpl* delegate_; |
| 46 WebPlugin* webplugin_; | 46 WebPlugin* webplugin_; |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 #if defined(OS_MACOSX) |
| 50 namespace { |
| 51 |
| 52 void FocusNotifier(WebPluginDelegateImpl *instance) { |
| 53 uint32 process_id = getpid(); |
| 54 uint32 instance_id = reinterpret_cast<uint32>(instance); |
| 55 PluginThread* plugin_thread = PluginThread::current(); |
| 56 if (plugin_thread) { |
| 57 plugin_thread->Send( |
| 58 new PluginProcessHostMsg_PluginReceivedFocus(process_id, instance_id)); |
| 59 } |
| 60 } |
| 61 |
| 62 } |
| 63 #endif |
| 64 |
| 49 WebPluginDelegateStub::WebPluginDelegateStub( | 65 WebPluginDelegateStub::WebPluginDelegateStub( |
| 50 const std::string& mime_type, int instance_id, PluginChannel* channel) : | 66 const std::string& mime_type, int instance_id, PluginChannel* channel) : |
| 51 mime_type_(mime_type), | 67 mime_type_(mime_type), |
| 52 instance_id_(instance_id), | 68 instance_id_(instance_id), |
| 53 channel_(channel), | 69 channel_(channel), |
| 54 delegate_(NULL), | 70 delegate_(NULL), |
| 55 webplugin_(NULL), | 71 webplugin_(NULL), |
| 56 in_destructor_(false) { | 72 in_destructor_(false) { |
| 57 DCHECK(channel); | 73 DCHECK(channel); |
| 58 } | 74 } |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 channel_, instance_id_, page_url_, params.containing_window, | 173 channel_, instance_id_, page_url_, params.containing_window, |
| 158 params.host_render_view_routing_id); | 174 params.host_render_view_routing_id); |
| 159 delegate_ = WebPluginDelegateImpl::Create(path, mime_type_, parent); | 175 delegate_ = WebPluginDelegateImpl::Create(path, mime_type_, parent); |
| 160 if (delegate_) { | 176 if (delegate_) { |
| 161 webplugin_->set_delegate(delegate_); | 177 webplugin_->set_delegate(delegate_); |
| 162 *result = delegate_->Initialize(params.url, | 178 *result = delegate_->Initialize(params.url, |
| 163 params.arg_names, | 179 params.arg_names, |
| 164 params.arg_values, | 180 params.arg_values, |
| 165 webplugin_, | 181 webplugin_, |
| 166 params.load_manually); | 182 params.load_manually); |
| 183 #if defined(OS_MACOSX) |
| 184 delegate_->SetFocusNotifier(FocusNotifier); |
| 185 #endif |
| 167 } | 186 } |
| 168 } | 187 } |
| 169 | 188 |
| 170 void WebPluginDelegateStub::OnWillSendRequest(int id, const GURL& url) { | 189 void WebPluginDelegateStub::OnWillSendRequest(int id, const GURL& url) { |
| 171 WebPluginResourceClient* client = webplugin_->GetResourceClient(id); | 190 WebPluginResourceClient* client = webplugin_->GetResourceClient(id); |
| 172 if (!client) | 191 if (!client) |
| 173 return; | 192 return; |
| 174 | 193 |
| 175 client->WillSendRequest(url); | 194 client->WillSendRequest(url); |
| 176 } | 195 } |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 | 385 |
| 367 void WebPluginDelegateStub::OnHandleURLRequestReply( | 386 void WebPluginDelegateStub::OnHandleURLRequestReply( |
| 368 const PluginMsg_URLRequestReply_Params& params) { | 387 const PluginMsg_URLRequestReply_Params& params) { |
| 369 WebPluginResourceClient* resource_client = | 388 WebPluginResourceClient* resource_client = |
| 370 delegate_->CreateResourceClient(params.resource_id, params.url, | 389 delegate_->CreateResourceClient(params.resource_id, params.url, |
| 371 params.notify_needed, | 390 params.notify_needed, |
| 372 params.notify_data, | 391 params.notify_data, |
| 373 params.stream); | 392 params.stream); |
| 374 webplugin_->OnResourceCreated(params.resource_id, resource_client); | 393 webplugin_->OnResourceCreated(params.resource_id, resource_client); |
| 375 } | 394 } |
| OLD | NEW |