summaryrefslogtreecommitdiffstats
path: root/content/browser/chrome_blob_storage_context.h
blob: 1c5fe5555d5dcd8ac8630c75dd7490632ea520cc (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
// Copyright (c) 2010 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 CONTENT_BROWSER_CHROME_BLOB_STORAGE_CONTEXT_H_
#define CONTENT_BROWSER_CHROME_BLOB_STORAGE_CONTEXT_H_
#pragma once

#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
#include "chrome/browser/browser_thread.h"

class GURL;

namespace webkit_blob {
class BlobStorageController;
}

// A context class that keeps track of BlobStorageController used by the chrome.
// There is an instance associated with each Profile. There could be multiple
// URLRequestContexts in the same profile that refers to the same instance.
//
// All methods, except the ctor, are expected to be called on
// the IO thread (unless specifically called out in doc comments).
class ChromeBlobStorageContext
    : public base::RefCountedThreadSafe<ChromeBlobStorageContext,
                                        BrowserThread::DeleteOnIOThread> {
 public:
  ChromeBlobStorageContext();

  void InitializeOnIOThread();

  webkit_blob::BlobStorageController* controller() const {
    return controller_.get();
  }

 private:
  friend class BrowserThread;
  friend class DeleteTask<ChromeBlobStorageContext>;

  virtual ~ChromeBlobStorageContext();

  scoped_ptr<webkit_blob::BlobStorageController> controller_;
};

#endif  // CONTENT_BROWSER_CHROME_BLOB_STORAGE_CONTEXT_H_