OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/appcache/appcache_dispatcher_host.h" | 5 #include "chrome/browser/appcache/appcache_dispatcher_host.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "chrome/browser/appcache/chrome_appcache_service.h" | 8 #include "chrome/browser/appcache/chrome_appcache_service.h" |
9 #include "chrome/browser/metrics/user_metrics.h" | 9 #include "chrome/browser/metrics/user_metrics.h" |
10 #include "chrome/browser/net/chrome_url_request_context.h" | 10 #include "chrome/browser/net/chrome_url_request_context.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 start_update_callback_.reset( | 53 start_update_callback_.reset( |
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 | |
64 IPC_BEGIN_MESSAGE_MAP_EX(AppCacheDispatcherHost, message, *message_was_ok) | 63 IPC_BEGIN_MESSAGE_MAP_EX(AppCacheDispatcherHost, message, *message_was_ok) |
65 IPC_MESSAGE_HANDLER(AppCacheMsg_RegisterHost, OnRegisterHost); | 64 IPC_MESSAGE_HANDLER(AppCacheMsg_RegisterHost, OnRegisterHost) |
66 IPC_MESSAGE_HANDLER(AppCacheMsg_UnregisterHost, OnUnregisterHost); | 65 IPC_MESSAGE_HANDLER(AppCacheMsg_UnregisterHost, OnUnregisterHost) |
67 IPC_MESSAGE_HANDLER(AppCacheMsg_GetResourceList, OnGetResourceList); | 66 IPC_MESSAGE_HANDLER(AppCacheMsg_GetResourceList, OnGetResourceList) |
68 IPC_MESSAGE_HANDLER(AppCacheMsg_SelectCache, OnSelectCache); | 67 IPC_MESSAGE_HANDLER(AppCacheMsg_SelectCache, OnSelectCache) |
69 IPC_MESSAGE_HANDLER(AppCacheMsg_SelectCacheForWorker, | 68 IPC_MESSAGE_HANDLER(AppCacheMsg_SelectCacheForWorker, |
70 OnSelectCacheForWorker); | 69 OnSelectCacheForWorker) |
71 IPC_MESSAGE_HANDLER(AppCacheMsg_SelectCacheForSharedWorker, | 70 IPC_MESSAGE_HANDLER(AppCacheMsg_SelectCacheForSharedWorker, |
72 OnSelectCacheForSharedWorker); | 71 OnSelectCacheForSharedWorker) |
73 IPC_MESSAGE_HANDLER(AppCacheMsg_MarkAsForeignEntry, OnMarkAsForeignEntry); | 72 IPC_MESSAGE_HANDLER(AppCacheMsg_MarkAsForeignEntry, OnMarkAsForeignEntry) |
74 IPC_MESSAGE_HANDLER_DELAY_REPLY(AppCacheMsg_GetStatus, OnGetStatus); | 73 IPC_MESSAGE_HANDLER_DELAY_REPLY(AppCacheMsg_GetStatus, OnGetStatus) |
75 IPC_MESSAGE_HANDLER_DELAY_REPLY(AppCacheMsg_StartUpdate, OnStartUpdate); | 74 IPC_MESSAGE_HANDLER_DELAY_REPLY(AppCacheMsg_StartUpdate, OnStartUpdate) |
76 IPC_MESSAGE_HANDLER_DELAY_REPLY(AppCacheMsg_SwapCache, OnSwapCache); | 75 IPC_MESSAGE_HANDLER_DELAY_REPLY(AppCacheMsg_SwapCache, OnSwapCache) |
77 IPC_MESSAGE_UNHANDLED(handled = false) | 76 IPC_MESSAGE_UNHANDLED(handled = false) |
78 IPC_END_MESSAGE_MAP_EX() | 77 IPC_END_MESSAGE_MAP_EX() |
79 | 78 |
80 return handled; | 79 return handled; |
81 } | 80 } |
82 | 81 |
83 void AppCacheDispatcherHost::BadMessageReceived() { | 82 void AppCacheDispatcherHost::BadMessageReceived() { |
84 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_ACDH")); | 83 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_ACDH")); |
85 BrowserMessageFilter::BadMessageReceived(); | 84 BrowserMessageFilter::BadMessageReceived(); |
86 } | 85 } |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 AppCacheMsg_StartUpdate::WriteReplyParams(reply_msg, result); | 228 AppCacheMsg_StartUpdate::WriteReplyParams(reply_msg, result); |
230 Send(pending_reply_msg_.release()); | 229 Send(pending_reply_msg_.release()); |
231 } | 230 } |
232 | 231 |
233 void AppCacheDispatcherHost::SwapCacheCallback(bool result, void* param) { | 232 void AppCacheDispatcherHost::SwapCacheCallback(bool result, void* param) { |
234 IPC::Message* reply_msg = reinterpret_cast<IPC::Message*>(param); | 233 IPC::Message* reply_msg = reinterpret_cast<IPC::Message*>(param); |
235 DCHECK(reply_msg == pending_reply_msg_.get()); | 234 DCHECK(reply_msg == pending_reply_msg_.get()); |
236 AppCacheMsg_SwapCache::WriteReplyParams(reply_msg, result); | 235 AppCacheMsg_SwapCache::WriteReplyParams(reply_msg, result); |
237 Send(pending_reply_msg_.release()); | 236 Send(pending_reply_msg_.release()); |
238 } | 237 } |
OLD | NEW |