OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/shell/ui/engine.h" | 5 #include "sky/shell/ui/engine.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/trace_event/trace_event.h" | 8 #include "base/trace_event/trace_event.h" |
9 #include "mojo/public/cpp/application/connect.h" | 9 #include "mojo/public/cpp/application/connect.h" |
10 #include "sky/engine/public/platform/WebInputEvent.h" | 10 #include "sky/engine/public/platform/WebInputEvent.h" |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 RunFromLibrary(url); | 211 RunFromLibrary(url); |
212 } | 212 } |
213 | 213 |
214 void Engine::RunFromFile(const mojo::String& main, | 214 void Engine::RunFromFile(const mojo::String& main, |
215 const mojo::String& package_root) { | 215 const mojo::String& package_root) { |
216 dart_library_provider_.reset( | 216 dart_library_provider_.reset( |
217 new DartLibraryProviderFiles(base::FilePath(package_root))); | 217 new DartLibraryProviderFiles(base::FilePath(package_root))); |
218 RunFromLibrary(main); | 218 RunFromLibrary(main); |
219 } | 219 } |
220 | 220 |
221 void Engine::RunFromSnapshot(mojo::ScopedDataPipeConsumerHandle snapshot) { | 221 void Engine::RunFromSnapshot(const mojo::String& url, |
222 // TODO(abarth): Implement. | 222 mojo::ScopedDataPipeConsumerHandle snapshot) { |
| 223 CloseWebViewIfNeeded(); |
| 224 sky_view_ = blink::SkyView::Create(this); |
| 225 sky_view_->RunFromSnapshot(blink::WebString::fromUTF8(url), snapshot.Pass()); |
| 226 UpdateSkyViewSize(); |
223 } | 227 } |
224 | 228 |
225 void Engine::LoadUsingWebView(const mojo::String& mojo_url) { | 229 void Engine::LoadUsingWebView(const mojo::String& mojo_url) { |
226 GURL url(mojo_url); | 230 GURL url(mojo_url); |
227 DCHECK(blink::WebView::shouldUseWebView(url)); | 231 DCHECK(blink::WebView::shouldUseWebView(url)); |
228 | 232 |
229 if (sky_view_) | 233 if (sky_view_) |
230 sky_view_ = nullptr; | 234 sky_view_ = nullptr; |
231 | 235 |
232 LOG(WARNING) << ".sky support is deprecated, please use .dart for main()"; | 236 LOG(WARNING) << ".sky support is deprecated, please use .dart for main()"; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 | 290 |
287 void Engine::DidNavigateLocally(const mojo::String& url) { | 291 void Engine::DidNavigateLocally(const mojo::String& url) { |
288 } | 292 } |
289 | 293 |
290 void Engine::RequestNavigateHistory(int32_t delta) { | 294 void Engine::RequestNavigateHistory(int32_t delta) { |
291 NOTIMPLEMENTED(); | 295 NOTIMPLEMENTED(); |
292 } | 296 } |
293 | 297 |
294 } // namespace shell | 298 } // namespace shell |
295 } // namespace sky | 299 } // namespace sky |
OLD | NEW |