Elim cr-checkbox
[chromium-blink-merge.git] / ppapi / cpp / dev / url_util_dev.h
blobdb63e7a3a0182c29a1dc05f090cb7f4a729b1a6b
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"
11 namespace pp {
13 class InstanceHandle;
15 // Simple wrapper around the PPB_URLUtil interface.
16 class URLUtil_Dev {
17 public:
18 // This class is just a collection of random functions that aren't
19 // particularly attached to anything. This may return NULL if the
20 // browser doesn't support the URLUtil interface. Since this is a
21 // singleton, don't delete the pointer.
22 static const URLUtil_Dev* Get();
24 Var Canonicalize(const Var& url,
25 PP_URLComponents_Dev* components = NULL) const;
27 Var ResolveRelativeToURL(const Var& base_url,
28 const Var& relative_string,
29 PP_URLComponents_Dev* components = NULL) const;
30 Var ResolveRelativeToDocument(const InstanceHandle& instance,
31 const Var& relative_string,
32 PP_URLComponents_Dev* components = NULL) const;
34 bool IsSameSecurityOrigin(const Var& url_a, const Var& url_b) const;
35 bool DocumentCanRequest(const InstanceHandle& instance, const Var& url) const;
36 bool DocumentCanAccessDocument(const InstanceHandle& active,
37 const InstanceHandle& target) const;
38 Var GetDocumentURL(const InstanceHandle& instance,
39 PP_URLComponents_Dev* components = NULL) const;
41 Var GetPluginInstanceURL(const InstanceHandle& instance,
42 PP_URLComponents_Dev* components = NULL) const;
43 Var GetPluginReferrerURL(const InstanceHandle& instance,
44 PP_URLComponents_Dev* components = NULL) const;
46 private:
47 URLUtil_Dev() {}
49 // Copy and assignment are disallowed.
50 URLUtil_Dev(const URLUtil_Dev& other);
51 URLUtil_Dev& operator=(const URLUtil_Dev& other);
54 } // namespace pp
56 #endif // PPAPI_CPP_DEV_URL_UTIL_DEV_H_