oops, I shifted the wrong value.
[swfdec.git] / swfdec / swfdec_system_security.c
blob404f6895413dd443cc9905cc23335bbd13c14b06
1 /* Swfdec
2 * Copyright (C) 2007 Pekka Lampila <pekka.lampila@iki.fi>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301 USA
20 #ifdef HAVE_CONFIG_H
21 #include "config.h"
22 #endif
24 #include "swfdec_as_internal.h"
25 #include "swfdec_debug.h"
26 #include "swfdec_as_strings.h"
27 #include "swfdec_resource.h"
28 #include "swfdec_player_internal.h"
29 #include "swfdec_policy_file.h"
31 // properties
32 SWFDEC_AS_NATIVE (12, 0, swfdec_system_security_allowDomain)
33 void
34 swfdec_system_security_allowDomain (SwfdecAsContext *cx,
35 SwfdecAsObject *object, guint argc, SwfdecAsValue *argv,
36 SwfdecAsValue *ret)
38 SWFDEC_STUB ("System.security.allowDomain (static)");
41 SWFDEC_AS_NATIVE (12, 1, swfdec_system_security_allowInsecureDomain)
42 void
43 swfdec_system_security_allowInsecureDomain (SwfdecAsContext *cx,
44 SwfdecAsObject *object, guint argc, SwfdecAsValue *argv,
45 SwfdecAsValue *ret)
47 SWFDEC_STUB ("System.security.allowInsecureDomain (static)");
50 static void
51 swfdec_system_security_do_loadPolicyFile (gpointer url, gpointer player)
53 swfdec_policy_file_new (player, url);
56 SWFDEC_AS_NATIVE (12, 2, swfdec_system_security_loadPolicyFile)
57 void
58 swfdec_system_security_loadPolicyFile (SwfdecAsContext *cx,
59 SwfdecAsObject *object, guint argc, SwfdecAsValue *argv,
60 SwfdecAsValue *ret)
62 SwfdecPlayer *player;
63 const char *url_string;
64 SwfdecURL *url;
66 SWFDEC_AS_CHECK (0, NULL, "s", &url_string);
68 player = SWFDEC_PLAYER (cx);
69 url = swfdec_player_create_url (player, url_string);
70 swfdec_player_request_resource (player, swfdec_system_security_do_loadPolicyFile,
71 url, (GDestroyNotify) swfdec_url_free);
74 SWFDEC_AS_NATIVE (12, 3, swfdec_system_security_chooseLocalSwfPath)
75 void
76 swfdec_system_security_chooseLocalSwfPath (SwfdecAsContext *cx,
77 SwfdecAsObject *object, guint argc, SwfdecAsValue *argv,
78 SwfdecAsValue *ret)
80 SWFDEC_STUB ("System.security.chooseLocalSwfPath (static)");
83 SWFDEC_AS_NATIVE (12, 4, swfdec_system_security_escapeDomain)
84 void
85 swfdec_system_security_escapeDomain (SwfdecAsContext *cx,
86 SwfdecAsObject *object, guint argc, SwfdecAsValue *argv,
87 SwfdecAsValue *ret)
89 SWFDEC_STUB ("System.security.escapeDomain (static)");
92 SWFDEC_AS_NATIVE (12, 5, swfdec_system_security_get_sandboxType)
93 void
94 swfdec_system_security_get_sandboxType (SwfdecAsContext *cx,
95 SwfdecAsObject *object, guint argc, SwfdecAsValue *argv,
96 SwfdecAsValue *ret)
98 switch (SWFDEC_SANDBOX (cx->global)->type) {
99 case SWFDEC_SANDBOX_REMOTE:
100 SWFDEC_AS_VALUE_SET_STRING (ret, SWFDEC_AS_STR_remote);
101 break;
103 case SWFDEC_SANDBOX_LOCAL_FILE:
104 SWFDEC_AS_VALUE_SET_STRING (ret, SWFDEC_AS_STR_localWithFile);
105 break;
107 case SWFDEC_SANDBOX_LOCAL_NETWORK:
108 SWFDEC_AS_VALUE_SET_STRING (ret, SWFDEC_AS_STR_localWithNetwork);
109 break;
111 case SWFDEC_SANDBOX_LOCAL_TRUSTED:
112 SWFDEC_AS_VALUE_SET_STRING (ret, SWFDEC_AS_STR_localTrusted);
113 break;
115 case SWFDEC_SANDBOX_NONE:
116 default:
117 g_return_if_reached ();
121 SWFDEC_AS_NATIVE (12, 6, swfdec_system_security_set_sandboxType)
122 void
123 swfdec_system_security_set_sandboxType (SwfdecAsContext *cx,
124 SwfdecAsObject *object, guint argc, SwfdecAsValue *argv,
125 SwfdecAsValue *ret)
127 // read-only
130 // PolicyFileResolver
132 SWFDEC_AS_NATIVE (15, 0, swfdec_system_security_policy_file_resolver_resolve)
133 void
134 swfdec_system_security_policy_file_resolver_resolve (SwfdecAsContext *cx,
135 SwfdecAsObject *object, guint argc, SwfdecAsValue *argv,
136 SwfdecAsValue *ret)
138 SWFDEC_STUB ("System.security.PolicyFileResolver.resolve");