summaryrefslogtreecommitdiffstats
path: root/components/enhanced_bookmarks/image_record.h
diff options
context:
space:
mode:
authorlpromero <lpromero@chromium.org>2015-01-23 12:17:36 -0800
committerCommit bot <commit-bot@chromium.org>2015-01-23 20:18:40 +0000
commita110f52e83cebd2b6f0ed37c34abeac8bfcb1b72 (patch)
treeb0054fe1a2bbb25a9532fb7a1b9a1decb5b62a6d /components/enhanced_bookmarks/image_record.h
parent921392d21263c05b374d94ae3da3120094cd6a65 (diff)
downloadchromium_src-a110f52e83cebd2b6f0ed37c34abeac8bfcb1b72.zip
chromium_src-a110f52e83cebd2b6f0ed37c34abeac8bfcb1b72.tar.gz
chromium_src-a110f52e83cebd2b6f0ed37c34abeac8bfcb1b72.tar.bz2
★ Record the image dominant color in the image database.
This CL adds a column in the bookmarks images database. It contains the dominant color extracted from the image. Since this computation can be lengthy, it is done in the background, when the image is stored in the database. For old databases, a migration path is provided and the dominant color is computed and stored upon querying the image for the first time. BUG=448443 Review URL: https://codereview.chromium.org/875463003 Cr-Commit-Position: refs/heads/master@{#312916}
Diffstat (limited to 'components/enhanced_bookmarks/image_record.h')
-rw-r--r--components/enhanced_bookmarks/image_record.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/components/enhanced_bookmarks/image_record.h b/components/enhanced_bookmarks/image_record.h
new file mode 100644
index 0000000..dde3251
--- /dev/null
+++ b/components/enhanced_bookmarks/image_record.h
@@ -0,0 +1,30 @@
+// Copyright 2015 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 COMPONENTS_ENHANCED_BOOKMARKS_IMAGE_RECORD_H_
+#define COMPONENTS_ENHANCED_BOOKMARKS_IMAGE_RECORD_H_
+
+#include "third_party/skia/include/core/SkColor.h"
+#include "ui/gfx/image/image.h"
+#include "url/gurl.h"
+
+namespace enhanced_bookmarks {
+
+// Defines a record of a bookmark image in the ImageStore.
+struct ImageRecord {
+ ImageRecord() : image(), url(), dominant_color(SK_ColorBLACK) {}
+ ImageRecord(const gfx::Image& image, const GURL& url, SkColor dominant_color)
+ : image(image), url(url), dominant_color(dominant_color) {}
+
+ // The image data.
+ gfx::Image image;
+ // The URL that hosts the image.
+ GURL url;
+ // The dominant color of the image.
+ SkColor dominant_color;
+};
+
+} // namespace enhanced_bookmarks
+
+#endif // COMPONENTS_ENHANCED_BOOKMARKS_IMAGE_RECORD_H_