Tizen 2.0 Release
[framework/osp/web.git] / src / FWebHistoryItem.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file                FWebHistoryItem.cpp
20  * @brief               The file contains the definition of HistoryItem class.
21  *
22  * This file contains the definition of HistoryItem class.
23  */
24 #include <new>
25 #include <FBaseResult.h>
26 #include <FBaseSysLog.h>
27 #include <FWebHistoryItem.h>
28 #include "FWeb_HistoryItemImpl.h"
29
30
31 using namespace Tizen::Base;
32 using namespace Tizen::Graphics;
33
34
35 namespace Tizen { namespace Web
36 {
37
38
39 HistoryItem::HistoryItem(void)
40         : __pHistoryItemImpl(new (std::nothrow) _HistoryItemImpl())
41 {
42         SysTryReturnVoidResult(NID_WEB, __pHistoryItemImpl, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
43 }
44
45
46 HistoryItem::~HistoryItem(void)
47 {
48         delete __pHistoryItemImpl;
49         __pHistoryItemImpl = null;
50 }
51
52
53 String
54 HistoryItem::GetTitle(void) const
55 {
56         SysAssertf(__pHistoryItemImpl != null, "Not yet constructed. Construct() should be called before use.");
57
58         return __pHistoryItemImpl->GetTitle();
59 }
60
61
62 String
63 HistoryItem::GetUrl(void) const
64 {
65         SysAssertf(__pHistoryItemImpl != null, "Not yet constructed. Construct() should be called before use.");
66
67         return __pHistoryItemImpl->GetUrl();
68 }
69
70 Bitmap*
71 HistoryItem::GetFaviconN(void) const
72 {
73         SysAssertf(__pHistoryItemImpl != null, "Not yet constructed. Construct() should be called before use.");
74
75         ClearLastResult();
76
77         Bitmap* pFavicon = __pHistoryItemImpl->GetFaviconN();
78         SysTryReturn(NID_WEB, pFavicon, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
79
80         return pFavicon;
81 }
82
83
84 }} // Tizen::Web