| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/callback.h" | 6 #include "base/callback.h" |
| 7 #include "base/containers/hash_tables.h" | 7 #include "base/containers/hash_tables.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "components/view_manager/public/cpp/lib/view_manager_client_impl.h" | 9 #include "components/view_manager/public/cpp/lib/view_manager_client_impl.h" |
| 10 #include "components/view_manager/public/cpp/types.h" | 10 #include "components/view_manager/public/cpp/types.h" |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 } | 425 } |
| 426 } | 426 } |
| 427 | 427 |
| 428 void OnViewDestroyed(mojo::View* view) override { | 428 void OnViewDestroyed(mojo::View* view) override { |
| 429 DCHECK(embedder_for_roots_.find(view) != embedder_for_roots_.end()); | 429 DCHECK(embedder_for_roots_.find(view) != embedder_for_roots_.end()); |
| 430 const auto& it = embedder_for_roots_.find(view); | 430 const auto& it = embedder_for_roots_.find(view); |
| 431 DCHECK(it != embedder_for_roots_.end()); | 431 DCHECK(it != embedder_for_roots_.end()); |
| 432 delete it->second; | 432 delete it->second; |
| 433 embedder_for_roots_.erase(it); | 433 embedder_for_roots_.erase(it); |
| 434 if (embedder_for_roots_.size() == 0) | 434 if (embedder_for_roots_.size() == 0) |
| 435 app_.Terminate(); | 435 app_.Quit(); |
| 436 } | 436 } |
| 437 | 437 |
| 438 void DrawBitmap(EmbedderData* embedder_data) { | 438 void DrawBitmap(EmbedderData* embedder_data) { |
| 439 if (!doc_) | 439 if (!doc_) |
| 440 return; | 440 return; |
| 441 | 441 |
| 442 FPDF_PAGE page = FPDF_LoadPage(doc_, current_page_); | 442 FPDF_PAGE page = FPDF_LoadPage(doc_, current_page_); |
| 443 int width = static_cast<int>(FPDF_GetPageWidth(page)); | 443 int width = static_cast<int>(FPDF_GetPageWidth(page)); |
| 444 int height = static_cast<int>(FPDF_GetPageHeight(page)); | 444 int height = static_cast<int>(FPDF_GetPageHeight(page)); |
| 445 | 445 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 DISALLOW_COPY_AND_ASSIGN(PDFViewer); | 534 DISALLOW_COPY_AND_ASSIGN(PDFViewer); |
| 535 }; | 535 }; |
| 536 | 536 |
| 537 } // namespace | 537 } // namespace |
| 538 } // namespace pdf_viewer | 538 } // namespace pdf_viewer |
| 539 | 539 |
| 540 MojoResult MojoMain(MojoHandle application_request) { | 540 MojoResult MojoMain(MojoHandle application_request) { |
| 541 mojo::ApplicationRunner runner(new pdf_viewer::PDFViewer()); | 541 mojo::ApplicationRunner runner(new pdf_viewer::PDFViewer()); |
| 542 return runner.Run(application_request); | 542 return runner.Run(application_request); |
| 543 } | 543 } |
| OLD | NEW |