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

Side by Side Diff: examples/ui/pdf_viewer/pdf_viewer.cc

Issue 2020453003: Convert ViewProviderApp and ContentViewerApp to implement ApplicationImplBase instead of Applicatio… (Closed) Base URL: https://github.com/domokit/mojo.git@work796_no_run_main_app
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « examples/ui/noodles/noodles_app.cc ('k') | examples/ui/png_viewer/png_viewer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <memory> 5 #include <memory>
6 #include <string> 6 #include <string>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "mojo/application/application_runner_chromium.h"
12 #include "mojo/data_pipe_utils/data_pipe_utils.h" 11 #include "mojo/data_pipe_utils/data_pipe_utils.h"
12 #include "mojo/environment/scoped_chromium_init.h"
13 #include "mojo/public/c/system/main.h" 13 #include "mojo/public/c/system/main.h"
14 #include "mojo/public/cpp/application/connect.h" 14 #include "mojo/public/cpp/application/connect.h"
15 #include "mojo/public/cpp/application/run_application.h"
15 #include "mojo/ui/choreographer.h" 16 #include "mojo/ui/choreographer.h"
16 #include "mojo/ui/content_viewer_app.h" 17 #include "mojo/ui/content_viewer_app.h"
17 #include "mojo/ui/ganesh_view.h" 18 #include "mojo/ui/ganesh_view.h"
18 #include "mojo/ui/input_handler.h" 19 #include "mojo/ui/input_handler.h"
20 #include "mojo/ui/view_provider_app.h"
19 #include "third_party/pdfium/fpdfsdk/include/fpdf_ext.h" 21 #include "third_party/pdfium/fpdfsdk/include/fpdf_ext.h"
20 #include "third_party/pdfium/fpdfsdk/include/fpdfview.h" 22 #include "third_party/pdfium/fpdfsdk/include/fpdfview.h"
21 #include "third_party/skia/include/core/SkCanvas.h" 23 #include "third_party/skia/include/core/SkCanvas.h"
22 #include "third_party/skia/include/core/SkData.h" 24 #include "third_party/skia/include/core/SkData.h"
23 #include "third_party/skia/include/core/SkImage.h" 25 #include "third_party/skia/include/core/SkImage.h"
24 #include "third_party/skia/include/core/SkImageInfo.h" 26 #include "third_party/skia/include/core/SkImageInfo.h"
25 #include "third_party/skia/include/core/SkSurface.h" 27 #include "third_party/skia/include/core/SkSurface.h"
26 #include "v8/include/v8.h" 28 #include "v8/include/v8.h"
27 29
28 namespace examples { 30 namespace examples {
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 DCHECK(pdf_library_); 267 DCHECK(pdf_library_);
266 DCHECK(pdf_document_); 268 DCHECK(pdf_document_);
267 } 269 }
268 270
269 ~PDFContentViewProviderApp() override {} 271 ~PDFContentViewProviderApp() override {}
270 272
271 void CreateView( 273 void CreateView(
272 const std::string& connection_url, 274 const std::string& connection_url,
273 mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request, 275 mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request,
274 mojo::InterfaceRequest<mojo::ServiceProvider> services) override { 276 mojo::InterfaceRequest<mojo::ServiceProvider> services) override {
275 new PDFDocumentView(mojo::CreateApplicationConnector(app_impl()->shell()), 277 new PDFDocumentView(mojo::CreateApplicationConnector(shell()),
276 view_owner_request.Pass(), pdf_document_); 278 view_owner_request.Pass(), pdf_document_);
277 } 279 }
278 280
279 private: 281 private:
280 std::shared_ptr<PDFLibrary> pdf_library_; 282 std::shared_ptr<PDFLibrary> pdf_library_;
281 std::shared_ptr<PDFDocument> pdf_document_; 283 std::shared_ptr<PDFDocument> pdf_document_;
282 284
283 DISALLOW_COPY_AND_ASSIGN(PDFContentViewProviderApp); 285 DISALLOW_COPY_AND_ASSIGN(PDFContentViewProviderApp);
284 }; 286 };
285 287
(...skipping 18 matching lines...) Expand all
304 306
305 private: 307 private:
306 std::shared_ptr<PDFLibrary> pdf_library_; 308 std::shared_ptr<PDFLibrary> pdf_library_;
307 309
308 DISALLOW_COPY_AND_ASSIGN(PDFContentViewerApp); 310 DISALLOW_COPY_AND_ASSIGN(PDFContentViewerApp);
309 }; 311 };
310 312
311 } // namespace examples 313 } // namespace examples
312 314
313 MojoResult MojoMain(MojoHandle application_request) { 315 MojoResult MojoMain(MojoHandle application_request) {
314 mojo::ApplicationRunnerChromium runner(new examples::PDFContentViewerApp()); 316 mojo::ScopedChromiumInit init;
315 return runner.Run(application_request); 317 examples::PDFContentViewerApp pdf_content_viewer_app;
318 return mojo::RunApplication(application_request, &pdf_content_viewer_app);
316 } 319 }
OLDNEW
« no previous file with comments | « examples/ui/noodles/noodles_app.cc ('k') | examples/ui/png_viewer/png_viewer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698