| OLD | NEW |
| 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "content/browser/appcache/chrome_appcache_service.h" | 9 #include "content/browser/appcache/chrome_appcache_service.h" |
| 10 #include "content/browser/user_metrics.h" | |
| 11 #include "content/common/appcache_messages.h" | 10 #include "content/common/appcache_messages.h" |
| 11 #include "content/public/browser/user_metrics.h" |
| 12 |
| 13 using content::UserMetricsAction; |
| 12 | 14 |
| 13 AppCacheDispatcherHost::AppCacheDispatcherHost( | 15 AppCacheDispatcherHost::AppCacheDispatcherHost( |
| 14 ChromeAppCacheService* appcache_service, | 16 ChromeAppCacheService* appcache_service, |
| 15 int process_id) | 17 int process_id) |
| 16 : appcache_service_(appcache_service), | 18 : appcache_service_(appcache_service), |
| 17 ALLOW_THIS_IN_INITIALIZER_LIST(frontend_proxy_(this)), | 19 ALLOW_THIS_IN_INITIALIZER_LIST(frontend_proxy_(this)), |
| 18 process_id_(process_id) { | 20 process_id_(process_id) { |
| 19 } | 21 } |
| 20 | 22 |
| 21 AppCacheDispatcherHost::~AppCacheDispatcherHost() {} | 23 AppCacheDispatcherHost::~AppCacheDispatcherHost() {} |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 IPC_MESSAGE_HANDLER_DELAY_REPLY(AppCacheHostMsg_GetStatus, OnGetStatus) | 57 IPC_MESSAGE_HANDLER_DELAY_REPLY(AppCacheHostMsg_GetStatus, OnGetStatus) |
| 56 IPC_MESSAGE_HANDLER_DELAY_REPLY(AppCacheHostMsg_StartUpdate, OnStartUpdate) | 58 IPC_MESSAGE_HANDLER_DELAY_REPLY(AppCacheHostMsg_StartUpdate, OnStartUpdate) |
| 57 IPC_MESSAGE_HANDLER_DELAY_REPLY(AppCacheHostMsg_SwapCache, OnSwapCache) | 59 IPC_MESSAGE_HANDLER_DELAY_REPLY(AppCacheHostMsg_SwapCache, OnSwapCache) |
| 58 IPC_MESSAGE_UNHANDLED(handled = false) | 60 IPC_MESSAGE_UNHANDLED(handled = false) |
| 59 IPC_END_MESSAGE_MAP_EX() | 61 IPC_END_MESSAGE_MAP_EX() |
| 60 | 62 |
| 61 return handled; | 63 return handled; |
| 62 } | 64 } |
| 63 | 65 |
| 64 void AppCacheDispatcherHost::BadMessageReceived() { | 66 void AppCacheDispatcherHost::BadMessageReceived() { |
| 65 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_ACDH")); | 67 content::RecordAction(UserMetricsAction("BadMessageTerminate_ACDH")); |
| 66 BrowserMessageFilter::BadMessageReceived(); | 68 BrowserMessageFilter::BadMessageReceived(); |
| 67 } | 69 } |
| 68 | 70 |
| 69 void AppCacheDispatcherHost::OnRegisterHost(int host_id) { | 71 void AppCacheDispatcherHost::OnRegisterHost(int host_id) { |
| 70 if (appcache_service_.get()) { | 72 if (appcache_service_.get()) { |
| 71 if (!backend_impl_.RegisterHost(host_id)) { | 73 if (!backend_impl_.RegisterHost(host_id)) { |
| 72 BadMessageReceived(); | 74 BadMessageReceived(); |
| 73 } | 75 } |
| 74 } | 76 } |
| 75 } | 77 } |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 AppCacheHostMsg_StartUpdate::WriteReplyParams(reply_msg, result); | 218 AppCacheHostMsg_StartUpdate::WriteReplyParams(reply_msg, result); |
| 217 Send(pending_reply_msg_.release()); | 219 Send(pending_reply_msg_.release()); |
| 218 } | 220 } |
| 219 | 221 |
| 220 void AppCacheDispatcherHost::SwapCacheCallback(bool result, void* param) { | 222 void AppCacheDispatcherHost::SwapCacheCallback(bool result, void* param) { |
| 221 IPC::Message* reply_msg = reinterpret_cast<IPC::Message*>(param); | 223 IPC::Message* reply_msg = reinterpret_cast<IPC::Message*>(param); |
| 222 DCHECK_EQ(pending_reply_msg_.get(), reply_msg); | 224 DCHECK_EQ(pending_reply_msg_.get(), reply_msg); |
| 223 AppCacheHostMsg_SwapCache::WriteReplyParams(reply_msg, result); | 225 AppCacheHostMsg_SwapCache::WriteReplyParams(reply_msg, result); |
| 224 Send(pending_reply_msg_.release()); | 226 Send(pending_reply_msg_.release()); |
| 225 } | 227 } |
| OLD | NEW |