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/media_galleries/fileapi/safe_iapps_library_parser.h" | 5 #include "chrome/browser/media_galleries/fileapi/safe_iapps_library_parser.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "build/build_config.h" | 9 #include "build/build_config.h" |
8 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" | 10 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" |
9 #include "chrome/common/chrome_utility_messages.h" | 11 #include "chrome/common/chrome_utility_messages.h" |
10 #include "chrome/common/extensions/chrome_utility_extensions_messages.h" | 12 #include "chrome/common/extensions/chrome_utility_extensions_messages.h" |
11 #include "chrome/grit/generated_resources.h" | 13 #include "chrome/grit/generated_resources.h" |
12 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
13 #include "content/public/browser/child_process_data.h" | 15 #include "content/public/browser/child_process_data.h" |
14 #include "ipc/ipc_platform_file.h" | 16 #include "ipc/ipc_platform_file.h" |
15 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
16 | 18 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 if (parser_state_ != PINGED_UTILITY_PROCESS_STATE) | 84 if (parser_state_ != PINGED_UTILITY_PROCESS_STATE) |
83 return; | 85 return; |
84 | 86 |
85 if (utility_process_host_->GetData().handle == base::kNullProcessHandle) { | 87 if (utility_process_host_->GetData().handle == base::kNullProcessHandle) { |
86 DLOG(ERROR) << "Child process handle is null"; | 88 DLOG(ERROR) << "Child process handle is null"; |
87 OnError(); | 89 OnError(); |
88 return; | 90 return; |
89 } | 91 } |
90 | 92 |
91 if (!itunes_callback_.is_null()) { | 93 if (!itunes_callback_.is_null()) { |
92 utility_process_host_->Send( | 94 utility_process_host_->Send(new ChromeUtilityMsg_ParseITunesLibraryXmlFile( |
93 new ChromeUtilityMsg_ParseITunesLibraryXmlFile( | 95 IPC::TakeFileHandleForProcess( |
94 IPC::TakeFileHandleForProcess( | 96 std::move(library_file_), |
95 library_file_.Pass(), | 97 utility_process_host_->GetData().handle))); |
96 utility_process_host_->GetData().handle))); | |
97 } else if (!iphoto_callback_.is_null()) { | 98 } else if (!iphoto_callback_.is_null()) { |
98 #if defined(OS_MACOSX) | 99 #if defined(OS_MACOSX) |
99 utility_process_host_->Send( | 100 utility_process_host_->Send(new ChromeUtilityMsg_ParseIPhotoLibraryXmlFile( |
100 new ChromeUtilityMsg_ParseIPhotoLibraryXmlFile( | 101 IPC::TakeFileHandleForProcess( |
101 IPC::TakeFileHandleForProcess( | 102 std::move(library_file_), |
102 library_file_.Pass(), | 103 utility_process_host_->GetData().handle))); |
103 utility_process_host_->GetData().handle))); | |
104 #endif | 104 #endif |
105 } | 105 } |
106 | 106 |
107 parser_state_ = STARTED_PARSING_STATE; | 107 parser_state_ = STARTED_PARSING_STATE; |
108 } | 108 } |
109 | 109 |
110 #if defined(OS_MACOSX) | 110 #if defined(OS_MACOSX) |
111 void SafeIAppsLibraryParser::OnGotIPhotoLibrary( | 111 void SafeIAppsLibraryParser::OnGotIPhotoLibrary( |
112 bool result, const iphoto::parser::Library& library) { | 112 bool result, const iphoto::parser::Library& library) { |
113 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 113 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 OnGotIPhotoLibrary) | 168 OnGotIPhotoLibrary) |
169 #endif | 169 #endif |
170 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_GotITunesLibrary, | 170 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_GotITunesLibrary, |
171 OnGotITunesLibrary) | 171 OnGotITunesLibrary) |
172 IPC_MESSAGE_UNHANDLED(handled = false) | 172 IPC_MESSAGE_UNHANDLED(handled = false) |
173 IPC_END_MESSAGE_MAP() | 173 IPC_END_MESSAGE_MAP() |
174 return handled; | 174 return handled; |
175 } | 175 } |
176 | 176 |
177 } // namespace iapps | 177 } // namespace iapps |
OLD | NEW |