1 // Copyright 2014 Samsung Electronics. 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 FAVICON_DATABASE_P_H
6 #define FAVICON_DATABASE_P_H
11 #include "third_party/skia/include/core/SkBitmap.h"
12 #include "third_party/sqlite/sqlite3.h"
13 #include "base/single_thread_task_runner.h"
14 #include "base/synchronization/lock.h"
15 #include "base/timer/timer.h"
16 #include "base/memory/weak_ptr.h"
17 #include "content/public/browser/browser_thread.h"
18 #include "favicon_database.h"
22 struct FaviconDatabasePrivate : public base::RefCountedThreadSafe<FaviconDatabasePrivate> {
23 FaviconDatabasePrivate()
24 : path("/tmp/favicon_database.db"),
25 privateBrowsing(false),
30 GURL faviconUrlForPageUrl(const GURL &pageUrl) const;
31 SkBitmap bitmapForFaviconUrl(const GURL &faviconUrl) const;
33 bool existsForFaviconURL(const GURL &faviconUrl) const;
35 scoped_refptr<base::SingleThreadTaskRunner> taskRunner() const;
38 std::map<GURL, GURL> pageToFaviconUrl;
39 std::map<GURL, SkBitmap> faviconUrlToBitmap;
45 base::RepeatingTimer timer;
46 std::queue<Command *> commands;
47 base::WeakPtrFactory<FaviconDatabasePrivate> weakPtrFactory;
49 static const char *pageUrlToFaviconUrlTable;
50 static const char *faviconUrlToBitmapTable;
51 static const char *pageUrlColumn;
52 static const char *faviconUrlColumn;
53 static const char *bitmapColumn;
56 #endif // FAVICON_DATABASE_P_H