• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2010 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23  * THE POSSIBILITY OF SUCH DAMAGE.
24  */
25 
26 #ifndef PluginQuirks_h
27 #define PluginQuirks_h
28 
29 namespace WebKit {
30 
31 class PluginQuirks {
32 public:
33     enum PluginQuirk {
34         // Mac specific quirks:
35 #if PLUGIN_ARCHITECTURE(MAC)
36         // The plug-in wants the call to getprogame() to return "WebKitPluginHost".
37         // Adobe Flash Will not handle key down events otherwise.
38         PrognameShouldBeWebKitPluginHost,
39 
40         // Supports receiving a paint event, even when using CoreAnimation rendering.
41         SupportsSnapshotting,
42 
43         // Make the plug-in transparent if it has a "background" attribute set.
44         // Microsoft Silverlight doesn't opt into transparency using NPN_SetValue and
45         // NPPVpluginTransparentBool, so we'll always force if the plug-in has a "background"
46         // attribute specified, regardless of it's value.
47         // FIXME: We could get more fancy here and check for specific values that we know are
48         // transparent.
49         MakeTransparentIfBackgroundAttributeExists,
50 
51 #ifndef NP_NO_QUICKDRAW
52         // Allow the plug-in to use the QuickDraw drawing model, since we know that the plug-in
53         // will never paint or receive events. Used by the AppleConnect plug-in.
54         AllowHalfBakedQuickDrawSupport,
55 #endif
56 
57         // X11 specific quirks:
58 #elif PLUGIN_ARCHITECTURE(X11)
59         // Flash and npwrapper ask the browser about which GTK version does it use
60         // and refuse to load and work if it is not GTK 2 so we need to fake it in
61         // NPN_GetValue even when it is a lie.
62         RequiresGTKToolKit,
63 #endif
64         NumPluginQuirks
65     };
66 
PluginQuirks()67     PluginQuirks()
68         : m_quirks(0)
69     {
70         COMPILE_ASSERT(sizeof(m_quirks) * 8 >= NumPluginQuirks, not_enough_room_for_quirks);
71     }
72 
add(PluginQuirk quirk)73     void add(PluginQuirk quirk)
74     {
75         ASSERT(quirk >= 0);
76         ASSERT(quirk < NumPluginQuirks);
77 
78         m_quirks |= (1 << quirk);
79     }
80 
contains(PluginQuirk quirk)81     bool contains(PluginQuirk quirk) const
82     {
83         return m_quirks & (1 << quirk);
84     }
85 
86 private:
87     uint32_t m_quirks;
88 };
89 
90 } // namespace WebKit
91 
92 #endif // PluginQuirkSet_h
93