diff options
Diffstat (limited to 'mojo')
-rw-r--r-- | mojo/application/application_test_base_chromium.cc | 9 | ||||
-rw-r--r-- | mojo/application/public/cpp/application_impl.h | 9 | ||||
-rw-r--r-- | mojo/application/public/cpp/lib/application_impl.cc | 9 | ||||
-rw-r--r-- | mojo/application/public/interfaces/application.mojom | 2 | ||||
-rw-r--r-- | mojo/shell/application_manager.cc | 43 | ||||
-rw-r--r-- | mojo/shell/application_manager.h | 10 | ||||
-rw-r--r-- | mojo/shell/application_manager_unittest.cc | 17 | ||||
-rw-r--r-- | mojo/shell/shell_impl.cc | 4 | ||||
-rw-r--r-- | mojo/shell/shell_impl.h | 2 |
9 files changed, 30 insertions, 75 deletions
diff --git a/mojo/application/application_test_base_chromium.cc b/mojo/application/application_test_base_chromium.cc index bb9afa1..cf4920c 100644 --- a/mojo/application/application_test_base_chromium.cc +++ b/mojo/application/application_test_base_chromium.cc @@ -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() { diff --git a/mojo/application/public/cpp/application_impl.h b/mojo/application/public/cpp/application_impl.h index a5d58f50..cecc934 100644 --- a/mojo/application/public/cpp/application_impl.h +++ b/mojo/application/public/cpp/application_impl.h @@ -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); }; diff --git a/mojo/application/public/cpp/lib/application_impl.cc b/mojo/application/public/cpp/lib/application_impl.cc index 018729f..467fc12 100644 --- a/mojo/application/public/cpp/lib/application_impl.cc +++ b/mojo/application/public/cpp/lib/application_impl.cc @@ -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); } diff --git a/mojo/application/public/interfaces/application.mojom b/mojo/application/public/interfaces/application.mojom index dc9f2f63..6d15012 100644 --- a/mojo/application/public/interfaces/application.mojom +++ b/mojo/application/public/interfaces/application.mojom @@ -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. diff --git a/mojo/shell/application_manager.cc b/mojo/shell/application_manager.cc index f950d24..9e63179 100644 --- a/mojo/shell/application_manager.cc +++ b/mojo/shell/application_manager.cc @@ -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; diff --git a/mojo/shell/application_manager.h b/mojo/shell/application_manager.h index a5ebda31..e81f918 100644 --- a/mojo/shell/application_manager.h +++ b/mojo/shell/application_manager.h @@ -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); diff --git a/mojo/shell/application_manager_unittest.cc b/mojo/shell/application_manager_unittest.cc index e08420d..2d6fd5c 100644 --- a/mojo/shell/application_manager_unittest.cc +++ b/mojo/shell/application_manager_unittest.cc @@ -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_); diff --git a/mojo/shell/shell_impl.cc b/mojo/shell/shell_impl.cc index 9fef34b..4214324 100644 --- a/mojo/shell/shell_impl.cc +++ b/mojo/shell/shell_impl.cc @@ -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, diff --git a/mojo/shell/shell_impl.h b/mojo/shell/shell_impl.h index 0f2d974..a67335c 100644 --- a/mojo/shell/shell_impl.h +++ b/mojo/shell/shell_impl.h @@ -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, |