1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef PPAPI_CPP_DEV_URL_UTIL_DEV_H_
6 #define PPAPI_CPP_DEV_URL_UTIL_DEV_H_
8 #include "ppapi/c/dev/ppb_url_util_dev.h"
9 #include "ppapi/cpp/var.h"
15 // Simple wrapper around the PPB_URLUtil interface.
18 // This class is just a collection of random functions that aren't
19 // particularly attached to anything. So this getter returns a cached
20 // instance of this interface. This may return NULL if the browser doesn't
21 // support the URLUtil interface. Since this is a singleton, don't delete the
23 static const URLUtil_Dev
* Get();
25 Var
Canonicalize(const Var
& url
,
26 PP_URLComponents_Dev
* components
= NULL
) const;
28 Var
ResolveRelativeToURL(const Var
& base_url
,
29 const Var
& relative_string
,
30 PP_URLComponents_Dev
* components
= NULL
) const;
31 Var
ResolveRelativeToDocument(const InstanceHandle
& instance
,
32 const Var
& relative_string
,
33 PP_URLComponents_Dev
* components
= NULL
) const;
35 bool IsSameSecurityOrigin(const Var
& url_a
, const Var
& url_b
) const;
36 bool DocumentCanRequest(const InstanceHandle
& instance
, const Var
& url
) const;
37 bool DocumentCanAccessDocument(const InstanceHandle
& active
,
38 const InstanceHandle
& target
) const;
39 Var
GetDocumentURL(const InstanceHandle
& instance
,
40 PP_URLComponents_Dev
* components
= NULL
) const;
42 Var
GetPluginInstanceURL(const InstanceHandle
& instance
,
43 PP_URLComponents_Dev
* components
= NULL
) const;
46 URLUtil_Dev() : interface_(NULL
) {}
48 // Copy and assignment are disallowed.
49 URLUtil_Dev(const URLUtil_Dev
& other
);
50 URLUtil_Dev
& operator=(const URLUtil_Dev
& other
);
52 const PPB_URLUtil_Dev
* interface_
;
57 #endif // PPAPI_CPP_DEV_URL_UTIL_DEV_H_