summaryrefslogtreecommitdiffstats
path: root/chrome/browser/thumbnail_store.h
blob: af41c97b30d9eedf31785c060b65b5efb5203fa1 (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
50
51
52
// 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_BROWSER_THUMBNAIL_STORE_H_
#define CHROME_BROWSER_THUMBNAIL_STORE_H_

#include <vector>

#include "base/file_path.h"

class GURL;
class SkBitmap;
struct ThumbnailScore;
namespace base {
class Time;
}

// This storage interface provides storage for the thumbnails used
// by the new_tab_ui.
class ThumbnailStore {
 public:
  ThumbnailStore();
  ~ThumbnailStore();

  // Must be called after creation but before other methods are called.
  // file_path is where a new database should be created or the
  // location of an existing databse.
  // If false is returned, no other methods should be called.
  bool Init(const FilePath& file_path);

  // Stores the given thumbnail and score with the associated url.
  bool SetPageThumbnail(const GURL& url,
                        const SkBitmap& thumbnail,
                        const ThumbnailScore& score,
                        const base::Time& time);

  // Retrieves the thumbnail and score for the given url.
  // Returns false if there is not data for the given url or some other
  // error occurred.
  bool GetPageThumbnail(const GURL& url,
                        SkBitmap* thumbnail,
                        ThumbnailScore* score);

 private:
  // The location of the thumbnail store.
  FilePath file_path_;

  DISALLOW_COPY_AND_ASSIGN(ThumbnailStore);
};

#endif  // CHROME_BROWSER_THUMBNAIL_STORE_H_