blob: 873da0c2b7c702f22a40944cb60e99f024518d39 [file] [log] [blame]
[email protected]9ca245e2011-03-18 01:50:311// 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.
4
[email protected]9a578392011-12-07 18:59:275#ifndef PPAPI_SHARED_IMPL_PPB_URL_UTIL_SHARED_H_
6#define PPAPI_SHARED_IMPL_PPB_URL_UTIL_SHARED_H_
[email protected]9ca245e2011-03-18 01:50:317
8#include <string>
9
10#include "base/basictypes.h"
11#include "googleurl/src/url_parse.h"
12#include "ppapi/c/dev/ppb_url_util_dev.h"
[email protected]9ca245e2011-03-18 01:50:3113#include "ppapi/c/pp_var.h"
[email protected]f0a04c42011-08-26 22:43:2014#include "ppapi/shared_impl/ppapi_shared_export.h"
[email protected]9ca245e2011-03-18 01:50:3115
16class GURL;
17
[email protected]55cdf6052011-05-13 19:22:5318namespace ppapi {
[email protected]9ca245e2011-03-18 01:50:3119
20// Contains the implementation of PPB_URLUtil that is shared between the proxy
21// and the renderer.
[email protected]9a578392011-12-07 18:59:2722class PPAPI_SHARED_EXPORT PPB_URLUtil_Shared {
[email protected]9ca245e2011-03-18 01:50:3123 public:
[email protected]9ca245e2011-03-18 01:50:3124 // PPB_URLUtil shared functions.
[email protected]03460232011-10-10 17:23:5725 static PP_Var Canonicalize(PP_Var url,
[email protected]9ca245e2011-03-18 01:50:3126 PP_URLComponents_Dev* components);
[email protected]03460232011-10-10 17:23:5727 static PP_Var ResolveRelativeToURL(PP_Var base_url,
[email protected]9ca245e2011-03-18 01:50:3128 PP_Var relative,
29 PP_URLComponents_Dev* components);
[email protected]2bbd2c672011-08-09 23:14:1330 static PP_Bool IsSameSecurityOrigin(PP_Var url_a, PP_Var url_b);
[email protected]9ca245e2011-03-18 01:50:3131
32 // Used for returning the given GURL from a PPAPI function, with an optional
33 // out param indicating the components.
[email protected]872caf562011-12-07 22:50:4334 static PP_Var GenerateURLReturn(const GURL& url,
[email protected]9ca245e2011-03-18 01:50:3135 PP_URLComponents_Dev* components);
[email protected]03460232011-10-10 17:23:5736
37 // Helper function that optionally take a components structure and fills it
38 // out with the parsed version of the given URL. If the components pointer is
39 // NULL, this function will do nothing.
40 //
41 // It's annoying to serialze the large PP_URLComponents structure across IPC
42 // and the data isn't often requested by plugins. This function is used on
43 // the plugin side to fill in the components for those cases where it's
44 // actually needed.
45 static PP_Var ConvertComponentsAndReturnURL(const PP_Var& url,
46 PP_URLComponents_Dev* components);
[email protected]9ca245e2011-03-18 01:50:3147};
48
[email protected]55cdf6052011-05-13 19:22:5349} // namespace ppapi
[email protected]9ca245e2011-03-18 01:50:3150
[email protected]9a578392011-12-07 18:59:2751#endif // PPAPI_SHARED_IMPL_PPB_URL_UTIL_SHARED_H_