summaryrefslogtreecommitdiffstats
path: root/webkit/appcache/appcache_backend_impl.cc
blob: 82b40ee89b50404e27b60016ee005f215850deeb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "webkit/appcache/appcache_backend_impl.h"

#include "webkit/appcache/appcache_host.h"
#include "webkit/appcache/appcache_service.h"
#include "webkit/appcache/web_application_cache_host_impl.h"

namespace appcache {

AppCacheBackendImpl::~AppCacheBackendImpl() {
  if (service_)
    service_->UnregisterBackend(this);
}

void AppCacheBackendImpl::Initialize(AppCacheService* service,
                                     AppCacheFrontend* frontend,
                                     int process_id) {
  DCHECK(!service_ && !frontend_ && frontend && service);
  service_ = service;
  frontend_ = frontend;
  process_id_ = process_id;
  service_->RegisterBackend(this);
}

void AppCacheBackendImpl::RegisterHost(int id) {
  DCHECK(hosts_.find(id) == hosts_.end());
  hosts_.insert(HostMap::value_type(id, AppCacheHost(id, frontend_)));
}

void AppCacheBackendImpl::UnregisterHost(int id) {
  hosts_.erase(id);
}

void AppCacheBackendImpl::SelectCache(
    int host_id,
    const GURL& document_url,
    const int64 cache_document_was_loaded_from,
    const GURL& manifest_url) {
  // TODO(michaeln): write me
  frontend_->OnCacheSelected(host_id, kNoCacheId, UNCACHED);
}

void AppCacheBackendImpl::MarkAsForeignEntry(
    int host_id,
    const GURL& document_url,
    int64 cache_document_was_loaded_from) {
  // TODO(michaeln): write me
}

void AppCacheBackendImpl::GetStatusWithCallback(
    int host_id, GetStatusCallback* callback, void* callback_param) {
  // TODO(michaeln): write me
  callback->Run(UNCACHED, callback_param);
}

void AppCacheBackendImpl::StartUpdateWithCallback(
    int host_id, StartUpdateCallback* callback, void* callback_param) {
  // TODO(michaeln): write me
  callback->Run(false, callback_param);
}

void AppCacheBackendImpl::SwapCacheWithCallback(
    int host_id, SwapCacheCallback* callback, void* callback_param) {
  // TODO(michaeln): write me
  callback->Run(false, callback_param);
}

}  // namespace appcache