summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-28 23:11:58 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-28 23:11:58 +0000
commit0629707bad5647f85481dcb262446b87df8787ec (patch)
treed285c86197d1f6efc5ce3b335e4b8b2251375763
parentd1bd3527b5fc700e358b1f07d2c5541280db188c (diff)
downloadchromium_src-0629707bad5647f85481dcb262446b87df8787ec.zip
chromium_src-0629707bad5647f85481dcb262446b87df8787ec.tar.gz
chromium_src-0629707bad5647f85481dcb262446b87df8787ec.tar.bz2
Merge 53757 - ChromeFrame cookie requests would incorrectly get routed to the first host browser connected to the renderer. This basically
meant that if the browser process exited then other popups could not query cookies from the host. Part of the fix for http://b/issue?id=2277519 Bug=2277519 Review URL: http://codereview.chromium.org/3066004 TBR=ananta@chromium.org Review URL: http://codereview.chromium.org/3017041 git-svn-id: svn://svn.chromium.org/chrome/branches/472/src@54064 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/automation/automation_profile_impl.cc29
-rw-r--r--chrome/browser/automation/automation_resource_message_filter.cc94
-rw-r--r--chrome/browser/automation/automation_resource_message_filter.h19
-rw-r--r--chrome/browser/renderer_host/resource_message_filter.cc202
-rw-r--r--chrome/browser/renderer_host/resource_message_filter.h57
5 files changed, 233 insertions, 168 deletions
diff --git a/chrome/browser/automation/automation_profile_impl.cc b/chrome/browser/automation/automation_profile_impl.cc
index 751019a..0b14c7e 100644
--- a/chrome/browser/automation/automation_profile_impl.cc
+++ b/chrome/browser/automation/automation_profile_impl.cc
@@ -97,16 +97,6 @@ class AutomationCookieStore : public net::CookieStore {
}
protected:
- void SendIPCMessageOnIOThread(IPC::Message* m) {
- if (ChromeThread::CurrentlyOn(ChromeThread::IO)) {
- automation_client_->Send(m);
- } else {
- Task* task = NewRunnableMethod(this,
- &AutomationCookieStore::SendIPCMessageOnIOThread, m);
- ChromeThread::PostTask(ChromeThread::IO, FROM_HERE, task);
- }
- }
-
net::CookieStore* original_cookie_store_;
scoped_refptr<AutomationResourceMessageFilter> automation_client_;
int tab_handle_;
@@ -130,23 +120,20 @@ class AutomationCookiePolicy : public net::CookiePolicy {
net::CompletionCallback* callback) {
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
- if (automation_client_.get()) {
- automation_client_->GetCookiesForUrl(tab_handle_, url, callback,
- cookie_store_.get());
- return net::ERR_IO_PENDING;
- }
- return net::ERR_ACCESS_DENIED;
+ AutomationResourceMessageFilter::GetCookiesForUrl(tab_handle_, url,
+ callback,
+ cookie_store_.get());
+ return net::ERR_IO_PENDING;
}
virtual int CanSetCookie(const GURL& url,
const GURL& first_party_for_cookies,
const std::string& cookie_line,
net::CompletionCallback* callback) {
- if (automation_client_.get()) {
- automation_client_->Send(new AutomationMsg_SetCookieAsync(0,
- tab_handle_, url, cookie_line));
- }
- return net::ERR_ACCESS_DENIED;
+ AutomationResourceMessageFilter::SetCookiesForUrl(tab_handle_, url,
+ cookie_line,
+ callback);
+ return net::ERR_IO_PENDING;
}
private:
diff --git a/chrome/browser/automation/automation_resource_message_filter.cc b/chrome/browser/automation/automation_resource_message_filter.cc
index 68fc346..59a3bd4 100644
--- a/chrome/browser/automation/automation_resource_message_filter.cc
+++ b/chrome/browser/automation/automation_resource_message_filter.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/net/url_request_mock_util.h"
#include "chrome/browser/net/url_request_slow_download_job.h"
#include "chrome/browser/net/url_request_slow_http_job.h"
+#include "chrome/browser/renderer_host/resource_message_filter.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/test/automation/automation_messages.h"
@@ -21,13 +22,24 @@
#include "net/base/net_errors.h"
#include "net/url_request/url_request_filter.h"
-AutomationResourceMessageFilter::RenderViewMap
- AutomationResourceMessageFilter::filtered_render_views_;
+base::LazyInstance<AutomationResourceMessageFilter::RenderViewMap>
+ AutomationResourceMessageFilter::filtered_render_views_(
+ base::LINKER_INITIALIZED);
+
+base::LazyInstance<AutomationResourceMessageFilter::CompletionCallbackMap>
+ AutomationResourceMessageFilter::completion_callback_map_(
+ base::LINKER_INITIALIZED);
int AutomationResourceMessageFilter::unique_request_id_ = 1;
+int AutomationResourceMessageFilter::next_completion_callback_id_ = 0;
AutomationResourceMessageFilter::AutomationResourceMessageFilter()
: channel_(NULL) {
+ // Ensure that an instance of the callback map is created.
+ completion_callback_map_.Get();
+ // Ensure that an instance of the render view map is created.
+ filtered_render_views_.Get();
+
ChromeThread::PostTask(
ChromeThread::IO, FROM_HERE,
NewRunnableFunction(
@@ -58,11 +70,11 @@ void AutomationResourceMessageFilter::OnChannelClosing() {
// Only erase RenderViews which are associated with this
// AutomationResourceMessageFilter instance.
- RenderViewMap::iterator index = filtered_render_views_.begin();
- while (index != filtered_render_views_.end()) {
+ RenderViewMap::iterator index = filtered_render_views_.Get().begin();
+ while (index != filtered_render_views_.Get().end()) {
const AutomationDetails& details = (*index).second;
if (details.filter.get() == this) {
- filtered_render_views_.erase(index++);
+ filtered_render_views_.Get().erase(index++);
} else {
index++;
}
@@ -199,12 +211,13 @@ void AutomationResourceMessageFilter::RegisterRenderViewInIOThread(
int tab_handle, AutomationResourceMessageFilter* filter,
bool pending_view) {
RenderViewMap::iterator automation_details_iter(
- filtered_render_views_.find(RendererId(renderer_pid, renderer_id)));
- if (automation_details_iter != filtered_render_views_.end()) {
+ filtered_render_views_.Get().find(RendererId(renderer_pid,
+ renderer_id)));
+ if (automation_details_iter != filtered_render_views_.Get().end()) {
DCHECK(automation_details_iter->second.ref_count > 0);
automation_details_iter->second.ref_count++;
} else {
- filtered_render_views_[RendererId(renderer_pid, renderer_id)] =
+ filtered_render_views_.Get()[RendererId(renderer_pid, renderer_id)] =
AutomationDetails(tab_handle, filter, pending_view);
}
}
@@ -213,9 +226,10 @@ void AutomationResourceMessageFilter::RegisterRenderViewInIOThread(
void AutomationResourceMessageFilter::UnRegisterRenderViewInIOThread(
int renderer_pid, int renderer_id) {
RenderViewMap::iterator automation_details_iter(
- filtered_render_views_.find(RendererId(renderer_pid, renderer_id)));
+ filtered_render_views_.Get().find(RendererId(renderer_pid,
+ renderer_id)));
- if (automation_details_iter == filtered_render_views_.end()) {
+ if (automation_details_iter == filtered_render_views_.Get().end()) {
LOG(INFO) << "UnRegisterRenderViewInIOThread: already unregistered";
return;
}
@@ -223,7 +237,7 @@ void AutomationResourceMessageFilter::UnRegisterRenderViewInIOThread(
automation_details_iter->second.ref_count--;
if (automation_details_iter->second.ref_count <= 0) {
- filtered_render_views_.erase(RendererId(renderer_pid, renderer_id));
+ filtered_render_views_.Get().erase(RendererId(renderer_pid, renderer_id));
}
}
@@ -234,9 +248,10 @@ bool AutomationResourceMessageFilter::ResumePendingRenderViewInIOThread(
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
RenderViewMap::iterator automation_details_iter(
- filtered_render_views_.find(RendererId(renderer_pid, renderer_id)));
+ filtered_render_views_.Get().find(RendererId(renderer_pid,
+ renderer_id)));
- if (automation_details_iter == filtered_render_views_.end()) {
+ if (automation_details_iter == filtered_render_views_.Get().end()) {
NOTREACHED() << "Failed to find pending view for renderer pid:"
<< renderer_pid
<< ", render view id:"
@@ -250,7 +265,7 @@ bool AutomationResourceMessageFilter::ResumePendingRenderViewInIOThread(
automation_details_iter->second.filter;
DCHECK(old_filter != NULL);
- filtered_render_views_[RendererId(renderer_pid, renderer_id)] =
+ filtered_render_views_.Get()[RendererId(renderer_pid, renderer_id)] =
AutomationDetails(tab_handle, filter, false);
ResumeJobsForPendingView(tab_handle, old_filter, filter);
@@ -260,9 +275,9 @@ bool AutomationResourceMessageFilter::ResumePendingRenderViewInIOThread(
bool AutomationResourceMessageFilter::LookupRegisteredRenderView(
int renderer_pid, int renderer_id, AutomationDetails* details) {
bool found = false;
- RenderViewMap::iterator it = filtered_render_views_.find(RendererId(
+ RenderViewMap::iterator it = filtered_render_views_.Get().find(RendererId(
renderer_pid, renderer_id));
- if (it != filtered_render_views_.end()) {
+ if (it != filtered_render_views_.Get().end()) {
found = true;
if (details)
*details = it->second;
@@ -324,32 +339,46 @@ void AutomationResourceMessageFilter::GetCookiesForUrl(
DCHECK(callback != NULL);
DCHECK(cookie_store != NULL);
+ GetCookiesCompletion* get_cookies_callback =
+ static_cast<GetCookiesCompletion*>(callback);
+
+ RenderViewMap::iterator automation_details_iter(
+ filtered_render_views_.Get().find(RendererId(
+ get_cookies_callback->render_process_id(),
+ get_cookies_callback->render_view_id())));
+
+ DCHECK(automation_details_iter->second.filter != NULL);
+
int completion_callback_id = GetNextCompletionCallbackId();
- DCHECK(!ContainsKey(completion_callback_map_, completion_callback_id));
+ DCHECK(!ContainsKey(completion_callback_map_.Get(), completion_callback_id));
CookieCompletionInfo cookie_info;
cookie_info.completion_callback = callback;
cookie_info.cookie_store = cookie_store;
- completion_callback_map_[completion_callback_id] = cookie_info;
+ completion_callback_map_.Get()[completion_callback_id] = cookie_info;
- Send(new AutomationMsg_GetCookiesFromHost(0, tab_handle, url,
- completion_callback_id));
+ if (automation_details_iter->second.filter) {
+ automation_details_iter->second.filter->Send(
+ new AutomationMsg_GetCookiesFromHost(
+ 0, automation_details_iter->second.tab_handle, url,
+ completion_callback_id));
+ }
}
void AutomationResourceMessageFilter::OnGetCookiesHostResponse(
int tab_handle, bool success, const GURL& url, const std::string& cookies,
int cookie_id) {
CompletionCallbackMap::iterator index =
- completion_callback_map_.find(cookie_id);
- if (index != completion_callback_map_.end()) {
+ completion_callback_map_.Get().find(cookie_id);
+ if (index != completion_callback_map_.Get().end()) {
net::CompletionCallback* callback = index->second.completion_callback;
scoped_refptr<net::CookieStore> cookie_store = index->second.cookie_store;
DCHECK(callback != NULL);
DCHECK(cookie_store.get() != NULL);
- completion_callback_map_.erase(index);
+ completion_callback_map_.Get().erase(index);
// Set the cookie in the cookie store so that the callback can read it.
cookie_store->SetCookieWithOptions(url, cookies, net::CookieOptions());
@@ -366,6 +395,25 @@ void AutomationResourceMessageFilter::OnGetCookiesHostResponse(
}
}
+void AutomationResourceMessageFilter::SetCookiesForUrl(
+ int tab_handle, const GURL&url, const std::string& cookie_line,
+ net::CompletionCallback* callback) {
+ SetCookieCompletion* set_cookies_callback =
+ static_cast<SetCookieCompletion*>(callback);
+
+ RenderViewMap::iterator automation_details_iter(
+ filtered_render_views_.Get().find(RendererId(
+ set_cookies_callback->render_process_id(),
+ set_cookies_callback->render_view_id())));
+
+ DCHECK(automation_details_iter->second.filter != NULL);
+
+ if (automation_details_iter->second.filter) {
+ automation_details_iter->second.filter->Send(
+ new AutomationMsg_SetCookieAsync(0, tab_handle, url, cookie_line));
+ }
+}
+
// static
void AutomationResourceMessageFilter::ResumeJobsForPendingView(
int tab_handle,
diff --git a/chrome/browser/automation/automation_resource_message_filter.h b/chrome/browser/automation/automation_resource_message_filter.h
index 55b9bf2..67a2323 100644
--- a/chrome/browser/automation/automation_resource_message_filter.h
+++ b/chrome/browser/automation/automation_resource_message_filter.h
@@ -8,6 +8,7 @@
#include <map>
#include "base/atomicops.h"
+#include "base/lazy_instance.h"
#include "base/lock.h"
#include "base/platform_thread.h"
#include "ipc/ipc_channel_proxy.h"
@@ -99,9 +100,9 @@ class AutomationResourceMessageFilter
// Retrieves cookies for the url passed in from the external host. The
// callback passed in is notified on success or failure asynchronously.
- void GetCookiesForUrl(int tab_handle, const GURL& url,
- net::CompletionCallback* callback,
- net::CookieStore* cookie_store);
+ static void GetCookiesForUrl(int tab_handle, const GURL& url,
+ net::CompletionCallback* callback,
+ net::CookieStore* cookie_store);
// This function gets invoked when we receive a response from the external
// host for the cookie request sent in GetCookiesForUrl above. It sets the
@@ -111,6 +112,10 @@ class AutomationResourceMessageFilter
void OnGetCookiesHostResponse(int tab_handle, bool success, const GURL& url,
const std::string& cookies, int cookie_id);
+ // Set cookies in the external host.
+ static void SetCookiesForUrl(int tab_handle, const GURL&url,
+ const std::string& cookie_line, net::CompletionCallback* callback);
+
protected:
// Retrieves the automation request id for the passed in chrome request
// id and returns it in the automation_request_id parameter.
@@ -138,7 +143,7 @@ class AutomationResourceMessageFilter
AutomationResourceMessageFilter* old_filter,
AutomationResourceMessageFilter* new_filter);
- int GetNextCompletionCallbackId() {
+ static int GetNextCompletionCallbackId() {
return ++next_completion_callback_id_;
}
@@ -174,7 +179,7 @@ class AutomationResourceMessageFilter
RequestMap pending_request_map_;
// Map of render views interested in diverting url requests over automation.
- static RenderViewMap filtered_render_views_;
+ static base::LazyInstance<RenderViewMap> filtered_render_views_;
// Contains information used for completing the request to read cookies from
// the host coming in from the renderer.
@@ -189,11 +194,11 @@ class AutomationResourceMessageFilter
// cookies from the host and is removed when we receive a response from the
// host. Please see the OnGetCookiesHostResponse function.
typedef std::map<int, CookieCompletionInfo> CompletionCallbackMap;
- CompletionCallbackMap completion_callback_map_;
+ static base::LazyInstance<CompletionCallbackMap> completion_callback_map_;
// Contains the id of the next completion callback. This is passed to the the
// external host as a cookie referring to the completion callback.
- int next_completion_callback_id_;
+ static int next_completion_callback_id_;
DISALLOW_COPY_AND_ASSIGN(AutomationResourceMessageFilter);
};
diff --git a/chrome/browser/renderer_host/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc
index 698e385..6ccc151 100644
--- a/chrome/browser/renderer_host/resource_message_filter.cc
+++ b/chrome/browser/renderer_host/resource_message_filter.cc
@@ -159,120 +159,6 @@ void RenderParamsFromPrintSettings(const printing::PrintSettings& settings,
#endif
}
-class SetCookieCompletion : public net::CompletionCallback {
- public:
- SetCookieCompletion(int render_process_id,
- int render_view_id,
- const GURL& url,
- const std::string& cookie_line,
- ChromeURLRequestContext* context)
- : render_process_id_(render_process_id),
- render_view_id_(render_view_id),
- url_(url),
- cookie_line_(cookie_line),
- context_(context) {
- }
-
- virtual void RunWithParams(const Tuple1<int>& params) {
- int result = params.a;
- bool blocked_by_policy = true;
- if (result == net::OK ||
- result == net::OK_FOR_SESSION_ONLY) {
- blocked_by_policy = false;
- net::CookieOptions options;
- if (result == net::OK_FOR_SESSION_ONLY)
- options.set_force_session();
- context_->cookie_store()->SetCookieWithOptions(url_, cookie_line_,
- options);
- }
- if (!context_->IsExternal()) {
- CallRenderViewHostContentSettingsDelegate(
- render_process_id_, render_view_id_,
- &RenderViewHostDelegate::ContentSettings::OnCookieAccessed,
- url_, cookie_line_, blocked_by_policy);
- }
- delete this;
- }
-
- private:
- int render_process_id_;
- int render_view_id_;
- GURL url_;
- std::string cookie_line_;
- scoped_refptr<ChromeURLRequestContext> context_;
-};
-
-class GetCookiesCompletion : public net::CompletionCallback {
- public:
- GetCookiesCompletion(const GURL& url, IPC::Message* reply_msg,
- ResourceMessageFilter* filter,
- URLRequestContext* context)
- : url_(url),
- reply_msg_(reply_msg),
- filter_(filter),
- context_(context) {
- }
-
- virtual void RunWithParams(const Tuple1<int>& params) {
- int result = params.a;
- std::string cookies;
- if (result == net::OK)
- cookies = context_->cookie_store()->GetCookies(url_);
- ViewHostMsg_GetCookies::WriteReplyParams(reply_msg_, cookies);
- filter_->Send(reply_msg_);
- delete this;
- }
-
- private:
- GURL url_;
- IPC::Message* reply_msg_;
- scoped_refptr<ResourceMessageFilter> filter_;
- scoped_refptr<URLRequestContext> context_;
-};
-
-class GetRawCookiesCompletion : public net::CompletionCallback {
- public:
- GetRawCookiesCompletion(const GURL& url, IPC::Message* reply_msg,
- ResourceMessageFilter* filter,
- URLRequestContext* context)
- : url_(url),
- reply_msg_(reply_msg),
- filter_(filter),
- context_(context) {
- }
-
- virtual void RunWithParams(const Tuple1<int>& params) {
- // Ignore the policy result. We only waited on the policy result so that
- // any pending 'set-cookie' requests could be flushed. The intent of
- // querying the raw cookies is to reveal the contents of the cookie DB, so
- // it important that we don't read the cookie db ahead of pending writes.
-
- net::CookieMonster* cookie_monster =
- context_->cookie_store()->GetCookieMonster();
- net::CookieMonster::CookieList cookie_list =
- cookie_monster->GetAllCookiesForURL(url_);
-
- std::vector<webkit_glue::WebCookie> cookies;
- for (size_t i = 0; i < cookie_list.size(); ++i) {
- // TODO(darin): url.host() is not necessarily the domain of the cookie.
- // We need a different API on CookieMonster to provide the domain info.
- // See http://crbug.com/34315.
- cookies.push_back(
- webkit_glue::WebCookie(cookie_list[i].first, cookie_list[i].second));
- }
-
- ViewHostMsg_GetRawCookies::WriteReplyParams(reply_msg_, cookies);
- filter_->Send(reply_msg_);
- delete this;
- }
-
- private:
- GURL url_;
- IPC::Message* reply_msg_;
- scoped_refptr<ResourceMessageFilter> filter_;
- scoped_refptr<URLRequestContext> context_;
-};
-
class ClearCacheCompletion : public net::CompletionCallback {
public:
ClearCacheCompletion(IPC::Message* reply_msg,
@@ -689,7 +575,8 @@ void ResourceMessageFilter::OnGetCookies(const GURL& url,
URLRequestContext* context = GetRequestContextForURL(url);
GetCookiesCompletion* callback =
- new GetCookiesCompletion(url, reply_msg, this, context);
+ new GetCookiesCompletion(id(), reply_msg->routing_id(), url, reply_msg,
+ this, context, false);
int policy = net::OK;
if (context->cookie_policy()) {
@@ -723,8 +610,9 @@ void ResourceMessageFilter::OnGetRawCookies(
return;
}
- GetRawCookiesCompletion* callback =
- new GetRawCookiesCompletion(url, reply_msg, this, context);
+ GetCookiesCompletion* callback =
+ new GetCookiesCompletion(id(), reply_msg->routing_id(), url,
+ reply_msg, this, context, true);
// We check policy here to avoid sending back cookies that would not normally
// be applied to outbound requests for the given URL. Since this cookie info
@@ -1679,3 +1567,83 @@ void ResourceMessageFilter::OnGetExtensionMessageBundleOnFileThread(
ChromeThread::IO, FROM_HERE,
NewRunnableMethod(this, &ResourceMessageFilter::Send, reply_msg));
}
+
+SetCookieCompletion::SetCookieCompletion(int render_process_id,
+ int render_view_id,
+ const GURL& url,
+ const std::string& cookie_line,
+ ChromeURLRequestContext* context)
+ : render_process_id_(render_process_id),
+ render_view_id_(render_view_id),
+ url_(url),
+ cookie_line_(cookie_line),
+ context_(context) {
+}
+
+void SetCookieCompletion::RunWithParams(const Tuple1<int>& params) {
+ int result = params.a;
+ bool blocked_by_policy = true;
+ if (result == net::OK ||
+ result == net::OK_FOR_SESSION_ONLY) {
+ blocked_by_policy = false;
+ net::CookieOptions options;
+ if (result == net::OK_FOR_SESSION_ONLY)
+ options.set_force_session();
+ context_->cookie_store()->SetCookieWithOptions(url_, cookie_line_,
+ options);
+ }
+ if (!context_->IsExternal()) {
+ CallRenderViewHostContentSettingsDelegate(
+ render_process_id_, render_view_id_,
+ &RenderViewHostDelegate::ContentSettings::OnCookieAccessed,
+ url_, cookie_line_, blocked_by_policy);
+ }
+ delete this;
+}
+
+GetCookiesCompletion::GetCookiesCompletion(int render_process_id,
+ int render_view_id,
+ const GURL& url,
+ IPC::Message* reply_msg,
+ ResourceMessageFilter* filter,
+ URLRequestContext* context,
+ bool raw_cookies)
+ : url_(url),
+ reply_msg_(reply_msg),
+ filter_(filter),
+ context_(context),
+ render_process_id_(render_process_id),
+ render_view_id_(render_view_id),
+ raw_cookies_(raw_cookies) {
+}
+
+void GetCookiesCompletion::RunWithParams(const Tuple1<int>& params) {
+ if (!raw_cookies_) {
+ int result = params.a;
+ std::string cookies;
+ if (result == net::OK)
+ cookies = context_->cookie_store()->GetCookies(url_);
+ ViewHostMsg_GetCookies::WriteReplyParams(reply_msg_, cookies);
+ filter_->Send(reply_msg_);
+ delete this;
+ } else {
+ // Ignore the policy result. We only waited on the policy result so that
+ // any pending 'set-cookie' requests could be flushed. The intent of
+ // querying the raw cookies is to reveal the contents of the cookie DB, so
+ // it important that we don't read the cookie db ahead of pending writes.
+ net::CookieMonster* cookie_monster =
+ context_->cookie_store()->GetCookieMonster();
+ net::CookieMonster::CookieList cookie_list =
+ cookie_monster->GetAllCookiesForURL(url_);
+
+ std::vector<webkit_glue::WebCookie> cookies;
+ for (size_t i = 0; i < cookie_list.size(); ++i) {
+ cookies.push_back(webkit_glue::WebCookie(cookie_list[i]));
+ }
+
+ ViewHostMsg_GetRawCookies::WriteReplyParams(reply_msg_, cookies);
+ filter_->Send(reply_msg_);
+ delete this;
+ }
+}
+
diff --git a/chrome/browser/renderer_host/resource_message_filter.h b/chrome/browser/renderer_host/resource_message_filter.h
index d0c299d..e192de1 100644
--- a/chrome/browser/renderer_host/resource_message_filter.h
+++ b/chrome/browser/renderer_host/resource_message_filter.h
@@ -444,4 +444,61 @@ class ResourceMessageFilter : public IPC::ChannelProxy::MessageFilter,
DISALLOW_COPY_AND_ASSIGN(ResourceMessageFilter);
};
+// These classes implement completion callbacks for getting and setting
+// cookies.
+class SetCookieCompletion : public net::CompletionCallback {
+ public:
+ SetCookieCompletion(int render_process_id,
+ int render_view_id,
+ const GURL& url,
+ const std::string& cookie_line,
+ ChromeURLRequestContext* context);
+
+ virtual void RunWithParams(const Tuple1<int>& params);
+
+ int render_process_id() const {
+ return render_process_id_;
+ }
+
+ int render_view_id() const {
+ return render_view_id_;
+ }
+
+ private:
+ int render_process_id_;
+ int render_view_id_;
+ GURL url_;
+ std::string cookie_line_;
+ scoped_refptr<ChromeURLRequestContext> context_;
+};
+
+class GetCookiesCompletion : public net::CompletionCallback {
+ public:
+ GetCookiesCompletion(int render_process_id,
+ int render_view_id,
+ const GURL& url, IPC::Message* reply_msg,
+ ResourceMessageFilter* filter,
+ URLRequestContext* context,
+ bool raw_cookies);
+
+ virtual void RunWithParams(const Tuple1<int>& params);
+
+ int render_process_id() const {
+ return render_process_id_;
+ }
+
+ int render_view_id() const {
+ return render_view_id_;
+ }
+
+ private:
+ GURL url_;
+ IPC::Message* reply_msg_;
+ scoped_refptr<ResourceMessageFilter> filter_;
+ scoped_refptr<URLRequestContext> context_;
+ int render_process_id_;
+ int render_view_id_;
+ bool raw_cookies_;
+};
+
#endif // CHROME_BROWSER_RENDERER_HOST_RESOURCE_MESSAGE_FILTER_H_