Roll src/third_party/WebKit f36d5e0:68b67cd (svn 193299:193303)
[chromium-blink-merge.git] / ppapi / shared_impl / ppb_url_util_shared.h
blob3627ac42646b5c1561567a85c7c905c93a7a08df
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_SHARED_IMPL_PPB_URL_UTIL_SHARED_H_
6 #define PPAPI_SHARED_IMPL_PPB_URL_UTIL_SHARED_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "ppapi/c/dev/ppb_url_util_dev.h"
12 #include "ppapi/c/pp_var.h"
13 #include "ppapi/shared_impl/ppapi_shared_export.h"
14 #include "url/url_parse.h"
16 class GURL;
18 namespace ppapi {
20 // Contains the implementation of PPB_URLUtil that is shared between the proxy
21 // and the renderer.
22 class PPAPI_SHARED_EXPORT PPB_URLUtil_Shared {
23 public:
24 // PPB_URLUtil shared functions.
25 static PP_Var Canonicalize(PP_Var url, PP_URLComponents_Dev* components);
26 static PP_Var ResolveRelativeToURL(PP_Var base_url,
27 PP_Var relative,
28 PP_URLComponents_Dev* components);
29 static PP_Bool IsSameSecurityOrigin(PP_Var url_a, PP_Var url_b);
31 // Used for returning the given GURL from a PPAPI function, with an optional
32 // out param indicating the components.
33 static PP_Var GenerateURLReturn(const GURL& url,
34 PP_URLComponents_Dev* components);
36 // Helper function that optionally take a components structure and fills it
37 // out with the parsed version of the given URL. If the components pointer is
38 // NULL, this function will do nothing.
40 // It's annoying to serialze the large PP_URLComponents structure across IPC
41 // and the data isn't often requested by plugins. This function is used on
42 // the plugin side to fill in the components for those cases where it's
43 // actually needed.
44 static PP_Var ConvertComponentsAndReturnURL(const PP_Var& url,
45 PP_URLComponents_Dev* components);
48 } // namespace ppapi
50 #endif // PPAPI_SHARED_IMPL_PPB_URL_UTIL_SHARED_H_