OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "webkit/glue/plugins/mozilla_extensions.h" | 5 #include "webkit/glue/plugins/mozilla_extensions.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 const char* url, | 266 const char* url, |
267 void* cookie_buffer, | 267 void* cookie_buffer, |
268 PRUint32& buffer_size) { | 268 PRUint32& buffer_size) { |
269 if ((!url) || (!cookie_buffer)) { | 269 if ((!url) || (!cookie_buffer)) { |
270 return NS_ERROR_INVALID_ARG; | 270 return NS_ERROR_INVALID_ARG; |
271 } | 271 } |
272 | 272 |
273 if (!plugin_instance_) | 273 if (!plugin_instance_) |
274 return NS_ERROR_FAILURE; | 274 return NS_ERROR_FAILURE; |
275 | 275 |
276 WebPlugin* webplugin = plugin_instance_->webplugin(); | 276 webkit_glue::WebPlugin* webplugin = plugin_instance_->webplugin(); |
277 if (!webplugin) | 277 if (!webplugin) |
278 return NS_ERROR_FAILURE; | 278 return NS_ERROR_FAILURE; |
279 | 279 |
280 // Bypass third-party cookie blocking by using the url as the policy_url. | 280 // Bypass third-party cookie blocking by using the url as the policy_url. |
281 GURL cookies_url((std::string(url))); | 281 GURL cookies_url((std::string(url))); |
282 std::string cookies = webplugin->GetCookies(cookies_url, cookies_url); | 282 std::string cookies = webplugin->GetCookies(cookies_url, cookies_url); |
283 | 283 |
284 if (cookies.empty()) | 284 if (cookies.empty()) |
285 return NS_ERROR_FAILURE; | 285 return NS_ERROR_FAILURE; |
286 | 286 |
(...skipping 12 matching lines...) Expand all Loading... |
299 const char* url, | 299 const char* url, |
300 const void* cookie_buffer, | 300 const void* cookie_buffer, |
301 PRUint32 buffer_size){ | 301 PRUint32 buffer_size){ |
302 if ((!url) || (!cookie_buffer) || (!buffer_size)) { | 302 if ((!url) || (!cookie_buffer) || (!buffer_size)) { |
303 return NS_ERROR_INVALID_ARG; | 303 return NS_ERROR_INVALID_ARG; |
304 } | 304 } |
305 | 305 |
306 if (!plugin_instance_) | 306 if (!plugin_instance_) |
307 return NS_ERROR_FAILURE; | 307 return NS_ERROR_FAILURE; |
308 | 308 |
309 WebPlugin* webplugin = plugin_instance_->webplugin(); | 309 webkit_glue::WebPlugin* webplugin = plugin_instance_->webplugin(); |
310 if (!webplugin) | 310 if (!webplugin) |
311 return NS_ERROR_FAILURE; | 311 return NS_ERROR_FAILURE; |
312 | 312 |
313 std::string cookie(static_cast<const char*>(cookie_buffer), | 313 std::string cookie(static_cast<const char*>(cookie_buffer), |
314 buffer_size); | 314 buffer_size); |
315 GURL cookies_url((std::string(url))); | 315 GURL cookies_url((std::string(url))); |
316 webplugin->SetCookie(cookies_url, | 316 webplugin->SetCookie(cookies_url, |
317 cookies_url, | 317 cookies_url, |
318 cookie); | 318 cookie); |
319 return NS_OK; | 319 return NS_OK; |
320 } | 320 } |
321 | 321 |
322 | 322 |
323 } // namespace NPAPI | 323 } // namespace NPAPI |
OLD | NEW |