Commit e8da86fc authored by jam's avatar jam Committed by Commit bot

Remove application-specific args from Mandoline's shell.

These weren't being used.

Review URL: https://codereview.chromium.org/1143793003

Cr-Commit-Position: refs/heads/master@{#330620}
parent 041e9390
......@@ -50,9 +50,7 @@ class HTMLViewerApplication : public mojo::Application {
initial_response_(response.Pass()),
setup_(setup) {}
void Initialize(ShellPtr shell,
Array<String> args,
const String& url) override {
void Initialize(ShellPtr shell, const String& url) override {
ServiceProviderPtr service_provider;
shell_ = shell.Pass();
shell_->ConnectToApplication("mojo:network_service",
......
......@@ -40,9 +40,7 @@ class ShellGrabber : public Application {
private:
// Application implementation.
void Initialize(ShellPtr shell,
Array<String> args,
const mojo::String& url) override {
void Initialize(ShellPtr shell, const mojo::String& url) override {
g_url = url;
g_application_request = binding_.Unbind();
g_shell = shell.Pass();
......@@ -127,9 +125,8 @@ void ApplicationTestBase::SetUp() {
application_impl_ = new ApplicationImpl(GetApplicationDelegate(),
g_application_request.Pass());
// Fake application initialization with the given command line arguments.
Array<String> empty_args;
application_impl_->Initialize(g_shell.Pass(), empty_args.Clone(), g_url);
// Fake application initialization.
application_impl_->Initialize(g_shell.Pass(), g_url);
}
void ApplicationTestBase::TearDown() {
......
......@@ -64,10 +64,6 @@ class ApplicationImpl : public Application {
const std::string& url() const { return url_; }
// Returns any initial configuration arguments, passed by the Shell.
const std::vector<std::string>& args() const { return args_; }
bool HasArg(const std::string& arg) const;
// Requests a new connection to an application. Returns a pointer to the
// connection if the connection is permitted by this application's delegate,
// or nullptr otherwise. Caller does not take ownership. The pointer remains
......@@ -84,9 +80,7 @@ class ApplicationImpl : public Application {
}
// Application implementation.
void Initialize(ShellPtr shell,
Array<String> args,
const mojo::String& url) override;
void Initialize(ShellPtr shell, const mojo::String& url) override;
// Block until the Application is initialized, if it is not already.
void WaitForInitialize();
......@@ -130,7 +124,6 @@ class ApplicationImpl : public Application {
ShellPtr shell_;
ShellPtrWatcher* shell_watch_;
std::string url_;
std::vector<std::string> args_;
MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationImpl);
};
......
......@@ -31,10 +31,6 @@ ApplicationImpl::ApplicationImpl(ApplicationDelegate* delegate,
shell_watch_(nullptr) {
}
bool ApplicationImpl::HasArg(const std::string& arg) const {
return std::find(args_.begin(), args_.end(), arg) != args_.end();
}
void ApplicationImpl::ClearConnections() {
for (ServiceRegistryList::iterator i(incoming_service_registries_.begin());
i != incoming_service_registries_.end();
......@@ -72,14 +68,11 @@ ApplicationConnection* ApplicationImpl::ConnectToApplication(
return registry;
}
void ApplicationImpl::Initialize(ShellPtr shell,
Array<String> args,
const mojo::String& url) {
void ApplicationImpl::Initialize(ShellPtr shell, const mojo::String& url) {
shell_ = shell.Pass();
shell_watch_ = new ShellPtrWatcher(this);
shell_.set_error_handler(shell_watch_);
url_ = url;
args_ = args.To<std::vector<std::string>>();
delegate_->Initialize(this);
}
......
......@@ -23,7 +23,7 @@ interface Application {
// mappings, resolution, and redirects. And it will not include the
// querystring, since the querystring is not part of an application's
// identity.
Initialize(Shell shell, array<string>? args, string url);
Initialize(Shell shell, string url);
// Called when another application (identified by |requestor_url|) attempts to
// open a connection to this application.
......
......@@ -41,9 +41,9 @@ class ApplicationManager::ContentHandlerConnection : public ErrorHandler {
content_handler_url_(content_handler_url),
content_handler_qualifier_(qualifier) {
ServiceProviderPtr services;
manager->ConnectToApplicationWithParameters(
manager->ConnectToApplicationInternal(
content_handler_url, qualifier, requestor_url, GetProxy(&services),
nullptr, base::Closure(), std::vector<std::string>());
nullptr, base::Closure());
MessagePipe pipe;
content_handler_.Bind(
InterfacePtrInfo<ContentHandler>(pipe.handle0.Pass(), 0u));
......@@ -106,21 +106,20 @@ void ApplicationManager::ConnectToApplication(
InterfaceRequest<ServiceProvider> services,
ServiceProviderPtr exposed_services,
const base::Closure& on_application_end) {
ConnectToApplicationWithParameters(
ConnectToApplicationInternal(
requested_url, std::string(), requestor_url, services.Pass(),
exposed_services.Pass(), on_application_end, std::vector<std::string>());
exposed_services.Pass(), on_application_end);
}
void ApplicationManager::ConnectToApplicationWithParameters(
void ApplicationManager::ConnectToApplicationInternal(
const GURL& requested_url,
const std::string& qualifier,
const GURL& requestor_url,
InterfaceRequest<ServiceProvider> services,
ServiceProviderPtr exposed_services,
const base::Closure& on_application_end,
const std::vector<std::string>& pre_redirect_parameters) {
const base::Closure& on_application_end) {
TRACE_EVENT_INSTANT1(
"mojo_shell", "ApplicationManager::ConnectToApplicationWithParameters",
"mojo_shell", "ApplicationManager::ConnectToApplication",
TRACE_EVENT_SCOPE_THREAD, "requested_url", requested_url.spec());
DCHECK(requested_url.is_valid());
......@@ -142,30 +141,27 @@ void ApplicationManager::ConnectToApplicationWithParameters(
// The application is not running, let's compute the parameters.
if (ConnectToApplicationWithLoader(
requested_url, qualifier, mapped_url, requestor_url, &services,
&exposed_services, on_application_end, pre_redirect_parameters,
GetLoaderForURL(mapped_url))) {
&exposed_services, on_application_end, GetLoaderForURL(mapped_url))) {
return;
}
if (ConnectToApplicationWithLoader(
requested_url, qualifier, resolved_url, requestor_url, &services,
&exposed_services, on_application_end, pre_redirect_parameters,
&exposed_services, on_application_end,
GetLoaderForURL(resolved_url))) {
return;
}
if (ConnectToApplicationWithLoader(
requested_url, qualifier, resolved_url, requestor_url, &services,
&exposed_services, on_application_end, pre_redirect_parameters,
default_loader_.get())) {
&exposed_services, on_application_end, default_loader_.get())) {
return;
}
auto callback = base::Bind(
&ApplicationManager::HandleFetchCallback, weak_ptr_factory_.GetWeakPtr(),
requested_url, qualifier, requestor_url, base::Passed(services.Pass()),
base::Passed(exposed_services.Pass()), on_application_end,
pre_redirect_parameters);
base::Passed(exposed_services.Pass()), on_application_end);
if (delegate_->CreateFetcher(
resolved_url,
......@@ -217,7 +213,6 @@ bool ApplicationManager::ConnectToApplicationWithLoader(
InterfaceRequest<ServiceProvider>* services,
ServiceProviderPtr* exposed_services,
const base::Closure& on_application_end,
const std::vector<std::string>& parameters,
ApplicationLoader* loader) {
if (!loader)
return false;
......@@ -228,7 +223,7 @@ bool ApplicationManager::ConnectToApplicationWithLoader(
loader->Load(
resolved_url,
RegisterShell(app_url, qualifier, requestor_url, services->Pass(),
exposed_services->Pass(), on_application_end, parameters));
exposed_services->Pass(), on_application_end));
return true;
}
......@@ -238,8 +233,7 @@ InterfaceRequest<Application> ApplicationManager::RegisterShell(
const GURL& requestor_url,
InterfaceRequest<ServiceProvider> services,
ServiceProviderPtr exposed_services,
const base::Closure& on_application_end,
const std::vector<std::string>& parameters) {
const base::Closure& on_application_end) {
Identity app_identity(app_url, qualifier);
ApplicationPtr application;
......@@ -247,7 +241,7 @@ InterfaceRequest<Application> ApplicationManager::RegisterShell(
ShellImpl* shell =
new ShellImpl(application.Pass(), this, app_identity, on_application_end);
identity_to_shell_impl_[app_identity] = shell;
shell->InitializeApplication(Array<String>::From(parameters));
shell->InitializeApplication();
ConnectToClient(shell, app_url, requestor_url, services.Pass(),
exposed_services.Pass());
return application_request.Pass();
......@@ -278,7 +272,6 @@ void ApplicationManager::HandleFetchCallback(
InterfaceRequest<ServiceProvider> services,
ServiceProviderPtr exposed_services,
const base::Closure& on_application_end,
const std::vector<std::string>& parameters,
NativeApplicationCleanup cleanup,
scoped_ptr<Fetcher> fetcher) {
if (!fetcher) {
......@@ -290,9 +283,9 @@ void ApplicationManager::HandleFetchCallback(
if (!redirect_url.is_empty()) {
// And around we go again... Whee!
// TODO(sky): this loses |requested_url|.
ConnectToApplicationWithParameters(redirect_url, qualifier, requestor_url,
services.Pass(), exposed_services.Pass(),
on_application_end, parameters);
ConnectToApplicationInternal(redirect_url, qualifier, requestor_url,
services.Pass(), exposed_services.Pass(),
on_application_end);
return;
}
......@@ -312,7 +305,7 @@ void ApplicationManager::HandleFetchCallback(
InterfaceRequest<Application> request(
RegisterShell(app_url, qualifier, requestor_url, services.Pass(),
exposed_services.Pass(), on_application_end, parameters));
exposed_services.Pass(), on_application_end));
// If the response begins with a #!mojo <content-handler-url>, use it.
GURL content_handler_url;
......
......@@ -154,14 +154,13 @@ class ApplicationManager {
using URLToLoaderMap = std::map<GURL, ApplicationLoader*>;
using URLToNativeOptionsMap = std::map<GURL, NativeRunnerFactory::Options>;
void ConnectToApplicationWithParameters(
void ConnectToApplicationInternal(
const GURL& application_url,
const std::string& qualifier,
const GURL& requestor_url,
InterfaceRequest<ServiceProvider> services,
ServiceProviderPtr exposed_services,
const base::Closure& on_application_end,
const std::vector<std::string>& pre_redirect_parameters);
const base::Closure& on_application_end);
bool ConnectToRunningApplication(const GURL& resolved_url,
const std::string& qualifier,
......@@ -177,7 +176,6 @@ class ApplicationManager {
InterfaceRequest<ServiceProvider>* services,
ServiceProviderPtr* exposed_services,
const base::Closure& on_application_end,
const std::vector<std::string>& parameters,
ApplicationLoader* loader);
InterfaceRequest<Application> RegisterShell(
......@@ -186,8 +184,7 @@ class ApplicationManager {
const GURL& requestor_url,
InterfaceRequest<ServiceProvider> services,
ServiceProviderPtr exposed_services,
const base::Closure& on_application_end,
const std::vector<std::string>& parameters);
const base::Closure& on_application_end);
ShellImpl* GetShellImpl(const GURL& url, const std::string& qualifier);
......@@ -205,7 +202,6 @@ class ApplicationManager {
InterfaceRequest<ServiceProvider> services,
ServiceProviderPtr exposed_services,
const base::Closure& on_application_end,
const std::vector<std::string>& parameters,
NativeApplicationCleanup cleanup,
scoped_ptr<Fetcher> fetcher);
......
......@@ -145,7 +145,6 @@ class TestApplicationLoader : public ApplicationLoader,
void set_context(TestContext* context) { context_ = context; }
int num_loads() const { return num_loads_; }
const std::vector<std::string>& GetArgs() const { return test_app_->args(); }
const GURL& last_requestor_url() const { return last_requestor_url_; }
private:
......@@ -521,22 +520,6 @@ TEST_F(ApplicationManagerTest, Basic) {
EXPECT_EQ(std::string("test"), context_.last_test_string);
}
// Confirm that no arguments are sent to an application by default.
TEST_F(ApplicationManagerTest, NoArgs) {
ApplicationManager am(&test_delegate_);
GURL test_url("test:test");
TestApplicationLoader* loader = new TestApplicationLoader;
loader->set_context(&context_);
am.SetLoaderForURL(scoped_ptr<ApplicationLoader>(loader), test_url);
TestServicePtr test_service;
am.ConnectToService(test_url, &test_service);
TestClient test_client(test_service.Pass());
test_client.Test("test");
loop_.Run();
std::vector<std::string> app_args = loader->GetArgs();
EXPECT_EQ(0U, app_args.size());
}
// Confirm that url mappings are respected.
TEST_F(ApplicationManagerTest, URLMapping) {
ApplicationManager am(&test_delegate_);
......
......@@ -27,10 +27,10 @@ ShellImpl::ShellImpl(ApplicationPtr application,
ShellImpl::~ShellImpl() {
}
void ShellImpl::InitializeApplication(Array<String> args) {
void ShellImpl::InitializeApplication() {
ShellPtr shell;
binding_.Bind(GetProxy(&shell));
application_->Initialize(shell.Pass(), args.Pass(), identity_.url.spec());
application_->Initialize(shell.Pass(), identity_.url.spec());
}
void ShellImpl::ConnectToClient(const GURL& requested_url,
......
......@@ -27,7 +27,7 @@ class ShellImpl : public Shell, public ErrorHandler {
~ShellImpl() override;
void InitializeApplication(Array<String> args);
void InitializeApplication();
void ConnectToClient(const GURL& requested_url,
const GURL& requestor_url,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment