| 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 "sky/viewer/internals.h" | 5 #include "sky/viewer/internals.h" |
| 6 | 6 |
| 7 #include "mojo/edk/js/core.h" | 7 #include "mojo/edk/js/core.h" |
| 8 #include "mojo/edk/js/handle.h" | 8 #include "mojo/edk/js/handle.h" |
| 9 #include "mojo/edk/js/support.h" | 9 #include "mojo/edk/js/support.h" |
| 10 #include "mojo/edk/js/threading.h" | 10 #include "mojo/edk/js/threading.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 // owns the handle and is expected to use it to create the JS Application for | 93 // owns the handle and is expected to use it to create the JS Application for |
| 94 // the DocumentView. | 94 // the DocumentView. |
| 95 mojo::Handle Internals::PassShellProxyHandle() { | 95 mojo::Handle Internals::PassShellProxyHandle() { |
| 96 mojo::MessagePipe pipe; | 96 mojo::MessagePipe pipe; |
| 97 if (!shell_binding_.is_bound()) | 97 if (!shell_binding_.is_bound()) |
| 98 shell_binding_.Bind(pipe.handle0.Pass()); | 98 shell_binding_.Bind(pipe.handle0.Pass()); |
| 99 return pipe.handle1.release(); | 99 return pipe.handle1.release(); |
| 100 } | 100 } |
| 101 | 101 |
| 102 void Internals::ConnectToApplication( | 102 void Internals::ConnectToApplication( |
| 103 const mojo::String& application_url, | 103 const mojo::String& application_url, |
| 104 mojo::InterfaceRequest<mojo::ServiceProvider> provider) { | 104 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
| 105 if (document_view_) | 105 mojo::ServiceProviderPtr exported_services) { |
| 106 if (document_view_) { |
| 106 document_view_->shell()->ConnectToApplication( | 107 document_view_->shell()->ConnectToApplication( |
| 107 application_url, provider.Pass()); | 108 application_url, services.Pass(), exported_services.Pass()); |
| 109 } |
| 108 } | 110 } |
| 109 | 111 |
| 110 mojo::Handle Internals::ConnectToService( | 112 mojo::Handle Internals::ConnectToService( |
| 111 const std::string& application_url, const std::string& interface_name) { | 113 const std::string& application_url, const std::string& interface_name) { |
| 112 if (!document_view_) | 114 if (!document_view_) |
| 113 return mojo::Handle(); | 115 return mojo::Handle(); |
| 114 | 116 |
| 115 mojo::ServiceProviderPtr service_provider; | 117 mojo::ServiceProviderPtr service_provider; |
| 116 ConnectToApplication(application_url, mojo::GetProxy(&service_provider)); | 118 ConnectToApplication(application_url, mojo::GetProxy(&service_provider), |
| 119 mojo::ServiceProviderPtr()); |
| 117 | 120 |
| 118 mojo::MessagePipe pipe; | 121 mojo::MessagePipe pipe; |
| 119 service_provider->ConnectToService(interface_name, pipe.handle1.Pass()); | 122 service_provider->ConnectToService(interface_name, pipe.handle1.Pass()); |
| 120 return pipe.handle0.release(); | 123 return pipe.handle0.release(); |
| 121 } | 124 } |
| 122 | 125 |
| 123 void Internals::pauseAnimations(double pauseTime) { | 126 void Internals::pauseAnimations(double pauseTime) { |
| 124 if (pauseTime < 0) | 127 if (pauseTime < 0) |
| 125 return; | 128 return; |
| 126 | 129 |
| 127 document_view_->web_view()->mainFrame()->document().pauseAnimationsForTestin
g(pauseTime); | 130 document_view_->web_view()->mainFrame()->document().pauseAnimationsForTestin
g(pauseTime); |
| 128 } | 131 } |
| 129 | 132 |
| 130 } // namespace sky | 133 } // namespace sky |
| OLD | NEW |