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/shell/application.h" | 5 #include "mojo/public/shell/application.h" |
6 | 6 |
7 namespace mojo { | 7 namespace mojo { |
8 | 8 |
9 Application::Application(ScopedShellHandle shell_handle) | 9 Application::Application(ScopedShellHandle shell_handle) |
10 : shell_(shell_handle.Pass(), this) { | 10 : shell_(shell_handle.Pass(), this) { |
11 } | 11 } |
12 | 12 |
13 Application::Application(MojoHandle shell_handle) | 13 Application::Application(MojoHandle shell_handle) |
14 : shell_(mojo::MakeScopedHandle(ShellHandle(shell_handle)).Pass()) {} | 14 : shell_(mojo::MakeScopedHandle(ShellHandle(shell_handle)).Pass(), this) {} |
15 | 15 |
16 Application::~Application() { | 16 Application::~Application() { |
17 for (ServiceFactoryList::iterator it = service_factories_.begin(); | 17 for (ServiceFactoryList::iterator it = service_factories_.begin(); |
18 it != service_factories_.end(); ++it) { | 18 it != service_factories_.end(); ++it) { |
19 delete *it; | 19 delete *it; |
20 } | 20 } |
21 } | 21 } |
22 | 22 |
23 Shell* Application::GetShell() { | 23 Shell* Application::GetShell() { |
24 return shell_.get(); | 24 return shell_.get(); |
(...skipping 23 matching lines...) Expand all Loading... |
48 ScopedMessagePipeHandle client_handle) { | 48 ScopedMessagePipeHandle client_handle) { |
49 // TODO(davemoore): This method must be overridden by an Application subclass | 49 // TODO(davemoore): This method must be overridden by an Application subclass |
50 // to dispatch to the right ServiceFactory. We need to figure out an approach | 50 // to dispatch to the right ServiceFactory. We need to figure out an approach |
51 // to registration to make this better. | 51 // to registration to make this better. |
52 assert(1 == service_factories_.size()); | 52 assert(1 == service_factories_.size()); |
53 return service_factories_.front()->AcceptConnection(url.To<std::string>(), | 53 return service_factories_.front()->AcceptConnection(url.To<std::string>(), |
54 client_handle.Pass()); | 54 client_handle.Pass()); |
55 } | 55 } |
56 | 56 |
57 } // namespace mojo | 57 } // namespace mojo |
OLD | NEW |