OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/local_discovery/pwg_raster_converter.h" | 5 #include "chrome/browser/local_discovery/pwg_raster_converter.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> |
8 | 9 |
9 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
10 #include "base/cancelable_callback.h" | 11 #include "base/cancelable_callback.h" |
11 #include "base/files/file.h" | 12 #include "base/files/file.h" |
12 #include "base/files/file_util.h" | 13 #include "base/files/file_util.h" |
13 #include "base/files/scoped_temp_dir.h" | 14 #include "base/files/scoped_temp_dir.h" |
14 #include "base/location.h" | 15 #include "base/location.h" |
15 #include "base/logging.h" | 16 #include "base/logging.h" |
16 #include "base/macros.h" | 17 #include "base/macros.h" |
17 #include "base/single_thread_task_runner.h" | 18 #include "base/single_thread_task_runner.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 return temp_dir_.path().AppendASCII("output.pwg"); | 53 return temp_dir_.path().AppendASCII("output.pwg"); |
53 } | 54 } |
54 | 55 |
55 base::FilePath GetPdfPath() const { | 56 base::FilePath GetPdfPath() const { |
56 return temp_dir_.path().AppendASCII("input.pdf"); | 57 return temp_dir_.path().AppendASCII("input.pdf"); |
57 } | 58 } |
58 | 59 |
59 IPC::PlatformFileForTransit GetPdfForProcess(base::ProcessHandle process) { | 60 IPC::PlatformFileForTransit GetPdfForProcess(base::ProcessHandle process) { |
60 DCHECK(pdf_file_.IsValid()); | 61 DCHECK(pdf_file_.IsValid()); |
61 IPC::PlatformFileForTransit transit = | 62 IPC::PlatformFileForTransit transit = |
62 IPC::TakeFileHandleForProcess(pdf_file_.Pass(), process); | 63 IPC::TakeFileHandleForProcess(std::move(pdf_file_), process); |
63 return transit; | 64 return transit; |
64 } | 65 } |
65 | 66 |
66 IPC::PlatformFileForTransit GetPwgForProcess(base::ProcessHandle process) { | 67 IPC::PlatformFileForTransit GetPwgForProcess(base::ProcessHandle process) { |
67 DCHECK(pwg_file_.IsValid()); | 68 DCHECK(pwg_file_.IsValid()); |
68 IPC::PlatformFileForTransit transit = | 69 IPC::PlatformFileForTransit transit = |
69 IPC::TakeFileHandleForProcess(pwg_file_.Pass(), process); | 70 IPC::TakeFileHandleForProcess(std::move(pwg_file_), process); |
70 return transit; | 71 return transit; |
71 } | 72 } |
72 | 73 |
73 private: | 74 private: |
74 base::ScopedTempDir temp_dir_; | 75 base::ScopedTempDir temp_dir_; |
75 base::File pdf_file_; | 76 base::File pdf_file_; |
76 base::File pwg_file_; | 77 base::File pwg_file_; |
77 }; | 78 }; |
78 | 79 |
79 void FileHandlers::Init(base::RefCountedMemory* data) { | 80 void FileHandlers::Init(base::RefCountedMemory* data) { |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 } | 357 } |
357 } | 358 } |
358 | 359 |
359 result.rotate_all_pages = raster_capability.value().rotate_all_pages; | 360 result.rotate_all_pages = raster_capability.value().rotate_all_pages; |
360 | 361 |
361 result.reverse_page_order = raster_capability.value().reverse_order_streaming; | 362 result.reverse_page_order = raster_capability.value().reverse_order_streaming; |
362 return result; | 363 return result; |
363 } | 364 } |
364 | 365 |
365 } // namespace local_discovery | 366 } // namespace local_discovery |
OLD | NEW |