OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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<> |
11 #endif | 11 #endif |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 #include "chrome/common/plugin_carbon_interpose_constants_mac.h" | 52 #include "chrome/common/plugin_carbon_interpose_constants_mac.h" |
53 #include "gfx/rect.h" | 53 #include "gfx/rect.h" |
54 #endif | 54 #endif |
55 | 55 |
56 static const char kDefaultPluginFinderURL[] = | 56 static const char kDefaultPluginFinderURL[] = |
57 "https://dl-ssl.google.com/edgedl/chrome/plugins/plugins2.xml"; | 57 "https://dl-ssl.google.com/edgedl/chrome/plugins/plugins2.xml"; |
58 | 58 |
59 namespace { | 59 namespace { |
60 | 60 |
61 // Helper class that we pass to ResourceMessageFilter so that it can find the | 61 // Helper class that we pass to ResourceMessageFilter so that it can find the |
62 // right URLRequestContext for a request. | 62 // right net::URLRequestContext for a request. |
63 class PluginURLRequestContextOverride | 63 class PluginURLRequestContextOverride |
64 : public ResourceMessageFilter::URLRequestContextOverride { | 64 : public ResourceMessageFilter::URLRequestContextOverride { |
65 public: | 65 public: |
66 PluginURLRequestContextOverride() { | 66 PluginURLRequestContextOverride() { |
67 } | 67 } |
68 | 68 |
69 virtual URLRequestContext* GetRequestContext( | 69 virtual net::URLRequestContext* GetRequestContext( |
70 uint32 request_id, ResourceType::Type resource_type) { | 70 uint32 request_id, ResourceType::Type resource_type) { |
71 return CPBrowsingContextManager::GetInstance()->ToURLRequestContext( | 71 return CPBrowsingContextManager::GetInstance()->ToURLRequestContext( |
72 request_id); | 72 request_id); |
73 } | 73 } |
74 | 74 |
75 private: | 75 private: |
76 virtual ~PluginURLRequestContextOverride() {} | 76 virtual ~PluginURLRequestContextOverride() {} |
77 }; | 77 }; |
78 | 78 |
79 } // namespace | 79 } // namespace |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 return; | 373 return; |
374 } | 374 } |
375 | 375 |
376 // We already have an open channel, send a request right away to plugin. | 376 // We already have an open channel, send a request right away to plugin. |
377 RequestPluginChannel(client); | 377 RequestPluginChannel(client); |
378 } | 378 } |
379 | 379 |
380 void PluginProcessHost::OnGetCookies(uint32 request_context, | 380 void PluginProcessHost::OnGetCookies(uint32 request_context, |
381 const GURL& url, | 381 const GURL& url, |
382 std::string* cookies) { | 382 std::string* cookies) { |
383 URLRequestContext* context = CPBrowsingContextManager::GetInstance()-> | 383 net::URLRequestContext* context = CPBrowsingContextManager::GetInstance()-> |
384 ToURLRequestContext(request_context); | 384 ToURLRequestContext(request_context); |
385 // TODO(mpcomplete): remove fallback case when Gears support is prevalent. | 385 // TODO(mpcomplete): remove fallback case when Gears support is prevalent. |
386 if (!context) | 386 if (!context) |
387 context = Profile::GetDefaultRequestContext()->GetURLRequestContext(); | 387 context = Profile::GetDefaultRequestContext()->GetURLRequestContext(); |
388 | 388 |
389 // Note: We don't have a first_party_for_cookies check because plugins bypass | 389 // Note: We don't have a first_party_for_cookies check because plugins bypass |
390 // third-party cookie blocking. | 390 // third-party cookie blocking. |
391 if (context && context->cookie_store()) { | 391 if (context && context->cookie_store()) { |
392 *cookies = context->cookie_store()->GetCookies(url); | 392 *cookies = context->cookie_store()->GetCookies(url); |
393 } else { | 393 } else { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 const std::vector<uint8>& data) { | 467 const std::vector<uint8>& data) { |
468 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 468 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
469 | 469 |
470 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); | 470 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); |
471 if (chrome_plugin) { | 471 if (chrome_plugin) { |
472 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); | 472 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); |
473 uint32 data_len = static_cast<uint32>(data.size()); | 473 uint32 data_len = static_cast<uint32>(data.size()); |
474 chrome_plugin->functions().on_message(data_ptr, data_len); | 474 chrome_plugin->functions().on_message(data_ptr, data_len); |
475 } | 475 } |
476 } | 476 } |
OLD | NEW |