| 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 "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" | 7 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" |
| 8 #include "chrome/common/chrome_utility_messages.h" | 8 #include "chrome/common/chrome_utility_messages.h" |
| 9 #include "chrome/common/extensions/chrome_utility_extensions_messages.h" | 9 #include "chrome/common/extensions/chrome_utility_extensions_messages.h" |
| 10 #include "chrome/grit/generated_resources.h" |
| 10 #include "content/public/browser/browser_thread.h" | 11 #include "content/public/browser/browser_thread.h" |
| 11 #include "content/public/browser/child_process_data.h" | 12 #include "content/public/browser/child_process_data.h" |
| 12 #include "ipc/ipc_platform_file.h" | 13 #include "ipc/ipc_platform_file.h" |
| 14 #include "ui/base/l10n/l10n_util.h" |
| 13 | 15 |
| 14 using content::BrowserThread; | 16 using content::BrowserThread; |
| 15 using content::UtilityProcessHost; | 17 using content::UtilityProcessHost; |
| 16 | 18 |
| 17 namespace iapps { | 19 namespace iapps { |
| 18 | 20 |
| 19 SafeIAppsLibraryParser::SafeIAppsLibraryParser() | 21 SafeIAppsLibraryParser::SafeIAppsLibraryParser() |
| 20 : parser_state_(INITIAL_STATE) {} | 22 : parser_state_(INITIAL_STATE) {} |
| 21 | 23 |
| 22 void SafeIAppsLibraryParser::ParseIPhotoLibrary( | 24 void SafeIAppsLibraryParser::ParseIPhotoLibrary( |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 SafeIAppsLibraryParser::~SafeIAppsLibraryParser() {} | 61 SafeIAppsLibraryParser::~SafeIAppsLibraryParser() {} |
| 60 | 62 |
| 61 void SafeIAppsLibraryParser::StartProcessOnIOThread() { | 63 void SafeIAppsLibraryParser::StartProcessOnIOThread() { |
| 62 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 64 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 63 DCHECK_EQ(INITIAL_STATE, parser_state_); | 65 DCHECK_EQ(INITIAL_STATE, parser_state_); |
| 64 | 66 |
| 65 scoped_refptr<base::MessageLoopProxy> message_loop_proxy = | 67 scoped_refptr<base::MessageLoopProxy> message_loop_proxy = |
| 66 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); | 68 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); |
| 67 utility_process_host_ = | 69 utility_process_host_ = |
| 68 UtilityProcessHost::Create(this, message_loop_proxy.get())->AsWeakPtr(); | 70 UtilityProcessHost::Create(this, message_loop_proxy.get())->AsWeakPtr(); |
| 71 utility_process_host_->SetName(l10n_util::GetStringUTF16( |
| 72 IDS_UTILITY_PROCESS_MEDIA_LIBRARY_FILE_CHECKER_NAME)); |
| 69 // Wait for the startup notification before sending the main IPC to the | 73 // Wait for the startup notification before sending the main IPC to the |
| 70 // utility process, so that we can dup the file handle. | 74 // utility process, so that we can dup the file handle. |
| 71 utility_process_host_->Send(new ChromeUtilityMsg_StartupPing); | 75 utility_process_host_->Send(new ChromeUtilityMsg_StartupPing); |
| 72 parser_state_ = PINGED_UTILITY_PROCESS_STATE; | 76 parser_state_ = PINGED_UTILITY_PROCESS_STATE; |
| 73 } | 77 } |
| 74 | 78 |
| 75 void SafeIAppsLibraryParser::OnUtilityProcessStarted() { | 79 void SafeIAppsLibraryParser::OnUtilityProcessStarted() { |
| 76 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 80 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 77 if (parser_state_ != PINGED_UTILITY_PROCESS_STATE) | 81 if (parser_state_ != PINGED_UTILITY_PROCESS_STATE) |
| 78 return; | 82 return; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 OnGotIPhotoLibrary) | 167 OnGotIPhotoLibrary) |
| 164 #endif | 168 #endif |
| 165 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_GotITunesLibrary, | 169 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_GotITunesLibrary, |
| 166 OnGotITunesLibrary) | 170 OnGotITunesLibrary) |
| 167 IPC_MESSAGE_UNHANDLED(handled = false) | 171 IPC_MESSAGE_UNHANDLED(handled = false) |
| 168 IPC_END_MESSAGE_MAP() | 172 IPC_END_MESSAGE_MAP() |
| 169 return handled; | 173 return handled; |
| 170 } | 174 } |
| 171 | 175 |
| 172 } // namespace iapps | 176 } // namespace iapps |
| OLD | NEW |