• 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 #include <wtf/HashMap.h>
29 
30 namespace WebCore {
31 
32 class Page;
33 class String;
34 class WMLCardElement;
35 
36 typedef HashMap<String, String> WMLVariableMap;
37 
38 class WMLPageState {
39 public:
40     WMLPageState(Page*);
41     virtual ~WMLPageState();
42 
43 #ifndef NDEBUG
44     void dump();
45 #endif
46 
47     // Reset the browser context
48     void reset();
49 
50     // Variable handling
storeVariable(const String & name,const String & value)51     void storeVariable(const String& name, const String& value) { m_variables.set(name, value); }
storeVariables(WMLVariableMap & variables)52     void storeVariables(WMLVariableMap& variables) { m_variables = variables; }
getVariable(const String & name)53     String getVariable(const String& name) const { return m_variables.get(name); }
hasVariables()54     bool hasVariables() const { return !m_variables.isEmpty(); }
55 
page()56     Page* page() const { return m_page; }
57 
58     // Deck access control
59     bool processAccessControlData(const String& dmain, const String& path);
60     void resetAccessControlData();
61 
62     bool canAccessDeck() const;
63 
64 private:
65     bool hostIsAllowedToAccess(const String&) const;
66     bool pathIsAllowedToAccess(const String&) const;
67 
68 private:
69     Page* m_page;
70     WMLVariableMap m_variables;
71     String m_accessDomain;
72     String m_accessPath;
73     bool m_hasAccessControlData;
74 };
75 
76 }
77 
78 #endif
79 #endif
80