OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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.h" | 5 #include "mojo/public/cpp/application/application_impl.h" |
6 | 6 |
7 #include "mojo/public/cpp/application/application_delegate.h" | 7 #include "mojo/public/cpp/application/application_delegate.h" |
8 #include "mojo/public/cpp/application/lib/service_registry.h" | 8 #include "mojo/public/cpp/application/lib/service_registry.h" |
9 #include "mojo/public/cpp/bindings/interface_ptr.h" | 9 #include "mojo/public/cpp/bindings/interface_ptr.h" |
10 #include "mojo/public/cpp/environment/logging.h" | 10 #include "mojo/public/cpp/environment/logging.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 : initialized_(false), delegate_(delegate), shell_watch_(nullptr) { | 29 : initialized_(false), delegate_(delegate), shell_watch_(nullptr) { |
30 BindShell(shell_handle.Pass()); | 30 BindShell(shell_handle.Pass()); |
31 } | 31 } |
32 | 32 |
33 ApplicationImpl::ApplicationImpl(ApplicationDelegate* delegate, | 33 ApplicationImpl::ApplicationImpl(ApplicationDelegate* delegate, |
34 MojoHandle shell_handle) | 34 MojoHandle shell_handle) |
35 : initialized_(false), delegate_(delegate), shell_watch_(nullptr) { | 35 : initialized_(false), delegate_(delegate), shell_watch_(nullptr) { |
36 BindShell(MakeScopedHandle(MessagePipeHandle(shell_handle))); | 36 BindShell(MakeScopedHandle(MessagePipeHandle(shell_handle))); |
37 } | 37 } |
38 | 38 |
| 39 bool ApplicationImpl::HasArg(const std::string& arg) const { |
| 40 return std::find(args_.begin(), args_.end(), arg) != args_.end(); |
| 41 } |
| 42 |
39 void ApplicationImpl::ClearConnections() { | 43 void ApplicationImpl::ClearConnections() { |
40 for (ServiceRegistryList::iterator i(incoming_service_registries_.begin()); | 44 for (ServiceRegistryList::iterator i(incoming_service_registries_.begin()); |
41 i != incoming_service_registries_.end(); | 45 i != incoming_service_registries_.end(); |
42 ++i) | 46 ++i) |
43 delete *i; | 47 delete *i; |
44 for (ServiceRegistryList::iterator i(outgoing_service_registries_.begin()); | 48 for (ServiceRegistryList::iterator i(outgoing_service_registries_.begin()); |
45 i != outgoing_service_registries_.end(); | 49 i != outgoing_service_registries_.end(); |
46 ++i) | 50 ++i) |
47 delete *i; | 51 delete *i; |
48 incoming_service_registries_.clear(); | 52 incoming_service_registries_.clear(); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 internal::ServiceRegistry* registry = new internal::ServiceRegistry( | 104 internal::ServiceRegistry* registry = new internal::ServiceRegistry( |
101 this, requestor_url, service_provider.Pass()); | 105 this, requestor_url, service_provider.Pass()); |
102 if (!delegate_->ConfigureIncomingConnection(registry)) { | 106 if (!delegate_->ConfigureIncomingConnection(registry)) { |
103 delete registry; | 107 delete registry; |
104 return; | 108 return; |
105 } | 109 } |
106 incoming_service_registries_.push_back(registry); | 110 incoming_service_registries_.push_back(registry); |
107 } | 111 } |
108 | 112 |
109 } // namespace mojo | 113 } // namespace mojo |
OLD | NEW |