| 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_itunes_pref_parser_win.h" | 5 #include "chrome/browser/media_galleries/fileapi/safe_itunes_pref_parser_win.h" |
| 6 | 6 |
| 7 #include "chrome/common/extensions/chrome_utility_extensions_messages.h" | 7 #include "chrome/common/extensions/chrome_utility_extensions_messages.h" |
| 8 #include "chrome/grit/generated_resources.h" |
| 8 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
| 9 #include "content/public/browser/utility_process_host.h" | 10 #include "content/public/browser/utility_process_host.h" |
| 11 #include "ui/base/l10n/l10n_util.h" |
| 10 | 12 |
| 11 using content::BrowserThread; | 13 using content::BrowserThread; |
| 12 using content::UtilityProcessHost; | 14 using content::UtilityProcessHost; |
| 13 | 15 |
| 14 namespace itunes { | 16 namespace itunes { |
| 15 | 17 |
| 16 SafeITunesPrefParserWin::SafeITunesPrefParserWin( | 18 SafeITunesPrefParserWin::SafeITunesPrefParserWin( |
| 17 const std::string& unsafe_xml, | 19 const std::string& unsafe_xml, |
| 18 const ParserCallback& callback) | 20 const ParserCallback& callback) |
| 19 : unsafe_xml_(unsafe_xml), | 21 : unsafe_xml_(unsafe_xml), |
| (...skipping 13 matching lines...) Expand all Loading... |
| 33 | 35 |
| 34 SafeITunesPrefParserWin::~SafeITunesPrefParserWin() { | 36 SafeITunesPrefParserWin::~SafeITunesPrefParserWin() { |
| 35 } | 37 } |
| 36 | 38 |
| 37 void SafeITunesPrefParserWin::StartWorkOnIOThread() { | 39 void SafeITunesPrefParserWin::StartWorkOnIOThread() { |
| 38 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 40 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 39 DCHECK_EQ(INITIAL_STATE, parser_state_); | 41 DCHECK_EQ(INITIAL_STATE, parser_state_); |
| 40 | 42 |
| 41 UtilityProcessHost* host = | 43 UtilityProcessHost* host = |
| 42 UtilityProcessHost::Create(this, base::MessageLoopProxy::current()); | 44 UtilityProcessHost::Create(this, base::MessageLoopProxy::current()); |
| 45 host->SetName(l10n_util::GetStringUTF16( |
| 46 IDS_UTILITY_PROCESS_MEDIA_LIBRARY_FILE_CHECKER_NAME)); |
| 43 host->Send(new ChromeUtilityMsg_ParseITunesPrefXml(unsafe_xml_)); | 47 host->Send(new ChromeUtilityMsg_ParseITunesPrefXml(unsafe_xml_)); |
| 44 parser_state_ = STARTED_PARSING_STATE; | 48 parser_state_ = STARTED_PARSING_STATE; |
| 45 } | 49 } |
| 46 | 50 |
| 47 void SafeITunesPrefParserWin::OnGotITunesDirectory( | 51 void SafeITunesPrefParserWin::OnGotITunesDirectory( |
| 48 const base::FilePath& library_file) { | 52 const base::FilePath& library_file) { |
| 49 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 53 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 50 | 54 |
| 51 if (parser_state_ != STARTED_PARSING_STATE) | 55 if (parser_state_ != STARTED_PARSING_STATE) |
| 52 return; | 56 return; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 64 bool handled = true; | 68 bool handled = true; |
| 65 IPC_BEGIN_MESSAGE_MAP(SafeITunesPrefParserWin, message) | 69 IPC_BEGIN_MESSAGE_MAP(SafeITunesPrefParserWin, message) |
| 66 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_GotITunesDirectory, | 70 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_GotITunesDirectory, |
| 67 OnGotITunesDirectory) | 71 OnGotITunesDirectory) |
| 68 IPC_MESSAGE_UNHANDLED(handled = false) | 72 IPC_MESSAGE_UNHANDLED(handled = false) |
| 69 IPC_END_MESSAGE_MAP() | 73 IPC_END_MESSAGE_MAP() |
| 70 return handled; | 74 return handled; |
| 71 } | 75 } |
| 72 | 76 |
| 73 } // namespace itunes | 77 } // namespace itunes |
| OLD | NEW |