| 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/renderer_host/render_message_filter.h" | 5 #include "chrome/browser/renderer_host/render_message_filter.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| 11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 if (policy == net::ERR_IO_PENDING) { | 552 if (policy == net::ERR_IO_PENDING) { |
| 553 Send(new ViewMsg_SignalCookiePromptEvent()); | 553 Send(new ViewMsg_SignalCookiePromptEvent()); |
| 554 return; | 554 return; |
| 555 } | 555 } |
| 556 } | 556 } |
| 557 callback->Run(policy); | 557 callback->Run(policy); |
| 558 } | 558 } |
| 559 | 559 |
| 560 void RenderMessageFilter::OnDeleteCookie(const GURL& url, | 560 void RenderMessageFilter::OnDeleteCookie(const GURL& url, |
| 561 const std::string& cookie_name) { | 561 const std::string& cookie_name) { |
| 562 URLRequestContext* context = GetRequestContextForURL(url); | 562 net::URLRequestContext* context = GetRequestContextForURL(url); |
| 563 context->cookie_store()->DeleteCookie(url, cookie_name); | 563 context->cookie_store()->DeleteCookie(url, cookie_name); |
| 564 } | 564 } |
| 565 | 565 |
| 566 void RenderMessageFilter::OnCookiesEnabled( | 566 void RenderMessageFilter::OnCookiesEnabled( |
| 567 const GURL& url, | 567 const GURL& url, |
| 568 const GURL& first_party_for_cookies, | 568 const GURL& first_party_for_cookies, |
| 569 IPC::Message* reply_msg) { | 569 IPC::Message* reply_msg) { |
| 570 URLRequestContext* context = GetRequestContextForURL(url); | 570 net::URLRequestContext* context = GetRequestContextForURL(url); |
| 571 CookiesEnabledCompletion* callback = | 571 CookiesEnabledCompletion* callback = |
| 572 new CookiesEnabledCompletion(reply_msg, this); | 572 new CookiesEnabledCompletion(reply_msg, this); |
| 573 int policy = net::OK; | 573 int policy = net::OK; |
| 574 // TODO(ananta): If this render view is associated with an automation channel, | 574 // TODO(ananta): If this render view is associated with an automation channel, |
| 575 // aka ChromeFrame then we need to retrieve cookie settings from the external | 575 // aka ChromeFrame then we need to retrieve cookie settings from the external |
| 576 // host. | 576 // host. |
| 577 if (context->cookie_policy()) { | 577 if (context->cookie_policy()) { |
| 578 policy = context->cookie_policy()->CanGetCookies( | 578 policy = context->cookie_policy()->CanGetCookies( |
| 579 url, first_party_for_cookies, callback); | 579 url, first_party_for_cookies, callback); |
| 580 if (policy == net::ERR_IO_PENDING) { | 580 if (policy == net::ERR_IO_PENDING) { |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 | 724 |
| 725 void RenderMessageFilter::OnLaunchNaCl( | 725 void RenderMessageFilter::OnLaunchNaCl( |
| 726 const std::wstring& url, int channel_descriptor, IPC::Message* reply_msg) { | 726 const std::wstring& url, int channel_descriptor, IPC::Message* reply_msg) { |
| 727 NaClProcessHost* host = new NaClProcessHost(resource_dispatcher_host_, url); | 727 NaClProcessHost* host = new NaClProcessHost(resource_dispatcher_host_, url); |
| 728 host->Launch(this, channel_descriptor, reply_msg); | 728 host->Launch(this, channel_descriptor, reply_msg); |
| 729 } | 729 } |
| 730 | 730 |
| 731 void RenderMessageFilter::OnDownloadUrl(const IPC::Message& message, | 731 void RenderMessageFilter::OnDownloadUrl(const IPC::Message& message, |
| 732 const GURL& url, | 732 const GURL& url, |
| 733 const GURL& referrer) { | 733 const GURL& referrer) { |
| 734 URLRequestContext* context = request_context_->GetURLRequestContext(); | 734 net::URLRequestContext* context = request_context_->GetURLRequestContext(); |
| 735 | 735 |
| 736 // Don't show "Save As" UI. | 736 // Don't show "Save As" UI. |
| 737 bool prompt_for_save_location = false; | 737 bool prompt_for_save_location = false; |
| 738 resource_dispatcher_host_->BeginDownload(url, | 738 resource_dispatcher_host_->BeginDownload(url, |
| 739 referrer, | 739 referrer, |
| 740 DownloadSaveInfo(), | 740 DownloadSaveInfo(), |
| 741 prompt_for_save_location, | 741 prompt_for_save_location, |
| 742 render_process_id_, | 742 render_process_id_, |
| 743 message.routing_id(), | 743 message.routing_id(), |
| 744 context); | 744 context); |
| (...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1620 } | 1620 } |
| 1621 | 1621 |
| 1622 CookiesEnabledCompletion::~CookiesEnabledCompletion() {} | 1622 CookiesEnabledCompletion::~CookiesEnabledCompletion() {} |
| 1623 | 1623 |
| 1624 void CookiesEnabledCompletion::RunWithParams(const Tuple1<int>& params) { | 1624 void CookiesEnabledCompletion::RunWithParams(const Tuple1<int>& params) { |
| 1625 bool result = params.a != net::ERR_ACCESS_DENIED; | 1625 bool result = params.a != net::ERR_ACCESS_DENIED; |
| 1626 ViewHostMsg_CookiesEnabled::WriteReplyParams(reply_msg_, result); | 1626 ViewHostMsg_CookiesEnabled::WriteReplyParams(reply_msg_, result); |
| 1627 filter_->Send(reply_msg_); | 1627 filter_->Send(reply_msg_); |
| 1628 delete this; | 1628 delete this; |
| 1629 } | 1629 } |
| OLD | NEW |