Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(572)

Unified Diff: ppapi/shared_impl/url_util_impl.cc

Issue 7578001: Unify var tracking between webkit and the proxy. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/shared_impl/url_util_impl.h ('k') | ppapi/shared_impl/var.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/shared_impl/url_util_impl.cc
===================================================================
--- ppapi/shared_impl/url_util_impl.cc (revision 96002)
+++ ppapi/shared_impl/url_util_impl.cc (working copy)
@@ -5,6 +5,7 @@
#include "ppapi/shared_impl/url_util_impl.h"
#include "googleurl/src/gurl.h"
+#include "ppapi/shared_impl/var.h"
namespace ppapi {
@@ -40,48 +41,42 @@
} // namespace
// static
-PP_Var URLUtilImpl::Canonicalize(StringFromVar string_from_var,
- VarFromUtf8 var_from_utf8,
- PP_Module pp_module,
+PP_Var URLUtilImpl::Canonicalize(PP_Module pp_module,
PP_Var url,
PP_URLComponents_Dev* components) {
- const std::string* url_string = string_from_var(url);
+ scoped_refptr<StringVar> url_string(StringVar::FromPPVar(url));
if (!url_string)
return PP_MakeNull();
- return GenerateURLReturn(var_from_utf8, pp_module,
- GURL(*url_string), components);
+ return GenerateURLReturn(pp_module, GURL(url_string->value()), components);
}
// static
-PP_Var URLUtilImpl::ResolveRelativeToURL(StringFromVar string_from_var,
- VarFromUtf8 var_from_utf8,
- PP_Module pp_module,
+PP_Var URLUtilImpl::ResolveRelativeToURL(PP_Module pp_module,
PP_Var base_url,
PP_Var relative,
PP_URLComponents_Dev* components) {
- const std::string* base_url_string = string_from_var(base_url);
- const std::string* relative_string = string_from_var(relative);
+ scoped_refptr<StringVar> base_url_string(StringVar::FromPPVar(base_url));
+ scoped_refptr<StringVar> relative_string(StringVar::FromPPVar(relative));
if (!base_url_string || !relative_string)
return PP_MakeNull();
- GURL base_gurl(*base_url_string);
+ GURL base_gurl(base_url_string->value());
if (!base_gurl.is_valid())
return PP_MakeNull();
- return GenerateURLReturn(var_from_utf8, pp_module,
- base_gurl.Resolve(*relative_string),
+ return GenerateURLReturn(pp_module,
+ base_gurl.Resolve(relative_string->value()),
components);
}
// static
-PP_Bool URLUtilImpl::IsSameSecurityOrigin(StringFromVar string_from_var,
- PP_Var url_a, PP_Var url_b) {
- const std::string* url_a_string = string_from_var(url_a);
- const std::string* url_b_string = string_from_var(url_b);
+PP_Bool URLUtilImpl::IsSameSecurityOrigin(PP_Var url_a, PP_Var url_b) {
+ scoped_refptr<StringVar> url_a_string(StringVar::FromPPVar(url_a));
+ scoped_refptr<StringVar> url_b_string(StringVar::FromPPVar(url_b));
if (!url_a_string || !url_b_string)
return PP_FALSE;
- GURL gurl_a(*url_a_string);
- GURL gurl_b(*url_b_string);
+ 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;
@@ -90,15 +85,13 @@
// Used for returning the given GURL from a PPAPI function, with an optional
// out param indicating the components.
-PP_Var URLUtilImpl::GenerateURLReturn(VarFromUtf8 var_from_utf8,
- PP_Module module,
+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 var_from_utf8(module, url.possibly_invalid_spec().c_str(),
- static_cast<uint32_t>(url.possibly_invalid_spec().size()));
+ return StringVar::StringToPPVar(module, url.possibly_invalid_spec());
}
} // namespace ppapi
« no previous file with comments | « ppapi/shared_impl/url_util_impl.h ('k') | ppapi/shared_impl/var.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698