Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(345)

Unified Diff: sky/shell/ui/engine.cc

Issue 1211253004: Add MineDigger.apk that works offline (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: one more examples Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/shell/ui/engine.h ('k') | sky/tools/packager/main.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/shell/ui/engine.cc
diff --git a/sky/shell/ui/engine.cc b/sky/shell/ui/engine.cc
index b75b731656b66529cdfc7d835ffe32f66cbfc39e..fdefa53b4401e699b5876b7dfd41d55d7ef4db5b 100644
--- a/sky/shell/ui/engine.cc
+++ b/sky/shell/ui/engine.cc
@@ -5,7 +5,10 @@
#include "sky/shell/ui/engine.h"
#include "base/bind.h"
+#include "base/files/file_path.h"
+#include "base/threading/worker_pool.h"
#include "base/trace_event/trace_event.h"
+#include "mojo/common/data_pipe_utils.h"
#include "mojo/public/cpp/application/connect.h"
#include "sky/engine/public/platform/WebInputEvent.h"
#include "sky/engine/public/platform/sky_display_metrics.h"
@@ -29,6 +32,17 @@ namespace shell {
namespace {
+void Ignored(bool) {
+}
+
+mojo::ScopedDataPipeConsumerHandle Fetch(const base::FilePath& path) {
+ mojo::DataPipe pipe;
+ auto runner = base::WorkerPool::GetTaskRunner(true);
+ mojo::common::CopyFromFile(base::FilePath(path), pipe.producer_handle.Pass(),
+ 0, runner.get(), base::Bind(&Ignored));
+ return pipe.consumer_handle.Pass();
+}
+
void ConfigureSettings(blink::WebSettings* settings) {
settings->setDefaultFixedFontSize(13);
settings->setDefaultFontSize(16);
@@ -218,11 +232,11 @@ void Engine::RunFromFile(const mojo::String& main,
RunFromLibrary(main);
}
-void Engine::RunFromSnapshot(const mojo::String& url,
- mojo::ScopedDataPipeConsumerHandle snapshot) {
+void Engine::RunFromSnapshot(const mojo::String& path) {
CloseWebViewIfNeeded();
sky_view_ = blink::SkyView::Create(this);
- sky_view_->RunFromSnapshot(blink::WebString::fromUTF8(url), snapshot.Pass());
+ sky_view_->RunFromSnapshot(blink::WebString::fromUTF8(path),
+ Fetch(base::FilePath(path)));
UpdateSkyViewSize();
}
« no previous file with comments | « sky/shell/ui/engine.h ('k') | sky/tools/packager/main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698