Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / components / enhanced_bookmarks / persistent_image_store.h
blob986b98f975c94a599e790db1c03baf8826ccd7ab
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_ENHANCED_BOOKMARKS_PERSISTENT_IMAGE_STORE_H_
6 #define COMPONENTS_ENHANCED_BOOKMARKS_PERSISTENT_IMAGE_STORE_H_
8 #include "components/enhanced_bookmarks/image_store.h"
10 #include "base/files/file_path.h"
11 #include "sql/connection.h"
12 #include "sql/init_status.h"
14 // The PersistentImageStore is an implementation of ImageStore that persists its
15 // data on disk.
16 class PersistentImageStore : public ImageStore {
17 public:
18 // Creates a PersistentImageStore in the directory at the given path.
19 explicit PersistentImageStore(const base::FilePath& path);
20 virtual bool HasKey(const GURL& page_url) OVERRIDE;
21 virtual void Insert(const GURL& page_url,
22 const GURL& image_url,
23 const gfx::Image& image) OVERRIDE;
24 virtual void Erase(const GURL& page_url) OVERRIDE;
25 virtual std::pair<gfx::Image, GURL> Get(const GURL& page_url) OVERRIDE;
26 virtual gfx::Size GetSize(const GURL& page_url) OVERRIDE;
27 virtual void GetAllPageUrls(std::set<GURL>* urls) OVERRIDE;
28 virtual void ClearAll() OVERRIDE;
29 virtual int64 GetStoreSizeInBytes() OVERRIDE;
31 protected:
32 virtual ~PersistentImageStore();
34 private:
35 sql::InitStatus OpenDatabase();
37 const base::FilePath path_;
38 sql::Connection db_;
40 DISALLOW_COPY_AND_ASSIGN(PersistentImageStore);
43 #endif // COMPONENTS_ENHANCED_BOOKMARKS_PERSISTENT_IMAGE_STORE_H_