• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
3  *
4  * Copyright (C) 2004-2007 Apple Inc. All rights reserved.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public License
17  * along with this library; see the file COPYING.LIB.  If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef WMLPageState_h
24 #define WMLPageState_h
25 
26 #if ENABLE(WML)
27 #include "StringHash.h"
28 
29 namespace WebCore {
30 
31 class Page;
32 class String;
33 class WMLCardElement;
34 
35 typedef HashMap<String, String> WMLVariableMap;
36 
37 class WMLPageState {
38 public:
39     WMLPageState(Page*);
40     virtual ~WMLPageState();
41 
42 #ifndef NDEBUG
43     void dump();
44 #endif
45 
46     // Reset the browser context
47     void reset();
48 
49     // Variable handling
storeVariable(const String & name,const String & value)50     void storeVariable(const String& name, const String& value) { m_variables.set(name, value); }
storeVariables(WMLVariableMap & variables)51     void storeVariables(WMLVariableMap& variables) { m_variables = variables; }
getVariable(const String & name)52     String getVariable(const String& name) const { return m_variables.get(name); }
hasVariables()53     bool hasVariables() const { return !m_variables.isEmpty(); }
54 
page()55     Page* page() const { return m_page; }
56 
activeCard()57     WMLCardElement* activeCard() const { return m_activeCard; }
setActiveCard(WMLCardElement * card)58     void setActiveCard(WMLCardElement* card) { m_activeCard = card; }
59 
60     // Deck access control
61     bool processAccessControlData(const String& dmain, const String& path);
62     void resetAccessControlData();
63 
64     bool canAccessDeck() const;
65 
66 private:
67     bool hostIsAllowedToAccess(const String&) const;
68     bool pathIsAllowedToAccess(const String&) const;
69 
70 private:
71     Page* m_page;
72     WMLVariableMap m_variables;
73     WMLCardElement* m_activeCard;
74     String m_accessDomain;
75     String m_accessPath;
76     bool m_hasAccessControlData;
77 };
78 
79 }
80 
81 #endif
82 #endif
83