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 | |
43 void ApplicationImpl::ClearConnections() { | 39 void ApplicationImpl::ClearConnections() { |
44 for (ServiceRegistryList::iterator i(incoming_service_registries_.begin()); | 40 for (ServiceRegistryList::iterator i(incoming_service_registries_.begin()); |
45 i != incoming_service_registries_.end(); | 41 i != incoming_service_registries_.end(); |
46 ++i) | 42 ++i) |
47 delete *i; | 43 delete *i; |
48 for (ServiceRegistryList::iterator i(outgoing_service_registries_.begin()); | 44 for (ServiceRegistryList::iterator i(outgoing_service_registries_.begin()); |
49 i != outgoing_service_registries_.end(); | 45 i != outgoing_service_registries_.end(); |
50 ++i) | 46 ++i) |
51 delete *i; | 47 delete *i; |
52 incoming_service_registries_.clear(); | 48 incoming_service_registries_.clear(); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 internal::ServiceRegistry* registry = new internal::ServiceRegistry( | 100 internal::ServiceRegistry* registry = new internal::ServiceRegistry( |
105 this, requestor_url, service_provider.Pass()); | 101 this, requestor_url, service_provider.Pass()); |
106 if (!delegate_->ConfigureIncomingConnection(registry)) { | 102 if (!delegate_->ConfigureIncomingConnection(registry)) { |
107 delete registry; | 103 delete registry; |
108 return; | 104 return; |
109 } | 105 } |
110 incoming_service_registries_.push_back(registry); | 106 incoming_service_registries_.push_back(registry); |
111 } | 107 } |
112 | 108 |
113 } // namespace mojo | 109 } // namespace mojo |
OLD | NEW |