summaryrefslogtreecommitdiffstats
path: root/webkit/appcache/appcache_request_handler.cc
blob: 614c12ed614e7d4f06cc73b2ddb92257c0a9d065 (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
72
73
74
// Copyright (c) 2009 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_request_handler.h"

#include "net/url_request/url_request.h"
#include "net/url_request/url_request_job.h"
#include "webkit/appcache/appcache.h"

namespace appcache {

// AppCacheRequestHandler -----------------------------------------------------

AppCacheRequestHandler::AppCacheRequestHandler(AppCacheHost* host,
                                               bool is_main_resource)
    : is_main_request_(is_main_resource), host_(host) {
  DCHECK(host_);
  host_->AddObserver(this);
}

AppCacheRequestHandler::~AppCacheRequestHandler() {
  if (host_)
    host_->RemoveObserver(this);
}

void AppCacheRequestHandler::GetExtraResponseInfo(
    int64* cache_id, GURL* manifest_url) {
  // TODO(michaeln): If this is a main request and it was retrieved from
  // an appcache, ensure that appcache survives the frame navigation. The
  // AppCacheHost should hold reference to that cache to prevent it from
  // being dropped from the in-memory collection of AppCaches. When cache
  // selection occurs, that extra reference should be dropped. Perhaps
  // maybe: if (is_main) host->LoadCacheOfMainResource(cache_id);
}

URLRequestJob* AppCacheRequestHandler::MaybeLoadResource(URLRequest* request) {
  // 6.9.7 Changes to the networking model
  // If the resource is not to be fetched using the HTTP GET mechanism or
  // equivalent ... then fetch the resource normally
  if (!host_ || !IsSchemeAndMethodSupported(request))
    return NULL;
  // TODO(michaeln): write me
  return NULL;
}

URLRequestJob* AppCacheRequestHandler::MaybeLoadFallbackForRedirect(
    URLRequest* request, const GURL& location) {
  if (!host_ || !IsSchemeAndMethodSupported(request))
    return NULL;
  // TODO(michaeln): write me
  return NULL;
}

URLRequestJob* AppCacheRequestHandler::MaybeLoadFallbackForResponse(
    URLRequest* request) {
  if (!host_ || !IsSchemeAndMethodSupported(request))
    return NULL;
  // TODO(michaeln): write me
  return NULL;
}

void AppCacheRequestHandler::OnCacheSelectionComplete(AppCacheHost* host) {
  DCHECK(host == host_);
  // TODO(michaeln): write me
}

void AppCacheRequestHandler::OnDestructionImminent(AppCacheHost* host) {
  host_ = NULL;
  // TODO(michaeln): write me
}

}  // namespace appcache