summaryrefslogtreecommitdiffstats
path: root/components/favicon_base
diff options
context:
space:
mode:
authorjif@chromium.org <jif@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-17 17:20:53 +0000
committerjif@chromium.org <jif@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-17 17:20:53 +0000
commit7627e0b44b3807ad604dc3b66170af723ddbfd99 (patch)
tree57d154202cd77890e0eff91eb18b72777bfb40fc /components/favicon_base
parentea8c56cdad5c7f8e2bf66ae7427dae786a8f82e5 (diff)
downloadchromium_src-7627e0b44b3807ad604dc3b66170af723ddbfd99.zip
chromium_src-7627e0b44b3807ad604dc3b66170af723ddbfd99.tar.gz
chromium_src-7627e0b44b3807ad604dc3b66170af723ddbfd99.tar.bz2
Moved favicon_types to favicon_base component.
The move caused includes, DEPS, and gyp to change. This CL also adds droger as a temporary owner to the favicon and favicon_base components. Reasoning behind the creation of a favicon_base component: Bookmarks and History code do not fundamentally depend on the Favicon code, so we should be able to build those components without building the Favicon code. Deep inside the Bookmarks and History code base there's usage of certain favicon types. Those typedefs are moved to a separate component to break the dependency between the Bookmark/History components and the Favicon component. BUG=362481 Review URL: https://codereview.chromium.org/234893002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@264555 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components/favicon_base')
-rw-r--r--components/favicon_base/DEPS3
-rw-r--r--components/favicon_base/favicon_types.cc22
-rw-r--r--components/favicon_base/favicon_types.h77
3 files changed, 102 insertions, 0 deletions
diff --git a/components/favicon_base/DEPS b/components/favicon_base/DEPS
new file mode 100644
index 0000000..b273ae3
--- /dev/null
+++ b/components/favicon_base/DEPS
@@ -0,0 +1,3 @@
+include_rules = [
+ "+ui/gfx",
+]
diff --git a/components/favicon_base/favicon_types.cc b/components/favicon_base/favicon_types.cc
new file mode 100644
index 0000000..837da69
--- /dev/null
+++ b/components/favicon_base/favicon_types.cc
@@ -0,0 +1,22 @@
+// Copyright 2014 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.
+
+#include "components/favicon_base/favicon_types.h"
+
+namespace favicon_base {
+
+// FaviconImageResult ---------------------------------------------------------
+
+FaviconImageResult::FaviconImageResult() {}
+
+FaviconImageResult::~FaviconImageResult() {}
+
+// FaviconBitmapResult --------------------------------------------------------
+
+FaviconBitmapResult::FaviconBitmapResult()
+ : expired(false), icon_type(INVALID_ICON) {}
+
+FaviconBitmapResult::~FaviconBitmapResult() {}
+
+} // namespace chrome
diff --git a/components/favicon_base/favicon_types.h b/components/favicon_base/favicon_types.h
new file mode 100644
index 0000000..7f4a7b2
--- /dev/null
+++ b/components/favicon_base/favicon_types.h
@@ -0,0 +1,77 @@
+// Copyright 2014 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_FAVICON_BASE_FAVICON_TYPES_H_
+#define COMPONENTS_FAVICON_BASE_FAVICON_TYPES_H_
+
+#include "base/memory/ref_counted_memory.h"
+#include "ui/gfx/image/image.h"
+#include "ui/gfx/size.h"
+#include "url/gurl.h"
+
+namespace favicon_base {
+
+typedef int64 FaviconID;
+
+// Defines the icon types. They are also stored in icon_type field of favicons
+// table.
+// The values of the IconTypes are used to select the priority in which favicon
+// data is returned in HistoryBackend and ThumbnailDatabase. Data for the
+// largest IconType takes priority if data for multiple IconTypes is available.
+enum IconType {
+ INVALID_ICON = 0x0,
+ FAVICON = 1 << 0,
+ TOUCH_ICON = 1 << 1,
+ TOUCH_PRECOMPOSED_ICON = 1 << 2
+};
+
+// Defines a gfx::Image of size desired_size_in_dip composed of image
+// representations for each of the desired scale factors.
+struct FaviconImageResult {
+ FaviconImageResult();
+ ~FaviconImageResult();
+
+ // The resulting image.
+ gfx::Image image;
+
+ // The URL of the favicon which contains all of the image representations of
+ // |image|.
+ // TODO(pkotwicz): Return multiple |icon_urls| to allow |image| to have
+ // representations from several favicons once content::FaviconStatus supports
+ // multiple URLs.
+ GURL icon_url;
+};
+
+// Defines a favicon bitmap which best matches the desired DIP size and one of
+// the desired scale factors.
+struct FaviconBitmapResult {
+ FaviconBitmapResult();
+ ~FaviconBitmapResult();
+
+ // Returns true if |bitmap_data| contains a valid bitmap.
+ bool is_valid() const { return bitmap_data.get() && bitmap_data->size(); }
+
+ // Indicates whether |bitmap_data| is expired.
+ bool expired;
+
+ // The bits of the bitmap.
+ scoped_refptr<base::RefCountedMemory> bitmap_data;
+
+ // The pixel dimensions of |bitmap_data|.
+ gfx::Size pixel_size;
+
+ // The URL of the containing favicon.
+ GURL icon_url;
+
+ // The icon type of the containing favicon.
+ IconType icon_type;
+};
+
+// Define type with same structure as FaviconBitmapResult for passing data to
+// HistoryBackend::SetFavicons().
+typedef FaviconBitmapResult FaviconBitmapData;
+
+} // namespace chrome
+
+#endif // COMPONENTS_FAVICON_BASE_FAVICON_TYPES_H_