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/application_manager/application_manager.h" | 5 #include "mojo/application_manager/application_manager.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 ServiceProviderPtr service_provider) | 47 ServiceProviderPtr service_provider) |
48 : manager_(manager), | 48 : manager_(manager), |
49 requested_url_(requested_url), | 49 requested_url_(requested_url), |
50 requestor_url_(requestor_url), | 50 requestor_url_(requestor_url), |
51 service_provider_(service_provider.Pass()) {} | 51 service_provider_(service_provider.Pass()) {} |
52 | 52 |
53 private: | 53 private: |
54 virtual ~LoadCallbacksImpl() {} | 54 virtual ~LoadCallbacksImpl() {} |
55 | 55 |
56 // LoadCallbacks implementation | 56 // LoadCallbacks implementation |
57 virtual ScopedMessagePipeHandle RegisterApplication() OVERRIDE { | 57 virtual ScopedMessagePipeHandle RegisterApplication() override { |
58 ScopedMessagePipeHandle shell_handle; | 58 ScopedMessagePipeHandle shell_handle; |
59 if (manager_) { | 59 if (manager_) { |
60 manager_->RegisterLoadedApplication(requested_url_, | 60 manager_->RegisterLoadedApplication(requested_url_, |
61 requestor_url_, | 61 requestor_url_, |
62 service_provider_.Pass(), | 62 service_provider_.Pass(), |
63 &shell_handle); | 63 &shell_handle); |
64 } | 64 } |
65 return shell_handle.Pass(); | 65 return shell_handle.Pass(); |
66 } | 66 } |
67 | 67 |
68 virtual void LoadWithContentHandler(const GURL& content_handler_url, | 68 virtual void LoadWithContentHandler(const GURL& content_handler_url, |
69 URLResponsePtr url_response) OVERRIDE { | 69 URLResponsePtr url_response) override { |
70 if (manager_) { | 70 if (manager_) { |
71 manager_->LoadWithContentHandler(requested_url_, | 71 manager_->LoadWithContentHandler(requested_url_, |
72 requestor_url_, | 72 requestor_url_, |
73 content_handler_url, | 73 content_handler_url, |
74 url_response.Pass(), | 74 url_response.Pass(), |
75 service_provider_.Pass()); | 75 service_provider_.Pass()); |
76 } | 76 } |
77 } | 77 } |
78 | 78 |
79 base::WeakPtr<ApplicationManager> manager_; | 79 base::WeakPtr<ApplicationManager> manager_; |
(...skipping 11 matching lines...) Expand all Loading... |
91 | 91 |
92 void ConnectToClient(const GURL& requestor_url, | 92 void ConnectToClient(const GURL& requestor_url, |
93 ServiceProviderPtr service_provider) { | 93 ServiceProviderPtr service_provider) { |
94 client()->AcceptConnection(String::From(requestor_url), | 94 client()->AcceptConnection(String::From(requestor_url), |
95 service_provider.Pass()); | 95 service_provider.Pass()); |
96 } | 96 } |
97 | 97 |
98 // ServiceProvider implementation: | 98 // ServiceProvider implementation: |
99 virtual void ConnectToApplication( | 99 virtual void ConnectToApplication( |
100 const String& app_url, | 100 const String& app_url, |
101 InterfaceRequest<ServiceProvider> in_service_provider) OVERRIDE { | 101 InterfaceRequest<ServiceProvider> in_service_provider) override { |
102 ServiceProviderPtr out_service_provider; | 102 ServiceProviderPtr out_service_provider; |
103 out_service_provider.Bind(in_service_provider.PassMessagePipe()); | 103 out_service_provider.Bind(in_service_provider.PassMessagePipe()); |
104 manager_->ConnectToApplication( | 104 manager_->ConnectToApplication( |
105 app_url.To<GURL>(), url_, out_service_provider.Pass()); | 105 app_url.To<GURL>(), url_, out_service_provider.Pass()); |
106 } | 106 } |
107 | 107 |
108 const GURL& url() const { return url_; } | 108 const GURL& url() const { return url_; } |
109 | 109 |
110 private: | 110 private: |
111 virtual void OnConnectionError() OVERRIDE { | 111 virtual void OnConnectionError() override { |
112 manager_->OnShellImplError(this); | 112 manager_->OnShellImplError(this); |
113 } | 113 } |
114 | 114 |
115 ApplicationManager* const manager_; | 115 ApplicationManager* const manager_; |
116 const GURL url_; | 116 const GURL url_; |
117 | 117 |
118 DISALLOW_COPY_AND_ASSIGN(ShellImpl); | 118 DISALLOW_COPY_AND_ASSIGN(ShellImpl); |
119 }; | 119 }; |
120 | 120 |
121 struct ApplicationManager::ContentHandlerConnection { | 121 struct ApplicationManager::ContentHandlerConnection { |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 StubServiceProvider* stub_sp = new StubServiceProvider; | 319 StubServiceProvider* stub_sp = new StubServiceProvider; |
320 ServiceProviderPtr spp; | 320 ServiceProviderPtr spp; |
321 BindToProxy(stub_sp, &spp); | 321 BindToProxy(stub_sp, &spp); |
322 ConnectToApplication(application_url, GURL(), spp.Pass()); | 322 ConnectToApplication(application_url, GURL(), spp.Pass()); |
323 MessagePipe pipe; | 323 MessagePipe pipe; |
324 stub_sp->GetRemoteServiceProvider()->ConnectToService(interface_name, | 324 stub_sp->GetRemoteServiceProvider()->ConnectToService(interface_name, |
325 pipe.handle1.Pass()); | 325 pipe.handle1.Pass()); |
326 return pipe.handle0.Pass(); | 326 return pipe.handle0.Pass(); |
327 } | 327 } |
328 } // namespace mojo | 328 } // namespace mojo |
OLD | NEW |