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 "base/files/file_path.h" | 5 #include "base/files/file_path.h" |
6 #include "base/files/file_util.h" | 6 #include "base/files/file_util.h" |
7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 ApplicationManager application_manager_; | 50 ApplicationManager application_manager_; |
51 base::FilePath socket_path_; | 51 base::FilePath socket_path_; |
52 scoped_ptr<ExternalApplicationListener> listener_; | 52 scoped_ptr<ExternalApplicationListener> listener_; |
53 }; | 53 }; |
54 | 54 |
55 namespace { | 55 namespace { |
56 class StubShellImpl : public InterfaceImpl<Shell> { | 56 class StubShellImpl : public InterfaceImpl<Shell> { |
57 private: | 57 private: |
58 virtual void ConnectToApplication( | 58 virtual void ConnectToApplication( |
59 const String& requestor_url, | 59 const String& requestor_url, |
60 InterfaceRequest<ServiceProvider> in_service_provider) MOJO_OVERRIDE { | 60 InterfaceRequest<ServiceProvider> in_service_provider) override { |
61 ServiceProviderPtr out_service_provider; | 61 ServiceProviderPtr out_service_provider; |
62 out_service_provider.Bind(in_service_provider.PassMessagePipe()); | 62 out_service_provider.Bind(in_service_provider.PassMessagePipe()); |
63 client()->AcceptConnection(requestor_url, out_service_provider.Pass()); | 63 client()->AcceptConnection(requestor_url, out_service_provider.Pass()); |
64 } | 64 } |
65 }; | 65 }; |
66 | 66 |
67 void DoLocalRegister(const GURL& app_url, ScopedMessagePipeHandle shell) { | 67 void DoLocalRegister(const GURL& app_url, ScopedMessagePipeHandle shell) { |
68 BindToPipe(new StubShellImpl, shell.Pass()); | 68 BindToPipe(new StubShellImpl, shell.Pass()); |
69 } | 69 } |
70 | 70 |
(...skipping 25 matching lines...) Expand all Loading... |
96 | 96 |
97 namespace { | 97 namespace { |
98 class QuitLoopOnConnectApplicationImpl : public InterfaceImpl<Application> { | 98 class QuitLoopOnConnectApplicationImpl : public InterfaceImpl<Application> { |
99 public: | 99 public: |
100 QuitLoopOnConnectApplicationImpl(const std::string& url, | 100 QuitLoopOnConnectApplicationImpl(const std::string& url, |
101 scoped_refptr<base::TaskRunner> loop, | 101 scoped_refptr<base::TaskRunner> loop, |
102 base::Closure quit_callback) | 102 base::Closure quit_callback) |
103 : url_(url), to_quit_(loop), quit_callback_(quit_callback) {} | 103 : url_(url), to_quit_(loop), quit_callback_(quit_callback) {} |
104 | 104 |
105 private: | 105 private: |
106 virtual void Initialize(Array<String> args) MOJO_OVERRIDE {} | 106 virtual void Initialize(Array<String> args) override {} |
107 | 107 |
108 virtual void AcceptConnection(const String& requestor_url, | 108 virtual void AcceptConnection(const String& requestor_url, |
109 ServiceProviderPtr p) MOJO_OVERRIDE { | 109 ServiceProviderPtr p) override { |
110 DVLOG(1) << url_ << " accepting connection from " << requestor_url; | 110 DVLOG(1) << url_ << " accepting connection from " << requestor_url; |
111 to_quit_->PostTask(FROM_HERE, quit_callback_); | 111 to_quit_->PostTask(FROM_HERE, quit_callback_); |
112 } | 112 } |
113 | 113 |
114 const std::string url_; | 114 const std::string url_; |
115 scoped_refptr<base::TaskRunner> to_quit_; | 115 scoped_refptr<base::TaskRunner> to_quit_; |
116 base::Closure quit_callback_; | 116 base::Closure quit_callback_; |
117 }; | 117 }; |
118 | 118 |
119 class FakeExternalApplication { | 119 class FakeExternalApplication { |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 | 219 |
220 // The apps need to be destroyed on the thread where they did socket stuff. | 220 // The apps need to be destroyed on the thread where they did socket stuff. |
221 io_thread_.task_runner()->PostTask(FROM_HERE, | 221 io_thread_.task_runner()->PostTask(FROM_HERE, |
222 base::Bind(&DestroyOnIOThread, | 222 base::Bind(&DestroyOnIOThread, |
223 base::Passed(&supersweet_app), | 223 base::Passed(&supersweet_app), |
224 base::Passed(&awesome_app))); | 224 base::Passed(&awesome_app))); |
225 } | 225 } |
226 | 226 |
227 } // namespace shell | 227 } // namespace shell |
228 } // namespace mojo | 228 } // namespace mojo |
OLD | NEW |