Index: shell/application_manager/application_manager.cc |
diff --git a/shell/application_manager/application_manager.cc b/shell/application_manager/application_manager.cc |
index 2b1c632cff09c335518ee15b6a29c4b12e122cf2..62556493aab5c3306482af2e27106cd303806c9a 100644 |
--- a/shell/application_manager/application_manager.cc |
+++ b/shell/application_manager/application_manager.cc |
@@ -19,6 +19,7 @@ |
#include "shell/application_manager/fetcher.h" |
#include "shell/application_manager/local_fetcher.h" |
#include "shell/application_manager/network_fetcher.h" |
+#include "shell/application_manager/query_util.h" |
namespace mojo { |
@@ -26,16 +27,6 @@ namespace { |
// Used by TestAPI. |
bool has_created_instance = false; |
-GURL StripQueryFromURL(const GURL& url) { |
- GURL::Replacements repl; |
- repl.SetQueryStr(""); |
- std::string result = url.ReplaceComponents(repl).spec(); |
- |
- // Remove the dangling '?' because it's ugly. |
- base::ReplaceChars(result, "?", "", &result); |
- return GURL(result); |
-} |
- |
} // namespace |
ApplicationManager::Delegate::~Delegate() { |
@@ -160,7 +151,7 @@ void ApplicationManager::ConnectToApplication( |
base::Passed(exposed_services.Pass())); |
if (resolved_url.SchemeIsFile()) { |
- new LocalFetcher(resolved_url, StripQueryFromURL(resolved_url), |
+ new LocalFetcher(resolved_url, GetBaseURLAndQuery(resolved_url, nullptr), |
base::Bind(callback, NativeRunner::DontDeleteAppPath)); |
return; |
} |
@@ -177,7 +168,7 @@ bool ApplicationManager::ConnectToRunningApplication( |
const GURL& requestor_url, |
InterfaceRequest<ServiceProvider>* services, |
ServiceProviderPtr* exposed_services) { |
- GURL application_url = StripQueryFromURL(resolved_url); |
+ GURL application_url = GetBaseURLAndQuery(resolved_url, nullptr); |
ShellImpl* shell_impl = GetShellImpl(application_url); |
if (!shell_impl) |
return false; |
@@ -209,7 +200,7 @@ InterfaceRequest<Application> ApplicationManager::RegisterShell( |
const GURL& requestor_url, |
InterfaceRequest<ServiceProvider> services, |
ServiceProviderPtr exposed_services) { |
- GURL app_url = StripQueryFromURL(resolved_url); |
+ GURL app_url = GetBaseURLAndQuery(resolved_url, nullptr); |
ApplicationPtr application; |
InterfaceRequest<Application> application_request = GetProxy(&application); |
@@ -391,7 +382,7 @@ void ApplicationManager::SetArgsForURL(const std::vector<std::string>& args, |
} |
ApplicationLoader* ApplicationManager::GetLoaderForURL(const GURL& url) { |
- auto url_it = url_to_loader_.find(StripQueryFromURL(url)); |
+ auto url_it = url_to_loader_.find(GetBaseURLAndQuery(url, nullptr)); |
if (url_it != url_to_loader_.end()) |
return url_it->second; |
auto scheme_it = scheme_to_loader_.find(url.scheme()); |