| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef PPAPI_CPP_DEV_URL_UTIL_DEV_H_ | 5 #ifndef PPAPI_CPP_DEV_URL_UTIL_DEV_H_ |
| 6 #define PPAPI_CPP_DEV_URL_UTIL_DEV_H_ | 6 #define PPAPI_CPP_DEV_URL_UTIL_DEV_H_ |
| 7 | 7 |
| 8 #include "ppapi/c/dev/ppb_url_util_dev.h" | 8 #include "ppapi/c/dev/ppb_url_util_dev.h" |
| 9 #include "ppapi/cpp/var.h" | 9 #include "ppapi/cpp/var.h" |
| 10 | 10 |
| 11 namespace pp { | 11 namespace pp { |
| 12 | 12 |
| 13 class Instance; | 13 class Instance; |
| 14 class Module; | 14 class Module; |
| 15 | 15 |
| 16 // Simple wrapper around the PPB_UrlUtil interface. | 16 // Simple wrapper around the PPB_URLUtil interface. |
| 17 class UrlUtil_Dev { | 17 class URLUtil_Dev { |
| 18 public: | 18 public: |
| 19 // This class is just a collection of random functions that aren't | 19 // This class is just a collection of random functions that aren't |
| 20 // particularly attached to anything. So this getter returns a cached | 20 // particularly attached to anything. So this getter returns a cached |
| 21 // instance of this interface. This may return NULL if the browser doesn't | 21 // instance of this interface. This may return NULL if the browser doesn't |
| 22 // support the UrlUtil inteface. Since this is a singleton, don't delete the | 22 // support the URLUtil inteface. Since this is a singleton, don't delete the |
| 23 // pointer. | 23 // pointer. |
| 24 static const UrlUtil_Dev* Get(); | 24 static const URLUtil_Dev* Get(); |
| 25 | 25 |
| 26 Var Canonicalize(const Var& url, | 26 Var Canonicalize(const Var& url, |
| 27 PP_UrlComponents_Dev* components = NULL) const; | 27 PP_URLComponents_Dev* components = NULL) const; |
| 28 | 28 |
| 29 Var ResolveRelativeToUrl(const Var& base_url, | 29 Var ResolveRelativeToURL(const Var& base_url, |
| 30 const Var& relative_string, | 30 const Var& relative_string, |
| 31 PP_UrlComponents_Dev* components = NULL) const; | 31 PP_URLComponents_Dev* components = NULL) const; |
| 32 Var ResoveRelativeToDocument(const Instance& instance, | 32 Var ResoveRelativeToDocument(const Instance& instance, |
| 33 const Var& relative_string, | 33 const Var& relative_string, |
| 34 PP_UrlComponents_Dev* components = NULL) const; | 34 PP_URLComponents_Dev* components = NULL) const; |
| 35 | 35 |
| 36 bool IsSameSecurityOrigin(const Var& url_a, const Var& url_b) const; | 36 bool IsSameSecurityOrigin(const Var& url_a, const Var& url_b) const; |
| 37 bool DocumentCanRequest(const Instance& instance, const Var& url) const; | 37 bool DocumentCanRequest(const Instance& instance, const Var& url) const; |
| 38 bool DocumentCanAccessDocument(const Instance& active, | 38 bool DocumentCanAccessDocument(const Instance& active, |
| 39 const Instance& target) const; | 39 const Instance& target) const; |
| 40 Var GetDocumentURL(const Instance& instance, |
| 41 PP_URLComponents_Dev* components = NULL) const; |
| 40 | 42 |
| 41 private: | 43 private: |
| 42 UrlUtil_Dev() : interface_(NULL) {} | 44 URLUtil_Dev() : interface_(NULL) {} |
| 43 | 45 |
| 44 // Copy and assignment are disallowed. | 46 // Copy and assignment are disallowed. |
| 45 UrlUtil_Dev(const UrlUtil_Dev& other); | 47 URLUtil_Dev(const URLUtil_Dev& other); |
| 46 UrlUtil_Dev& operator=(const UrlUtil_Dev& other); | 48 URLUtil_Dev& operator=(const URLUtil_Dev& other); |
| 47 | 49 |
| 48 const PPB_UrlUtil_Dev* interface_; | 50 const PPB_URLUtil_Dev* interface_; |
| 49 }; | 51 }; |
| 50 | 52 |
| 51 } // namespace pp | 53 } // namespace pp |
| 52 | 54 |
| 53 #endif // PPAPI_CPP_DEV_URL_UTIL_DEV_H_ | 55 #endif // PPAPI_CPP_DEV_URL_UTIL_DEV_H_ |
| 54 | 56 |
| OLD | NEW |