diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-06 23:42:21 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-06 23:42:21 +0000 |
commit | 65165551604da0f53f5f17fbe8e97363b9436cf5 (patch) | |
tree | 897e2b8202f24f08b939e30e60a094649fd6d0d3 /ppapi/shared_impl/url_util_impl.cc | |
parent | 5d80114534c28f69de8abf0d45507f0ec8fda217 (diff) | |
download | chromium_src-65165551604da0f53f5f17fbe8e97363b9436cf5.zip chromium_src-65165551604da0f53f5f17fbe8e97363b9436cf5.tar.gz chromium_src-65165551604da0f53f5f17fbe8e97363b9436cf5.tar.bz2 |
Rename the shared_impl resource files to give them more regular names.
I keep getting confused between things like AudioImpl and PPB_Audio_Impl. This uses _shared for the names, so now we have _impl, _proxy, and _shared which makes more sense.
I also removed the ppb_opengles2_impl file since it was just a forward to the shared version.
BUG=
TEST=
Review URL: http://codereview.chromium.org/8790004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113290 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/shared_impl/url_util_impl.cc')
-rw-r--r-- | ppapi/shared_impl/url_util_impl.cc | 113 |
1 files changed, 0 insertions, 113 deletions
diff --git a/ppapi/shared_impl/url_util_impl.cc b/ppapi/shared_impl/url_util_impl.cc deleted file mode 100644 index fdccdb6..0000000 --- a/ppapi/shared_impl/url_util_impl.cc +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ppapi/shared_impl/url_util_impl.h" - -#include "googleurl/src/gurl.h" -#include "ppapi/shared_impl/ppapi_globals.h" -#include "ppapi/shared_impl/var.h" -#include "ppapi/shared_impl/var_tracker.h" - -namespace ppapi { - -namespace { - -void ConvertComponent(const url_parse::Component& input, - PP_URLComponent_Dev* output) { - output->begin = input.begin; - output->len = input.len; -} - -// Converts components from a GoogleUrl parsed to a PPAPI parsed structure. -// Output can be NULL to specify "do nothing." This rule is followed by all -// the url util functions, so we implement it once here. -// -// Output can be NULL to specify "do nothing." This rule is followed by all the -// url util functions, so we implement it once here. -void ConvertComponents(const url_parse::Parsed& input, - PP_URLComponents_Dev* output) { - if (!output) - return; - - ConvertComponent(input.scheme, &output->scheme); - ConvertComponent(input.username, &output->username); - ConvertComponent(input.password, &output->password); - ConvertComponent(input.host, &output->host); - ConvertComponent(input.port, &output->port); - ConvertComponent(input.path, &output->path); - ConvertComponent(input.query, &output->query); - ConvertComponent(input.ref, &output->ref); -} - -} // namespace - -// static -PP_Var URLUtilImpl::Canonicalize(PP_Var url, - PP_URLComponents_Dev* components) { - StringVar* url_string = StringVar::FromPPVar(url); - if (!url_string) - return PP_MakeNull(); - return GenerateURLReturn(url_string->pp_module(), - GURL(url_string->value()), components); -} - -// static -PP_Var URLUtilImpl::ResolveRelativeToURL(PP_Var base_url, - PP_Var relative, - PP_URLComponents_Dev* components) { - StringVar* base_url_string = StringVar::FromPPVar(base_url); - StringVar* relative_string = StringVar::FromPPVar(relative); - if (!base_url_string || !relative_string) - return PP_MakeNull(); - - GURL base_gurl(base_url_string->value()); - if (!base_gurl.is_valid()) - return PP_MakeNull(); - return GenerateURLReturn(base_url_string->pp_module(), - base_gurl.Resolve(relative_string->value()), - components); -} - -// static -PP_Bool URLUtilImpl::IsSameSecurityOrigin(PP_Var url_a, PP_Var url_b) { - StringVar* url_a_string = StringVar::FromPPVar(url_a); - StringVar* url_b_string = StringVar::FromPPVar(url_b); - if (!url_a_string || !url_b_string) - return PP_FALSE; - - GURL gurl_a(url_a_string->value()); - GURL gurl_b(url_b_string->value()); - if (!gurl_a.is_valid() || !gurl_b.is_valid()) - return PP_FALSE; - - return gurl_a.GetOrigin() == gurl_b.GetOrigin() ? PP_TRUE : PP_FALSE; -} - -// Used for returning the given GURL from a PPAPI function, with an optional -// out param indicating the components. -PP_Var URLUtilImpl::GenerateURLReturn(PP_Module module, - const GURL& url, - PP_URLComponents_Dev* components) { - if (!url.is_valid()) - return PP_MakeNull(); - ConvertComponents(url.parsed_for_possibly_invalid_spec(), components); - return StringVar::StringToPPVar(module, url.possibly_invalid_spec()); -} - -PP_Var URLUtilImpl::ConvertComponentsAndReturnURL( - const PP_Var& url, - PP_URLComponents_Dev* components) { - if (!components) - return url; // Common case - plugin doesn't care about parsing. - - StringVar* url_string = StringVar::FromPPVar(url); - if (!url_string) - return url; - - PP_Var result = Canonicalize(url, components); - PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(url); - return result; -} - -} // namespace ppapi |