summaryrefslogtreecommitdiffstats
path: root/webkit/glue/webappcachecontext.cc
blob: 6092a268cfe4def72c40ff1b5aa2f6a79a175d12 (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
// 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/glue/webappcachecontext.h"

namespace {

WebAppCacheContext::WebAppCacheFactoryProc factory_proc = NULL;

class NoopWebAppCacheContext : public WebAppCacheContext {
 public:
  virtual int GetContextID() { return kNoAppCacheContextId; }
  virtual int64 GetAppCacheID() { return kNoAppCacheId; }
  virtual void Initialize(ContextType context_type,
                          WebAppCacheContext* opt_parent) {}
  virtual void SelectAppCacheWithoutManifest(
                                     const GURL& document_url,
                                     int64 cache_document_was_loaded_from) {}
  virtual void SelectAppCacheWithManifest(
                                     const GURL& document_url,
                                     int64 cache_document_was_loaded_from,
                                     const GURL& manifest_url) {}

};

}  // namespace

const int WebAppCacheContext::kNoAppCacheContextId = 0;
const int64 WebAppCacheContext::kNoAppCacheId = 0;
const int64 WebAppCacheContext::kUnknownAppCacheId = -1;

WebAppCacheContext* WebAppCacheContext::Create() {
  if (factory_proc)
    return factory_proc();
  return new NoopWebAppCacheContext();
}

void WebAppCacheContext::SetFactory(WebAppCacheFactoryProc proc) {
  factory_proc = proc;
}