diff options
author | piman@google.com <piman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-02 21:04:28 +0000 |
---|---|---|
committer | piman@google.com <piman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-02 21:04:28 +0000 |
commit | b45c651999ef987ad88e314b90b39996b5c6d632 (patch) | |
tree | 40908ac7f69ec68233bbfe3445aa284c7105442a /ppapi/cpp | |
parent | a5ae58faedf27b7964eae66ee14839ec53e9ec2d (diff) | |
download | chromium_src-b45c651999ef987ad88e314b90b39996b5c6d632.zip chromium_src-b45c651999ef987ad88e314b90b39996b5c6d632.tar.gz chromium_src-b45c651999ef987ad88e314b90b39996b5c6d632.tar.bz2 |
Add PPB_URLUtil_Dev::GetDocumentURL
This also renames "Url" into "URL" for consistency.
BUG=74569
TEST=http://www.espn.go.com/nba/
Review URL: http://codereview.chromium.org/6594107
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76608 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/cpp')
-rw-r--r-- | ppapi/cpp/dev/url_util_dev.cc | 34 | ||||
-rw-r--r-- | ppapi/cpp/dev/url_util_dev.h | 28 |
2 files changed, 35 insertions, 27 deletions
diff --git a/ppapi/cpp/dev/url_util_dev.cc b/ppapi/cpp/dev/url_util_dev.cc index ec08856..e7b396f 100644 --- a/ppapi/cpp/dev/url_util_dev.cc +++ b/ppapi/cpp/dev/url_util_dev.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// 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. @@ -11,13 +11,13 @@ namespace pp { // static -const UrlUtil_Dev* UrlUtil_Dev::Get() { +const URLUtil_Dev* URLUtil_Dev::Get() { static bool tried_to_init = false; - static UrlUtil_Dev util; + static URLUtil_Dev util; if (!tried_to_init) { tried_to_init = true; - util.interface_ = static_cast<const PPB_UrlUtil_Dev*>( + util.interface_ = static_cast<const PPB_URLUtil_Dev*>( Module::Get()->GetBrowserInterface(PPB_URLUTIL_DEV_INTERFACE)); } @@ -26,48 +26,54 @@ const UrlUtil_Dev* UrlUtil_Dev::Get() { return &util; } -Var UrlUtil_Dev::Canonicalize(const Var& url, - PP_UrlComponents_Dev* components) const { +Var URLUtil_Dev::Canonicalize(const Var& url, + PP_URLComponents_Dev* components) const { return Var(Var::PassRef(), interface_->Canonicalize(url.pp_var(), components)); } -Var UrlUtil_Dev::ResolveRelativeToUrl(const Var& base_url, +Var URLUtil_Dev::ResolveRelativeToURL(const Var& base_url, const Var& relative_string, - PP_UrlComponents_Dev* components) const { + PP_URLComponents_Dev* components) const { return Var(Var::PassRef(), - interface_->ResolveRelativeToUrl(base_url.pp_var(), + interface_->ResolveRelativeToURL(base_url.pp_var(), relative_string.pp_var(), components)); } -Var UrlUtil_Dev::ResoveRelativeToDocument( +Var URLUtil_Dev::ResoveRelativeToDocument( const Instance& instance, const Var& relative_string, - PP_UrlComponents_Dev* components) const { + PP_URLComponents_Dev* components) const { return Var(Var::PassRef(), interface_->ResolveRelativeToDocument(instance.pp_instance(), relative_string.pp_var(), components)); } -bool UrlUtil_Dev::IsSameSecurityOrigin(const Var& url_a, +bool URLUtil_Dev::IsSameSecurityOrigin(const Var& url_a, const Var& url_b) const { return PPBoolToBool(interface_->IsSameSecurityOrigin(url_a.pp_var(), url_b.pp_var())); } -bool UrlUtil_Dev::DocumentCanRequest(const Instance& instance, +bool URLUtil_Dev::DocumentCanRequest(const Instance& instance, const Var& url) const { return PPBoolToBool(interface_->DocumentCanRequest(instance.pp_instance(), url.pp_var())); } -bool UrlUtil_Dev::DocumentCanAccessDocument(const Instance& active, +bool URLUtil_Dev::DocumentCanAccessDocument(const Instance& active, const Instance& target) const { return PPBoolToBool( interface_->DocumentCanAccessDocument(active.pp_instance(), target.pp_instance())); } +Var URLUtil_Dev::GetDocumentURL(const Instance& instance, + PP_URLComponents_Dev* components) const { + return Var(Var::PassRef(), + interface_->GetDocumentURL(instance.pp_instance(), components)); +} + } // namespace pp diff --git a/ppapi/cpp/dev/url_util_dev.h b/ppapi/cpp/dev/url_util_dev.h index 3be217e..4d0fa5a 100644 --- a/ppapi/cpp/dev/url_util_dev.h +++ b/ppapi/cpp/dev/url_util_dev.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// 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. @@ -13,39 +13,41 @@ namespace pp { class Instance; class Module; -// Simple wrapper around the PPB_UrlUtil interface. -class UrlUtil_Dev { +// Simple wrapper around the PPB_URLUtil interface. +class URLUtil_Dev { public: // This class is just a collection of random functions that aren't // particularly attached to anything. So this getter returns a cached // instance of this interface. This may return NULL if the browser doesn't - // support the UrlUtil inteface. Since this is a singleton, don't delete the + // support the URLUtil inteface. Since this is a singleton, don't delete the // pointer. - static const UrlUtil_Dev* Get(); + static const URLUtil_Dev* Get(); Var Canonicalize(const Var& url, - PP_UrlComponents_Dev* components = NULL) const; + PP_URLComponents_Dev* components = NULL) const; - Var ResolveRelativeToUrl(const Var& base_url, + Var ResolveRelativeToURL(const Var& base_url, const Var& relative_string, - PP_UrlComponents_Dev* components = NULL) const; + PP_URLComponents_Dev* components = NULL) const; Var ResoveRelativeToDocument(const Instance& instance, const Var& relative_string, - PP_UrlComponents_Dev* components = NULL) const; + PP_URLComponents_Dev* components = NULL) const; bool IsSameSecurityOrigin(const Var& url_a, const Var& url_b) const; bool DocumentCanRequest(const Instance& instance, const Var& url) const; bool DocumentCanAccessDocument(const Instance& active, const Instance& target) const; + Var GetDocumentURL(const Instance& instance, + PP_URLComponents_Dev* components = NULL) const; private: - UrlUtil_Dev() : interface_(NULL) {} + URLUtil_Dev() : interface_(NULL) {} // Copy and assignment are disallowed. - UrlUtil_Dev(const UrlUtil_Dev& other); - UrlUtil_Dev& operator=(const UrlUtil_Dev& other); + URLUtil_Dev(const URLUtil_Dev& other); + URLUtil_Dev& operator=(const URLUtil_Dev& other); - const PPB_UrlUtil_Dev* interface_; + const PPB_URLUtil_Dev* interface_; }; } // namespace pp |