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_picasa_albums_indexer.h" | 5 #include "chrome/browser/media_galleries/fileapi/safe_picasa_albums_indexer.h" |
6 | 6 |
7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
| 8 #include "base/single_thread_task_runner.h" |
| 9 #include "base/thread_task_runner_handle.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/extensions/chrome_utility_extensions_messages.h" | 11 #include "chrome/common/extensions/chrome_utility_extensions_messages.h" |
10 #include "chrome/grit/generated_resources.h" | 12 #include "chrome/grit/generated_resources.h" |
11 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
12 #include "content/public/browser/child_process_data.h" | 14 #include "content/public/browser/child_process_data.h" |
13 #include "content/public/browser/utility_process_host.h" | 15 #include "content/public/browser/utility_process_host.h" |
14 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
15 | 17 |
16 using content::BrowserThread; | 18 using content::BrowserThread; |
17 using content::UtilityProcessHost; | 19 using content::UtilityProcessHost; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 FROM_HERE, | 92 FROM_HERE, |
91 base::Bind(&SafePicasaAlbumsIndexer::StartWorkOnIOThread, this)); | 93 base::Bind(&SafePicasaAlbumsIndexer::StartWorkOnIOThread, this)); |
92 } | 94 } |
93 } | 95 } |
94 | 96 |
95 void SafePicasaAlbumsIndexer::StartWorkOnIOThread() { | 97 void SafePicasaAlbumsIndexer::StartWorkOnIOThread() { |
96 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 98 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
97 DCHECK_EQ(INITIAL_STATE, parser_state_); | 99 DCHECK_EQ(INITIAL_STATE, parser_state_); |
98 | 100 |
99 UtilityProcessHost* host = | 101 UtilityProcessHost* host = |
100 UtilityProcessHost::Create(this, base::MessageLoopProxy::current()); | 102 UtilityProcessHost::Create(this, base::ThreadTaskRunnerHandle::Get()); |
101 host->SetName(l10n_util::GetStringUTF16( | 103 host->SetName(l10n_util::GetStringUTF16( |
102 IDS_UTILITY_PROCESS_MEDIA_LIBRARY_FILE_CHECKER_NAME)); | 104 IDS_UTILITY_PROCESS_MEDIA_LIBRARY_FILE_CHECKER_NAME)); |
103 host->Send(new ChromeUtilityMsg_IndexPicasaAlbumsContents(album_uids_, | 105 host->Send(new ChromeUtilityMsg_IndexPicasaAlbumsContents(album_uids_, |
104 folders_inis_)); | 106 folders_inis_)); |
105 parser_state_ = STARTED_PARSING_STATE; | 107 parser_state_ = STARTED_PARSING_STATE; |
106 } | 108 } |
107 | 109 |
108 void SafePicasaAlbumsIndexer::OnIndexPicasaAlbumsContentsFinished( | 110 void SafePicasaAlbumsIndexer::OnIndexPicasaAlbumsContentsFinished( |
109 const AlbumImagesMap& albums_images) { | 111 const AlbumImagesMap& albums_images) { |
110 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 112 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
(...skipping 22 matching lines...) Expand all Loading... |
133 IPC_BEGIN_MESSAGE_MAP(SafePicasaAlbumsIndexer, message) | 135 IPC_BEGIN_MESSAGE_MAP(SafePicasaAlbumsIndexer, message) |
134 IPC_MESSAGE_HANDLER( | 136 IPC_MESSAGE_HANDLER( |
135 ChromeUtilityHostMsg_IndexPicasaAlbumsContents_Finished, | 137 ChromeUtilityHostMsg_IndexPicasaAlbumsContents_Finished, |
136 OnIndexPicasaAlbumsContentsFinished) | 138 OnIndexPicasaAlbumsContentsFinished) |
137 IPC_MESSAGE_UNHANDLED(handled = false) | 139 IPC_MESSAGE_UNHANDLED(handled = false) |
138 IPC_END_MESSAGE_MAP() | 140 IPC_END_MESSAGE_MAP() |
139 return handled; | 141 return handled; |
140 } | 142 } |
141 | 143 |
142 } // namespace picasa | 144 } // namespace picasa |
OLD | NEW |