| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "mojo/public/cpp/application/application_impl_base.h" | 5 #include "mojo/public/cpp/application/application_impl_base.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "mojo/public/cpp/application/connection_context.h" | 10 #include "mojo/public/cpp/application/connection_context.h" |
| 11 #include "mojo/public/cpp/application/service_provider_impl.h" | 11 #include "mojo/public/cpp/application/service_provider_impl.h" |
| 12 #include "mojo/public/cpp/environment/logging.h" | 12 #include "mojo/public/cpp/environment/logging.h" |
| 13 | 13 |
| 14 namespace mojo { | 14 namespace mojo { |
| 15 | 15 |
| 16 ApplicationImplBase::ApplicationImplBase( | 16 ApplicationImplBase::ApplicationImplBase() : application_binding_(this) {} |
| 17 InterfaceRequest<Application> application_request) | |
| 18 : application_binding_(this, application_request.Pass()) {} | |
| 19 | 17 |
| 20 ApplicationImplBase::~ApplicationImplBase() {} | 18 ApplicationImplBase::~ApplicationImplBase() {} |
| 21 | 19 |
| 20 void ApplicationImplBase::Bind( |
| 21 InterfaceRequest<Application> application_request) { |
| 22 application_binding_.Bind(application_request.Pass()); |
| 23 } |
| 24 |
| 22 bool ApplicationImplBase::HasArg(const std::string& arg) const { | 25 bool ApplicationImplBase::HasArg(const std::string& arg) const { |
| 23 return std::find(args_.begin(), args_.end(), arg) != args_.end(); | 26 return std::find(args_.begin(), args_.end(), arg) != args_.end(); |
| 24 } | 27 } |
| 25 | 28 |
| 26 void ApplicationImplBase::Initialize(InterfaceHandle<Shell> shell, | 29 void ApplicationImplBase::Initialize(InterfaceHandle<Shell> shell, |
| 27 Array<String> args, | 30 Array<String> args, |
| 28 const mojo::String& url) { | 31 const mojo::String& url) { |
| 29 shell_ = ShellPtr::Create(std::move(shell)); | 32 shell_ = ShellPtr::Create(std::move(shell)); |
| 30 shell_.set_connection_error_handler([this]() { | 33 shell_.set_connection_error_handler([this]() { |
| 31 OnQuit(); | 34 OnQuit(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 56 return; | 59 return; |
| 57 service_provider_impls_.push_back(std::move(service_provider_impl)); | 60 service_provider_impls_.push_back(std::move(service_provider_impl)); |
| 58 } | 61 } |
| 59 | 62 |
| 60 void ApplicationImplBase::RequestQuit() { | 63 void ApplicationImplBase::RequestQuit() { |
| 61 OnQuit(); | 64 OnQuit(); |
| 62 Terminate(); | 65 Terminate(); |
| 63 } | 66 } |
| 64 | 67 |
| 65 } // namespace mojo | 68 } // namespace mojo |
| OLD | NEW |