OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/browser/plugin_process_host.h" | 5 #include "chrome/browser/plugin_process_host.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #elif defined(OS_POSIX) | 9 #elif defined(OS_POSIX) |
10 #include <utility> // for pair<> | 10 #include <utility> // for pair<> |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 return; | 341 return; |
342 } | 342 } |
343 | 343 |
344 // We already have an open channel, send a request right away to plugin. | 344 // We already have an open channel, send a request right away to plugin. |
345 RequestPluginChannel(client); | 345 RequestPluginChannel(client); |
346 } | 346 } |
347 | 347 |
348 void PluginProcessHost::OnGetCookies(uint32 request_context, | 348 void PluginProcessHost::OnGetCookies(uint32 request_context, |
349 const GURL& url, | 349 const GURL& url, |
350 std::string* cookies) { | 350 std::string* cookies) { |
351 URLRequestContext* context = CPBrowsingContextManager::Instance()-> | 351 URLRequestContext* context = CPBrowsingContextManager::GetInstance()-> |
352 ToURLRequestContext(request_context); | 352 ToURLRequestContext(request_context); |
353 // TODO(mpcomplete): remove fallback case when Gears support is prevalent. | 353 // TODO(mpcomplete): remove fallback case when Gears support is prevalent. |
354 if (!context) | 354 if (!context) |
355 context = Profile::GetDefaultRequestContext()->GetURLRequestContext(); | 355 context = Profile::GetDefaultRequestContext()->GetURLRequestContext(); |
356 | 356 |
357 // Note: We don't have a first_party_for_cookies check because plugins bypass | 357 // Note: We don't have a first_party_for_cookies check because plugins bypass |
358 // third-party cookie blocking. | 358 // third-party cookie blocking. |
359 if (context && context->cookie_store()) { | 359 if (context && context->cookie_store()) { |
360 *cookies = context->cookie_store()->GetCookies(url); | 360 *cookies = context->cookie_store()->GetCookies(url); |
361 } else { | 361 } else { |
(...skipping 29 matching lines...) Expand all Loading... |
391 int result, | 391 int result, |
392 const std::string& proxy_list) { | 392 const std::string& proxy_list) { |
393 PluginProcessHostMsg_ResolveProxy::WriteReplyParams( | 393 PluginProcessHostMsg_ResolveProxy::WriteReplyParams( |
394 reply_msg, result, proxy_list); | 394 reply_msg, result, proxy_list); |
395 Send(reply_msg); | 395 Send(reply_msg); |
396 } | 396 } |
397 | 397 |
398 URLRequestContext* PluginProcessHost::GetRequestContext( | 398 URLRequestContext* PluginProcessHost::GetRequestContext( |
399 uint32 request_id, | 399 uint32 request_id, |
400 const ViewHostMsg_Resource_Request& request_data) { | 400 const ViewHostMsg_Resource_Request& request_data) { |
401 return CPBrowsingContextManager::Instance()->ToURLRequestContext(request_id); | 401 return CPBrowsingContextManager::GetInstance()->ToURLRequestContext( |
| 402 request_id); |
402 } | 403 } |
403 | 404 |
404 void PluginProcessHost::RequestPluginChannel(Client* client) { | 405 void PluginProcessHost::RequestPluginChannel(Client* client) { |
405 // We can't send any sync messages from the browser because it might lead to | 406 // We can't send any sync messages from the browser because it might lead to |
406 // a hang. However this async messages must be answered right away by the | 407 // a hang. However this async messages must be answered right away by the |
407 // plugin process (i.e. unblocks a Send() call like a sync message) otherwise | 408 // plugin process (i.e. unblocks a Send() call like a sync message) otherwise |
408 // a deadlock can occur if the plugin creation request from the renderer is | 409 // a deadlock can occur if the plugin creation request from the renderer is |
409 // a result of a sync message by the plugin process. | 410 // a result of a sync message by the plugin process. |
410 PluginProcessMsg_CreateChannel* msg = | 411 PluginProcessMsg_CreateChannel* msg = |
411 new PluginProcessMsg_CreateChannel(client->ID(), | 412 new PluginProcessMsg_CreateChannel(client->ID(), |
(...skipping 29 matching lines...) Expand all Loading... |
441 const std::vector<uint8>& data) { | 442 const std::vector<uint8>& data) { |
442 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 443 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
443 | 444 |
444 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); | 445 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); |
445 if (chrome_plugin) { | 446 if (chrome_plugin) { |
446 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); | 447 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); |
447 uint32 data_len = static_cast<uint32>(data.size()); | 448 uint32 data_len = static_cast<uint32>(data.size()); |
448 chrome_plugin->functions().on_message(data_ptr, data_len); | 449 chrome_plugin->functions().on_message(data_ptr, data_len); |
449 } | 450 } |
450 } | 451 } |
OLD | NEW |