Fixed Nabi Issues N_SE-56966,56735
[apps/osp/Internet.git] / src / IntHistory.cpp
index 634e369..a62ad5a 100644 (file)
@@ -2,7 +2,7 @@
 
 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
 //
-// Licensed under the Flora License, Version 1.0 (the License);
+// Licensed under the Flora License, Version 1.1 (the License);
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
@@ -45,6 +45,9 @@ History::History(void)
     , __visitedCount(0)
        , __pThumbnail(null)
     , __thumbnailPath("")
+       ,__pFavIconData(null)
+       ,__favIconHeight(0)
+       ,__favIconWidth(0)
 {
        AppLog("History::History(void)");
        __visitedTime.SetValue(0,0,0);
@@ -60,10 +63,14 @@ History::History(const History& hs)
 
 History::~History(void)
 {
-       if(__pThumbnail != null)
+       if (__pThumbnail != null)
        {
                delete __pThumbnail; //TODO To get this reviewed
        }
+       if (__pFavIconData)
+       {
+               delete __pFavIconData;
+       }
        AppLog("History::~History()");
 }
 
@@ -208,3 +215,73 @@ History::SetThumbnailPath(String& thumbnailPath)
 {
        __thumbnailPath = thumbnailPath;
 }
+
+void
+History::SetFavIconBitmap(Tizen::Graphics::Bitmap& favIconImage)
+{
+       Image* pImage = null;
+       pImage = new Image();
+       pImage->Construct();
+       if (__pFavIconData != null)
+       {
+               delete __pFavIconData;
+               __pFavIconData = null;
+       }
+       __pFavIconData = pImage->EncodeToBufferN(favIconImage,Tizen::Media::IMG_FORMAT_PNG);
+
+       __favIconWidth = favIconImage.GetWidth();
+       __favIconHeight = favIconImage.GetHeight();
+
+       delete pImage;
+}
+
+void
+History::SetFavIconBuffer(Tizen::Base::ByteBuffer& favIconBuffer)
+{
+       __pFavIconData = &favIconBuffer;
+}
+
+ByteBuffer*
+History::GetFavIconBuffer()
+{
+       return __pFavIconData;
+}
+
+Bitmap*
+History::GetFavIconBitmap()
+{
+       Bitmap *pBitmap = null;
+
+       if (__pFavIconData != null)
+       {
+               Image *pImage = new(std::nothrow) Image();
+               pImage->Construct();
+               pBitmap = pImage->DecodeN(*__pFavIconData, IMG_FORMAT_PNG, BITMAP_PIXEL_FORMAT_ARGB8888);
+               delete pImage;
+       }
+       return pBitmap;
+}
+
+int
+History::GetFavIconWidth()
+{
+       return __favIconWidth;
+}
+
+int
+History::GetFavIconHeight()
+{
+       return __favIconHeight;
+}
+
+void
+History::SetFavIconWidth(int width)
+{
+       __favIconWidth = width;
+}
+
+void
+History::SetFavIconHeight(int height)
+{
+       __favIconHeight = height;
+}