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

Unified Diff: shell/application_manager/application_manager.cc

Issue 972473003: Strip query string before applying url mapping. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Follow review Created 5 years, 10 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 | « shell/application_manager/BUILD.gn ('k') | shell/application_manager/query_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« no previous file with comments | « shell/application_manager/BUILD.gn ('k') | shell/application_manager/query_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698