| 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 "chrome/browser/printing/pdf_to_emf_converter.h" | 5 #include "chrome/browser/printing/pdf_to_emf_converter.h" |
| 6 | 6 |
| 7 #include <queue> | 7 #include <queue> |
| 8 #include <utility> |
| 8 | 9 |
| 9 #include "base/files/file.h" | 10 #include "base/files/file.h" |
| 10 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
| 11 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.h" |
| 12 #include "base/logging.h" | 13 #include "base/logging.h" |
| 13 #include "chrome/common/chrome_utility_messages.h" | 14 #include "chrome/common/chrome_utility_messages.h" |
| 14 #include "chrome/common/chrome_utility_printing_messages.h" | 15 #include "chrome/common/chrome_utility_printing_messages.h" |
| 15 #include "chrome/grit/generated_resources.h" | 16 #include "chrome/grit/generated_resources.h" |
| 16 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
| 17 #include "content/public/browser/child_process_data.h" | 18 #include "content/public/browser/child_process_data.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 107 |
| 107 void Stop(); | 108 void Stop(); |
| 108 | 109 |
| 109 // UtilityProcessHostClient implementation. | 110 // UtilityProcessHostClient implementation. |
| 110 void OnProcessCrashed(int exit_code) override; | 111 void OnProcessCrashed(int exit_code) override; |
| 111 void OnProcessLaunchFailed() override; | 112 void OnProcessLaunchFailed() override; |
| 112 bool OnMessageReceived(const IPC::Message& message) override; | 113 bool OnMessageReceived(const IPC::Message& message) override; |
| 113 | 114 |
| 114 private: | 115 private: |
| 115 class GetPageCallbackData { | 116 class GetPageCallbackData { |
| 116 MOVE_ONLY_TYPE_FOR_CPP_03(GetPageCallbackData, RValue); | 117 MOVE_ONLY_TYPE_FOR_CPP_03(GetPageCallbackData); |
| 117 | 118 |
| 118 public: | 119 public: |
| 119 GetPageCallbackData(int page_number, | 120 GetPageCallbackData(int page_number, |
| 120 PdfToEmfConverter::GetPageCallback callback) | 121 PdfToEmfConverter::GetPageCallback callback) |
| 121 : page_number_(page_number), callback_(callback) {} | 122 : page_number_(page_number), callback_(callback) {} |
| 122 | 123 |
| 123 // Move constructor for STL. | 124 GetPageCallbackData(GetPageCallbackData&& other) { |
| 124 GetPageCallbackData(RValue other) { this->operator=(other); } | 125 *this = std::move(other); |
| 126 } |
| 125 | 127 |
| 126 // Move assignment for STL. | 128 GetPageCallbackData& operator=(GetPageCallbackData&& rhs) { |
| 127 GetPageCallbackData& operator=(RValue rhs) { | 129 page_number_ = rhs.page_number_; |
| 128 page_number_ = rhs.object->page_number_; | 130 callback_ = rhs.callback_; |
| 129 callback_ = rhs.object->callback_; | 131 emf_ = std::move(rhs.emf_); |
| 130 emf_ = rhs.object->emf_.Pass(); | |
| 131 return *this; | 132 return *this; |
| 132 } | 133 } |
| 133 | 134 |
| 134 int page_number() const { return page_number_; } | 135 int page_number() const { return page_number_; } |
| 135 const PdfToEmfConverter::GetPageCallback& callback() const { | 136 const PdfToEmfConverter::GetPageCallback& callback() const { |
| 136 return callback_; | 137 return callback_; |
| 137 } | 138 } |
| 138 ScopedTempFile TakeEmf() { return emf_.Pass(); } | 139 ScopedTempFile TakeEmf() { return emf_.Pass(); } |
| 139 void set_emf(ScopedTempFile emf) { emf_ = emf.Pass(); } | 140 void set_emf(ScopedTempFile emf) { emf_ = emf.Pass(); } |
| 140 | 141 |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 | 502 |
| 502 PdfToEmfConverter::~PdfToEmfConverter() { | 503 PdfToEmfConverter::~PdfToEmfConverter() { |
| 503 } | 504 } |
| 504 | 505 |
| 505 // static | 506 // static |
| 506 scoped_ptr<PdfToEmfConverter> PdfToEmfConverter::CreateDefault() { | 507 scoped_ptr<PdfToEmfConverter> PdfToEmfConverter::CreateDefault() { |
| 507 return scoped_ptr<PdfToEmfConverter>(new PdfToEmfConverterImpl()); | 508 return scoped_ptr<PdfToEmfConverter>(new PdfToEmfConverterImpl()); |
| 508 } | 509 } |
| 509 | 510 |
| 510 } // namespace printing | 511 } // namespace printing |
| OLD | NEW |