1// Copyright 2013 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "content/child/appcache/appcache_backend_proxy.h"
6
7#include "content/common/appcache_messages.h"
8
9namespace content {
10
11void AppCacheBackendProxy::RegisterHost(int host_id) {
12  sender_->Send(new AppCacheHostMsg_RegisterHost(host_id));
13}
14
15void AppCacheBackendProxy::UnregisterHost(int host_id) {
16  sender_->Send(new AppCacheHostMsg_UnregisterHost(host_id));
17}
18
19void AppCacheBackendProxy::SetSpawningHostId(int host_id,
20                                             int spawning_host_id) {
21  sender_->Send(new AppCacheHostMsg_SetSpawningHostId(
22                                    host_id, spawning_host_id));
23}
24
25void AppCacheBackendProxy::SelectCache(
26    int host_id,
27    const GURL& document_url,
28    const int64 cache_document_was_loaded_from,
29    const GURL& manifest_url) {
30  sender_->Send(new AppCacheHostMsg_SelectCache(
31                                    host_id, document_url,
32                                    cache_document_was_loaded_from,
33                                    manifest_url));
34}
35
36void AppCacheBackendProxy::SelectCacheForWorker(
37    int host_id, int parent_process_id, int parent_host_id) {
38  sender_->Send(new AppCacheHostMsg_SelectCacheForWorker(
39                                    host_id, parent_process_id,
40                                    parent_host_id));
41}
42
43void AppCacheBackendProxy::SelectCacheForSharedWorker(
44    int host_id, int64 appcache_id) {
45  sender_->Send(new AppCacheHostMsg_SelectCacheForSharedWorker(
46                                    host_id, appcache_id));
47}
48
49void AppCacheBackendProxy::MarkAsForeignEntry(
50    int host_id, const GURL& document_url,
51    int64 cache_document_was_loaded_from) {
52  sender_->Send(new AppCacheHostMsg_MarkAsForeignEntry(
53                                    host_id, document_url,
54                                    cache_document_was_loaded_from));
55}
56
57appcache::Status AppCacheBackendProxy::GetStatus(int host_id) {
58  appcache::Status status = appcache::UNCACHED;
59  sender_->Send(new AppCacheHostMsg_GetStatus(host_id, &status));
60  return status;
61}
62
63bool AppCacheBackendProxy::StartUpdate(int host_id) {
64  bool result = false;
65  sender_->Send(new AppCacheHostMsg_StartUpdate(host_id, &result));
66  return result;
67}
68
69bool AppCacheBackendProxy::SwapCache(int host_id) {
70  bool result = false;
71  sender_->Send(new AppCacheHostMsg_SwapCache(host_id, &result));
72  return result;
73}
74
75void AppCacheBackendProxy::GetResourceList(
76    int host_id, std::vector<appcache::AppCacheResourceInfo>* resource_infos) {
77  sender_->Send(new AppCacheHostMsg_GetResourceList(host_id, resource_infos));
78}
79
80}  // namespace content
81