Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(386)

Side by Side Diff: components/bookmarks_enhanced/image_store.h

Issue 259863007: Local salient image storage for enhanced bookmark experiment. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: independent bookmarks_enhanced component, added NonThreadSafe to ImageStore class Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/bookmarks_enhanced/OWNERS ('k') | components/bookmarks_enhanced/image_store.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #ifndef COMPONENTS_BOOKMARKS_ENHANCED_IMAGE_STORE_H_
6 #define COMPONENTS_BOOKMARKS_ENHANCED_IMAGE_STORE_H_
7
8 #include <map>
9 #include <vector>
10
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/threading/non_thread_safe.h"
14 #include "ui/gfx/image/image.h"
15
16 class GURL;
17
18 // The ImageStore keeps an image for each URL.
19 class ImageStore : public base::NonThreadSafe,
tfarina 2014/05/05 17:42:59 No, do not use NonThreadSafe. Instead, could you c
Kibeom Kim (inactive) 2014/05/05 17:55:50 Done. Thanks!
20 public base::RefCounted<ImageStore> {
21 public:
22 ImageStore();
23
24 // Returns true if there is an image for this url.
25 virtual bool HasKey(const GURL& page_url) = 0;
26
27 // Inserts an image and its url in the store for the the given page url. The
28 // image can be null indicating that the download of the image at this URL
29 // failed previously.
30 virtual void Insert(const GURL& page_url,
31 const GURL& image_url,
32 const gfx::Image& image) = 0;
33
34 // Removes an image from the store.
35 virtual void Erase(const GURL& page_url) = 0;
36
37 // Returns the image associated with this url. Returns nil if there are no
38 // image for this url. It also returns the image_url where the image was
39 // downloaded from or failed to be downloaded from.
40 virtual gfx::Image Get(const GURL& page_url, GURL* image_url) = 0;
41
42 // Returns the size of the image stored for this URL or empty size if no
43 // images are present.
44 virtual gfx::Size GetSize(const GURL& page_url) = 0;
45
46 // Populates |url| with all the urls that have an image in the store.
47 virtual void GetAllPageUrls(std::vector<GURL>* urls) = 0;
48
49 // Moves an image from one url to another.
50 virtual void ChangeImageURL(const GURL& from, const GURL& to);
51
52 // Removes all images.
53 void ClearAll();
54
55 protected:
56 virtual ~ImageStore();
57
58 private:
59 friend class base::RefCounted<ImageStore>;
60 };
61
62 #endif // COMPONENTS_BOOKMARKS_ENHANCED_IMAGE_STORE_H_
OLDNEW
« no previous file with comments | « components/bookmarks_enhanced/OWNERS ('k') | components/bookmarks_enhanced/image_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698