Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(791)

Side by Side Diff: content/browser/appcache/appcache_dispatcher_host.cc

Issue 6691002: Move AppCache common code to content and split off AppCache messages into the... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 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 "content/browser/appcache/appcache_dispatcher_host.h" 5 #include "content/browser/appcache/appcache_dispatcher_host.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "chrome/browser/metrics/user_metrics.h" 8 #include "chrome/browser/metrics/user_metrics.h"
9 #include "chrome/browser/net/chrome_url_request_context.h" 9 #include "chrome/browser/net/chrome_url_request_context.h"
10 #include "chrome/browser/renderer_host/browser_render_process_host.h" 10 #include "chrome/browser/renderer_host/browser_render_process_host.h"
11 #include "chrome/common/render_messages.h"
12 #include "content/browser/appcache/chrome_appcache_service.h" 11 #include "content/browser/appcache/chrome_appcache_service.h"
12 #include "content/common/appcache_messages.h"
13 13
14 AppCacheDispatcherHost::AppCacheDispatcherHost( 14 AppCacheDispatcherHost::AppCacheDispatcherHost(
15 net::URLRequestContext* request_context, 15 net::URLRequestContext* request_context,
16 int process_id) 16 int process_id)
17 : ALLOW_THIS_IN_INITIALIZER_LIST(frontend_proxy_(this)), 17 : ALLOW_THIS_IN_INITIALIZER_LIST(frontend_proxy_(this)),
18 request_context_(request_context), 18 request_context_(request_context),
19 process_id_(process_id) { 19 process_id_(process_id) {
20 DCHECK(request_context_.get()); 20 DCHECK(request_context_.get());
21 } 21 }
22 22
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 NewCallback(this, &AppCacheDispatcherHost::StartUpdateCallback)); 54 NewCallback(this, &AppCacheDispatcherHost::StartUpdateCallback));
55 swap_cache_callback_.reset( 55 swap_cache_callback_.reset(
56 NewCallback(this, &AppCacheDispatcherHost::SwapCacheCallback)); 56 NewCallback(this, &AppCacheDispatcherHost::SwapCacheCallback));
57 } 57 }
58 } 58 }
59 59
60 bool AppCacheDispatcherHost::OnMessageReceived(const IPC::Message& message, 60 bool AppCacheDispatcherHost::OnMessageReceived(const IPC::Message& message,
61 bool* message_was_ok) { 61 bool* message_was_ok) {
62 bool handled = true; 62 bool handled = true;
63 IPC_BEGIN_MESSAGE_MAP_EX(AppCacheDispatcherHost, message, *message_was_ok) 63 IPC_BEGIN_MESSAGE_MAP_EX(AppCacheDispatcherHost, message, *message_was_ok)
64 IPC_MESSAGE_HANDLER(AppCacheMsg_RegisterHost, OnRegisterHost) 64 IPC_MESSAGE_HANDLER(AppCacheHostMsg_RegisterHost, OnRegisterHost)
65 IPC_MESSAGE_HANDLER(AppCacheMsg_UnregisterHost, OnUnregisterHost) 65 IPC_MESSAGE_HANDLER(AppCacheHostMsg_UnregisterHost, OnUnregisterHost)
66 IPC_MESSAGE_HANDLER(AppCacheMsg_GetResourceList, OnGetResourceList) 66 IPC_MESSAGE_HANDLER(AppCacheHostMsg_GetResourceList, OnGetResourceList)
67 IPC_MESSAGE_HANDLER(AppCacheMsg_SelectCache, OnSelectCache) 67 IPC_MESSAGE_HANDLER(AppCacheHostMsg_SelectCache, OnSelectCache)
68 IPC_MESSAGE_HANDLER(AppCacheMsg_SelectCacheForWorker, 68 IPC_MESSAGE_HANDLER(AppCacheHostMsg_SelectCacheForWorker,
69 OnSelectCacheForWorker) 69 OnSelectCacheForWorker)
70 IPC_MESSAGE_HANDLER(AppCacheMsg_SelectCacheForSharedWorker, 70 IPC_MESSAGE_HANDLER(AppCacheHostMsg_SelectCacheForSharedWorker,
71 OnSelectCacheForSharedWorker) 71 OnSelectCacheForSharedWorker)
72 IPC_MESSAGE_HANDLER(AppCacheMsg_MarkAsForeignEntry, OnMarkAsForeignEntry) 72 IPC_MESSAGE_HANDLER(AppCacheHostMsg_MarkAsForeignEntry,
73 IPC_MESSAGE_HANDLER_DELAY_REPLY(AppCacheMsg_GetStatus, OnGetStatus) 73 OnMarkAsForeignEntry)
74 IPC_MESSAGE_HANDLER_DELAY_REPLY(AppCacheMsg_StartUpdate, OnStartUpdate) 74 IPC_MESSAGE_HANDLER_DELAY_REPLY(AppCacheHostMsg_GetStatus, OnGetStatus)
75 IPC_MESSAGE_HANDLER_DELAY_REPLY(AppCacheMsg_SwapCache, OnSwapCache) 75 IPC_MESSAGE_HANDLER_DELAY_REPLY(AppCacheHostMsg_StartUpdate, OnStartUpdate)
76 IPC_MESSAGE_HANDLER_DELAY_REPLY(AppCacheHostMsg_SwapCache, OnSwapCache)
76 IPC_MESSAGE_UNHANDLED(handled = false) 77 IPC_MESSAGE_UNHANDLED(handled = false)
77 IPC_END_MESSAGE_MAP_EX() 78 IPC_END_MESSAGE_MAP_EX()
78 79
79 return handled; 80 return handled;
80 } 81 }
81 82
82 void AppCacheDispatcherHost::BadMessageReceived() { 83 void AppCacheDispatcherHost::BadMessageReceived() {
83 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_ACDH")); 84 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_ACDH"));
84 BrowserMessageFilter::BadMessageReceived(); 85 BrowserMessageFilter::BadMessageReceived();
85 } 86 }
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 return; 212 return;
212 } 213 }
213 214
214 SwapCacheCallback(false, reply_msg); 215 SwapCacheCallback(false, reply_msg);
215 } 216 }
216 217
217 void AppCacheDispatcherHost::GetStatusCallback( 218 void AppCacheDispatcherHost::GetStatusCallback(
218 appcache::Status status, void* param) { 219 appcache::Status status, void* param) {
219 IPC::Message* reply_msg = reinterpret_cast<IPC::Message*>(param); 220 IPC::Message* reply_msg = reinterpret_cast<IPC::Message*>(param);
220 DCHECK_EQ(pending_reply_msg_.get(), reply_msg); 221 DCHECK_EQ(pending_reply_msg_.get(), reply_msg);
221 AppCacheMsg_GetStatus::WriteReplyParams(reply_msg, status); 222 AppCacheHostMsg_GetStatus::WriteReplyParams(reply_msg, status);
222 Send(pending_reply_msg_.release()); 223 Send(pending_reply_msg_.release());
223 } 224 }
224 225
225 void AppCacheDispatcherHost::StartUpdateCallback(bool result, void* param) { 226 void AppCacheDispatcherHost::StartUpdateCallback(bool result, void* param) {
226 IPC::Message* reply_msg = reinterpret_cast<IPC::Message*>(param); 227 IPC::Message* reply_msg = reinterpret_cast<IPC::Message*>(param);
227 DCHECK_EQ(pending_reply_msg_.get(), reply_msg); 228 DCHECK_EQ(pending_reply_msg_.get(), reply_msg);
228 AppCacheMsg_StartUpdate::WriteReplyParams(reply_msg, result); 229 AppCacheHostMsg_StartUpdate::WriteReplyParams(reply_msg, result);
229 Send(pending_reply_msg_.release()); 230 Send(pending_reply_msg_.release());
230 } 231 }
231 232
232 void AppCacheDispatcherHost::SwapCacheCallback(bool result, void* param) { 233 void AppCacheDispatcherHost::SwapCacheCallback(bool result, void* param) {
233 IPC::Message* reply_msg = reinterpret_cast<IPC::Message*>(param); 234 IPC::Message* reply_msg = reinterpret_cast<IPC::Message*>(param);
234 DCHECK_EQ(pending_reply_msg_.get(), reply_msg); 235 DCHECK_EQ(pending_reply_msg_.get(), reply_msg);
235 AppCacheMsg_SwapCache::WriteReplyParams(reply_msg, result); 236 AppCacheHostMsg_SwapCache::WriteReplyParams(reply_msg, result);
236 Send(pending_reply_msg_.release()); 237 Send(pending_reply_msg_.release());
237 } 238 }
OLDNEW
« no previous file with comments | « chrome/worker/worker_webkitclient_impl.cc ('k') | content/browser/appcache/appcache_frontend_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698