Index: chrome/browser/history/history_types.cc |
diff --git a/chrome/browser/history/history_types.cc b/chrome/browser/history/history_types.cc |
index abe58cb1753bed76c23e983cac8f44f36c1113b5..48b4d140710392509f1214ceb87fea99d9092b2d 100644 |
--- a/chrome/browser/history/history_types.cc |
+++ b/chrome/browser/history/history_types.cc |
@@ -8,6 +8,9 @@ |
#include "base/logging.h" |
#include "base/stl_util.h" |
+#include "base/string_number_conversions.h" |
+#include "base/string_tokenizer.h" |
+#include "base/string_util.h" |
#include "chrome/browser/history/page_usage_data.h" |
namespace history { |
@@ -90,14 +93,6 @@ VisitRow::VisitRow(URLID arg_url_id, |
VisitRow::~VisitRow() { |
} |
-// Favicons ------------------------------------------------------------------- |
- |
-ImportedFaviconUsage::ImportedFaviconUsage() { |
-} |
- |
-ImportedFaviconUsage::~ImportedFaviconUsage() { |
-} |
- |
// StarredEntry ---------------------------------------------------------------- |
StarredEntry::StarredEntry() |
@@ -429,6 +424,71 @@ IconMapping::IconMapping() |
IconMapping::~IconMapping() {} |
+// FaviconSizes --------------------------------------------------------------- |
+ |
+FaviconSizes::FaviconSizes() { |
+} |
+ |
+FaviconSizes::FaviconSizes(const std::string& string_representation) { |
+ bool no_errors = true; |
+ |
+ StringTokenizer t(string_representation, " "); |
+ while (t.GetNext() && no_errors) { |
+ int width, height = 0; |
+ no_errors &= base::StringToInt(t.token(), &width); |
+ if (!t.GetNext()) { |
+ no_errors = false; |
+ break; |
+ } |
+ no_errors &= base::StringToInt(t.token(), &height); |
+ sizes_.insert(gfx::Size(width, height)); |
+ } |
+ |
+ if (!no_errors) |
+ sizes_.clear(); |
+} |
+ |
+FaviconSizes::FaviconSizes( |
+ const std::vector<gfx::Size>& vector_representation) { |
+ for (size_t i = 0; i < vector_representation.size(); ++i) |
+ sizes_.insert(vector_representation[i]); |
+} |
+ |
+FaviconSizes::~FaviconSizes() { |
+} |
+ |
+void FaviconSizes::InsertSize(const gfx::Size& size) { |
+ sizes_.insert(size); |
+} |
+ |
+std::string FaviconSizes::ToString() const { |
+ std::vector<std::string> parts; |
+ for (std::set<gfx::Size>::const_iterator it = sizes_.begin(); |
+ it != sizes_.end(); ++it) { |
+ parts.push_back(base::IntToString(it->width())); |
+ parts.push_back(base::IntToString(it->height())); |
+ } |
+ return JoinString(parts, ' '); |
+} |
+ |
+std::vector<gfx::Size> FaviconSizes::ToVector() const { |
+ std::vector<gfx::Size> out_vector; |
+ for (std::set<gfx::Size>::const_iterator it = sizes_.begin(); |
+ it != sizes_.end(); ++it) { |
+ out_vector.push_back(*it); |
+ } |
+ return out_vector; |
+} |
+ |
+// FaviconDataElement --------------------------------------------------------- |
+ |
+FaviconDataElement::FaviconDataElement() { |
+} |
+ |
+FaviconDataElement::~FaviconDataElement() { |
+} |
+ |
+// FaviconData ---------------------------------------------------------------- |
FaviconData::FaviconData() |
: known_icon(false), |
@@ -439,7 +499,38 @@ FaviconData::FaviconData() |
FaviconData::~FaviconData() {} |
bool FaviconData::is_valid() { |
- return known_icon && image_data.get() && image_data->size(); |
+ if (!known_icon || elements.empty()) |
+ return false; |
+ |
+ for (size_t i = 0; i < elements.size(); ++i) { |
+ if (!elements[i].bitmap_data.get() || !elements[i].bitmap_data->size()) |
+ return false; |
+ } |
+ return true; |
+} |
+ |
+// FaviconBitmapIDSize --------------------------------------------------------- |
+ |
+FaviconBitmapIDSize::FaviconBitmapIDSize() |
+ : bitmap_id(0) { |
+} |
+ |
+FaviconBitmapIDSize::~FaviconBitmapIDSize() {} |
+ |
+// FaviconBitmap --------------------------------------------------------------- |
+ |
+FaviconBitmap::FaviconBitmap() { |
+} |
+ |
+FaviconBitmap::~FaviconBitmap() { |
+} |
+ |
+// ImportedFaviconUsage -------------------------------------------------------- |
+ |
+ImportedFaviconUsage::ImportedFaviconUsage() { |
+} |
+ |
+ImportedFaviconUsage::~ImportedFaviconUsage() { |
} |
} // namespace history |