summaryrefslogtreecommitdiffstats
path: root/chrome/common/appcache/chrome_appcache_service.h
blob: 37e0dcb9b992e578849831da070a0a6787eed40c (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
// 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 CHROME_COMMON_APPCACHE_CHROME_APPCACHE_SERVICE_H_
#define CHROME_COMMON_APPCACHE_CHROME_APPCACHE_SERVICE_H_

#include "base/file_path.h"
#include "base/message_loop.h"
#include "base/ref_counted.h"
#include "base/task.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/common/chrome_constants.h"
#include "webkit/appcache/appcache_service.h"

// An AppCacheService subclass used by the chrome. There is an instance
// associated with each Profile. This derivation adds refcounting semantics
// since a profile has multiple URLRequestContexts which refer to the same
// object, and those URLRequestContexts are refcounted independently of the
// owning profile.
//
// All methods, including the dtor, are expected to be called on the IO thread.
class ChromeAppCacheService
    : public base::RefCounted<ChromeAppCacheService>,
      public appcache::AppCacheService {
 public:

  ChromeAppCacheService(const FilePath& data_directory,
                        bool is_incognito) {
    Initialize(is_incognito ? FilePath()
                            : data_directory.Append(chrome::kAppCacheDirname));
  }
 private:
  friend class base::RefCounted<ChromeAppCacheService>;

  virtual ~ChromeAppCacheService() {
    DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
  }
};

#endif  // CHROME_COMMON_APPCACHE_CHROME_APPCACHE_SERVICE_H_