summaryrefslogtreecommitdiffstats
path: root/webkit/appcache/appcache_host.h
blob: 420e3d4cd605aa726fa8b64da20a99d7c234ce53 (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
// 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.

#ifndef WEBKIT_APPCACHE_APPCACHE_HOST_H_
#define WEBKIT_APPCACHE_APPCACHE_HOST_H_

#include "base/ref_counted.h"

namespace appcache {

class AppCache;
class AppCacheFrontend;
class AppCacheGroup;

// Server-side representation of an application cache host.
class AppCacheHost {
 public:
  AppCacheHost(int host_id, AppCacheFrontend* frontend);
  ~AppCacheHost();

  int host_id() { return host_id_; }
  AppCacheFrontend* frontend() { return frontend_; }

  AppCache* selected_cache() { return selected_cache_; }
  void set_selected_cache(AppCache* cache);

  bool is_selection_pending() {
    return false;  // TODO(michaeln)
  }

 private:
  // identifies the corresponding appcache host in the child process
  int host_id_;

  // application cache associated with this host, if any
  scoped_refptr<AppCache> selected_cache_;

  // The reference to the appcache group ensures the group exists as long
  // as there is a host using a cache belonging to that group.
  scoped_refptr<AppCacheGroup> group_;

  // frontend to deliver notifications about this host to child process
  AppCacheFrontend* frontend_;
};

}  // namespace appcache

#endif  // WEBKIT_APPCACHE_APPCACHE_HOST_H_