~ubuntu-branches/ubuntu/jaunty/swfdec0.8/jaunty

« back to all changes in this revision

Viewing changes to swfdec/swfdec_system_security.c

  • Committer: Package Import Robot
  • Author(s): Didier Roche
  • Date: 2008-10-10 19:15:24 UTC
  • Revision ID: package-import@ubuntu.com-20081010191524-5z85qiky1d4bvgfa
Tags: upstream-0.8.0
ImportĀ upstreamĀ versionĀ 0.8.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Swfdec
 
2
 * Copyright (C) 2007 Pekka Lampila <pekka.lampila@iki.fi>
 
3
 *
 
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.
 
13
 * 
 
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
 
18
 */
 
19
 
 
20
#ifdef HAVE_CONFIG_H
 
21
#include "config.h"
 
22
#endif
 
23
 
 
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
 
 
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)
 
37
{
 
38
  SWFDEC_STUB ("System.security.allowDomain (static)");
 
39
}
 
40
 
 
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)
 
46
{
 
47
  SWFDEC_STUB ("System.security.allowInsecureDomain (static)");
 
48
}
 
49
 
 
50
static void
 
51
swfdec_system_security_do_loadPolicyFile (gpointer url, gpointer player)
 
52
{
 
53
  swfdec_policy_file_new (player, url);
 
54
}
 
55
 
 
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)
 
61
{
 
62
  SwfdecPlayer *player;
 
63
  const char *url_string;
 
64
  SwfdecURL *url;
 
65
 
 
66
  SWFDEC_AS_CHECK (0, NULL, "s", &url_string);
 
67
 
 
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);
 
72
}
 
73
 
 
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)
 
79
{
 
80
  SWFDEC_STUB ("System.security.chooseLocalSwfPath (static)");
 
81
}
 
82
 
 
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)
 
88
{
 
89
  SWFDEC_STUB ("System.security.escapeDomain (static)");
 
90
}
 
91
 
 
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)
 
97
{
 
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;
 
102
 
 
103
    case SWFDEC_SANDBOX_LOCAL_FILE:
 
104
      SWFDEC_AS_VALUE_SET_STRING (ret, SWFDEC_AS_STR_localWithFile);
 
105
      break;
 
106
 
 
107
    case SWFDEC_SANDBOX_LOCAL_NETWORK:
 
108
      SWFDEC_AS_VALUE_SET_STRING (ret, SWFDEC_AS_STR_localWithNetwork);
 
109
      break;
 
110
 
 
111
    case SWFDEC_SANDBOX_LOCAL_TRUSTED:
 
112
      SWFDEC_AS_VALUE_SET_STRING (ret, SWFDEC_AS_STR_localTrusted);
 
113
      break;
 
114
 
 
115
    case SWFDEC_SANDBOX_NONE:
 
116
    default:
 
117
      g_return_if_reached ();
 
118
  }
 
119
}
 
120
 
 
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)
 
126
{
 
127
  // read-only
 
128
}
 
129
 
 
130
// PolicyFileResolver
 
131
 
 
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)
 
137
{
 
138
  SWFDEC_STUB ("System.security.PolicyFileResolver.resolve");
 
139
}