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() : application_binding_(this) {} | |
17 | |
18 ApplicationImplBase::~ApplicationImplBase() {} | 16 ApplicationImplBase::~ApplicationImplBase() {} |
19 | 17 |
20 void ApplicationImplBase::Bind( | 18 void ApplicationImplBase::Bind( |
21 InterfaceRequest<Application> application_request) { | 19 InterfaceRequest<Application> application_request) { |
22 application_binding_.Bind(application_request.Pass()); | 20 application_binding_.Bind(application_request.Pass()); |
23 } | 21 } |
24 | 22 |
25 bool ApplicationImplBase::HasArg(const std::string& arg) const { | 23 bool ApplicationImplBase::HasArg(const std::string& arg) const { |
26 return std::find(args_.begin(), args_.end(), arg) != args_.end(); | 24 return std::find(args_.begin(), args_.end(), arg) != args_.end(); |
27 } | 25 } |
28 | 26 |
| 27 void ApplicationImplBase::OnInitialize() {} |
| 28 |
| 29 bool ApplicationImplBase::OnAcceptConnection( |
| 30 ServiceProviderImpl* service_provider_impl) { |
| 31 return false; |
| 32 } |
| 33 |
| 34 void ApplicationImplBase::OnQuit() {} |
| 35 |
| 36 ApplicationImplBase::ApplicationImplBase() : application_binding_(this) {} |
| 37 |
29 void ApplicationImplBase::Initialize(InterfaceHandle<Shell> shell, | 38 void ApplicationImplBase::Initialize(InterfaceHandle<Shell> shell, |
30 Array<String> args, | 39 Array<String> args, |
31 const mojo::String& url) { | 40 const mojo::String& url) { |
32 shell_ = ShellPtr::Create(std::move(shell)); | 41 shell_ = ShellPtr::Create(std::move(shell)); |
33 shell_.set_connection_error_handler([this]() { | 42 shell_.set_connection_error_handler([this]() { |
34 OnQuit(); | 43 OnQuit(); |
35 service_provider_impls_.clear(); | 44 service_provider_impls_.clear(); |
36 Terminate(); | 45 Terminate(); |
37 }); | 46 }); |
38 url_ = url; | 47 url_ = url; |
(...skipping 20 matching lines...) Expand all Loading... |
59 return; | 68 return; |
60 service_provider_impls_.push_back(std::move(service_provider_impl)); | 69 service_provider_impls_.push_back(std::move(service_provider_impl)); |
61 } | 70 } |
62 | 71 |
63 void ApplicationImplBase::RequestQuit() { | 72 void ApplicationImplBase::RequestQuit() { |
64 OnQuit(); | 73 OnQuit(); |
65 Terminate(); | 74 Terminate(); |
66 } | 75 } |
67 | 76 |
68 } // namespace mojo | 77 } // namespace mojo |
OLD | NEW |