SwfdecAsObjectClass is gone now
[swfdec.git] / swfdec / swfdec_system_security.c
blobb6a7a098404c1b14105c3f7cf4b858cee6f9db8f
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"
30 #include "swfdec_sandbox.h"
32 // properties
33 SWFDEC_AS_NATIVE (12, 0, swfdec_system_security_allowDomain)
34 void
35 swfdec_system_security_allowDomain (SwfdecAsContext *cx,
36 SwfdecAsObject *object, guint argc, SwfdecAsValue *argv,
37 SwfdecAsValue *ret)
39 SWFDEC_STUB ("System.security.allowDomain (static)");
42 SWFDEC_AS_NATIVE (12, 1, swfdec_system_security_allowInsecureDomain)
43 void
44 swfdec_system_security_allowInsecureDomain (SwfdecAsContext *cx,
45 SwfdecAsObject *object, guint argc, SwfdecAsValue *argv,
46 SwfdecAsValue *ret)
48 SWFDEC_STUB ("System.security.allowInsecureDomain (static)");
51 static void
52 swfdec_system_security_do_loadPolicyFile (gpointer url, gpointer player)
54 swfdec_policy_file_new (player, url);
57 SWFDEC_AS_NATIVE (12, 2, swfdec_system_security_loadPolicyFile)
58 void
59 swfdec_system_security_loadPolicyFile (SwfdecAsContext *cx,
60 SwfdecAsObject *object, guint argc, SwfdecAsValue *argv,
61 SwfdecAsValue *ret)
63 SwfdecPlayer *player;
64 const char *url_string;
65 SwfdecURL *url;
67 SWFDEC_AS_CHECK (0, NULL, "s", &url_string);
69 player = SWFDEC_PLAYER (cx);
70 url = swfdec_player_create_url (player, url_string);
71 swfdec_player_request_resource (player, swfdec_system_security_do_loadPolicyFile,
72 url, (GDestroyNotify) swfdec_url_free);
75 SWFDEC_AS_NATIVE (12, 3, swfdec_system_security_chooseLocalSwfPath)
76 void
77 swfdec_system_security_chooseLocalSwfPath (SwfdecAsContext *cx,
78 SwfdecAsObject *object, guint argc, SwfdecAsValue *argv,
79 SwfdecAsValue *ret)
81 SWFDEC_STUB ("System.security.chooseLocalSwfPath (static)");
84 SWFDEC_AS_NATIVE (12, 4, swfdec_system_security_escapeDomain)
85 void
86 swfdec_system_security_escapeDomain (SwfdecAsContext *cx,
87 SwfdecAsObject *object, guint argc, SwfdecAsValue *argv,
88 SwfdecAsValue *ret)
90 SWFDEC_STUB ("System.security.escapeDomain (static)");
93 SWFDEC_AS_NATIVE (12, 5, swfdec_system_security_get_sandboxType)
94 void
95 swfdec_system_security_get_sandboxType (SwfdecAsContext *cx,
96 SwfdecAsObject *object, guint argc, SwfdecAsValue *argv,
97 SwfdecAsValue *ret)
99 switch (swfdec_sandbox_get (SWFDEC_PLAYER (cx))->type) {
100 case SWFDEC_SANDBOX_REMOTE:
101 SWFDEC_AS_VALUE_SET_STRING (ret, SWFDEC_AS_STR_remote);
102 break;
104 case SWFDEC_SANDBOX_LOCAL_FILE:
105 SWFDEC_AS_VALUE_SET_STRING (ret, SWFDEC_AS_STR_localWithFile);
106 break;
108 case SWFDEC_SANDBOX_LOCAL_NETWORK:
109 SWFDEC_AS_VALUE_SET_STRING (ret, SWFDEC_AS_STR_localWithNetwork);
110 break;
112 case SWFDEC_SANDBOX_LOCAL_TRUSTED:
113 SWFDEC_AS_VALUE_SET_STRING (ret, SWFDEC_AS_STR_localTrusted);
114 break;
116 case SWFDEC_SANDBOX_NONE:
117 default:
118 g_return_if_reached ();
122 SWFDEC_AS_NATIVE (12, 6, swfdec_system_security_set_sandboxType)
123 void
124 swfdec_system_security_set_sandboxType (SwfdecAsContext *cx,
125 SwfdecAsObject *object, guint argc, SwfdecAsValue *argv,
126 SwfdecAsValue *ret)
128 // read-only
131 // PolicyFileResolver
133 SWFDEC_AS_NATIVE (15, 0, swfdec_system_security_policy_file_resolver_resolve)
134 void
135 swfdec_system_security_policy_file_resolver_resolve (SwfdecAsContext *cx,
136 SwfdecAsObject *object, guint argc, SwfdecAsValue *argv,
137 SwfdecAsValue *ret)
139 SWFDEC_STUB ("System.security.PolicyFileResolver.resolve");