OLD | NEW |
1 /* | 1 /* |
2 Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 2 Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
3 | 3 |
4 This library is free software; you can redistribute it and/or | 4 This library is free software; you can redistribute it and/or |
5 modify it under the terms of the GNU Library General Public | 5 modify it under the terms of the GNU Library General Public |
6 License as published by the Free Software Foundation; either | 6 License as published by the Free Software Foundation; either |
7 version 2 of the License, or (at your option) any later version. | 7 version 2 of the License, or (at your option) any later version. |
8 | 8 |
9 This library is distributed in the hope that it will be useful, | 9 This library is distributed in the hope that it will be useful, |
10 but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 Library General Public License for more details. | 12 Library General Public License for more details. |
13 | 13 |
14 You should have received a copy of the GNU Library General Public License | 14 You should have received a copy of the GNU Library General Public License |
15 along with this library; see the file COPYING.LIB. If not, write to | 15 along with this library; see the file COPYING.LIB. If not, write to |
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
17 Boston, MA 02110-1301, USA. | 17 Boston, MA 02110-1301, USA. |
18 */ | 18 */ |
19 | 19 |
20 #ifndef PluginData_h | 20 #ifndef PluginData_h |
21 #define PluginData_h | 21 #define PluginData_h |
22 | 22 |
23 #include "platform/PlatformExport.h" | 23 #include "platform/PlatformExport.h" |
| 24 #include "platform/weborigin/SecurityOrigin.h" |
24 #include "wtf/Noncopyable.h" | 25 #include "wtf/Noncopyable.h" |
25 #include "wtf/RefCounted.h" | 26 #include "wtf/RefCounted.h" |
26 #include "wtf/Vector.h" | 27 #include "wtf/Vector.h" |
27 #include "wtf/text/WTFString.h" | 28 #include "wtf/text/WTFString.h" |
28 | 29 |
29 namespace blink { | 30 namespace blink { |
30 | 31 |
31 class Page; | |
32 struct PluginInfo; | 32 struct PluginInfo; |
33 | 33 |
34 struct MimeClassInfo { | 34 struct MimeClassInfo { |
35 String type; | 35 String type; |
36 String desc; | 36 String desc; |
37 Vector<String> extensions; | 37 Vector<String> extensions; |
38 }; | 38 }; |
39 | 39 |
40 inline bool operator==(const MimeClassInfo& a, const MimeClassInfo& b) | 40 inline bool operator==(const MimeClassInfo& a, const MimeClassInfo& b) |
41 { | 41 { |
42 return a.type == b.type && a.desc == b.desc && a.extensions == b.extensions; | 42 return a.type == b.type && a.desc == b.desc && a.extensions == b.extensions; |
43 } | 43 } |
44 | 44 |
45 struct PluginInfo { | 45 struct PluginInfo { |
46 String name; | 46 String name; |
47 String file; | 47 String file; |
48 String desc; | 48 String desc; |
49 Vector<MimeClassInfo> mimes; | 49 Vector<MimeClassInfo> mimes; |
50 }; | 50 }; |
51 | 51 |
52 class PLATFORM_EXPORT PluginData : public RefCounted<PluginData> { | 52 class PLATFORM_EXPORT PluginData : public RefCounted<PluginData> { |
53 WTF_MAKE_NONCOPYABLE(PluginData); | 53 WTF_MAKE_NONCOPYABLE(PluginData); |
54 public: | 54 public: |
55 static PassRefPtr<PluginData> create(const Page* page) { return adoptRef(new
PluginData(page)); } | 55 static PassRefPtr<PluginData> create(const RefPtr<SecurityOrigin> mainFrameO
rigin) { return adoptRef(new PluginData(mainFrameOrigin)); } |
56 | 56 |
57 const Vector<PluginInfo>& plugins() const { return m_plugins; } | 57 const Vector<PluginInfo>& plugins() const { return m_plugins; } |
58 const Vector<MimeClassInfo>& mimes() const { return m_mimes; } | 58 const Vector<MimeClassInfo>& mimes() const { return m_mimes; } |
59 const Vector<size_t>& mimePluginIndices() const { return m_mimePluginIndices
; } | 59 const Vector<size_t>& mimePluginIndices() const { return m_mimePluginIndices
; } |
| 60 const SecurityOrigin* origin() const { return m_mainFrameOrigin.get(); } |
60 | 61 |
61 bool supportsMimeType(const String& mimeType) const; | 62 bool supportsMimeType(const String& mimeType) const; |
62 String pluginNameForMimeType(const String& mimeType) const; | 63 String pluginNameForMimeType(const String& mimeType) const; |
63 | 64 |
64 static void refresh(); | 65 static void refresh(); |
| 66 static bool m_refresh; |
65 | 67 |
66 private: | 68 private: |
67 explicit PluginData(const Page*); | 69 explicit PluginData(const RefPtr<SecurityOrigin> mainFrameOrigin); |
68 void initPlugins(const Page*); | |
69 const PluginInfo* pluginInfoForMimeType(const String& mimeType) const; | 70 const PluginInfo* pluginInfoForMimeType(const String& mimeType) const; |
70 | 71 |
71 Vector<PluginInfo> m_plugins; | 72 Vector<PluginInfo> m_plugins; |
72 Vector<MimeClassInfo> m_mimes; | 73 Vector<MimeClassInfo> m_mimes; |
73 Vector<size_t> m_mimePluginIndices; | 74 Vector<size_t> m_mimePluginIndices; |
| 75 RefPtr<SecurityOrigin> m_mainFrameOrigin; |
74 }; | 76 }; |
75 | 77 |
76 } // namespace blink | 78 } // namespace blink |
77 | 79 |
78 #endif | 80 #endif |
OLD | NEW |