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 "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" | 8 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.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 "content/public/browser/utility_process_host.h" | 13 #include "content/public/browser/utility_process_host.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 picasa { | 19 namespace picasa { |
18 | 20 |
19 namespace { | 21 namespace { |
20 | 22 |
21 // Arbitrarily chosen to be a decent size but not block thread too much. | 23 // Arbitrarily chosen to be a decent size but not block thread too much. |
22 const int kPicasaINIReadBatchSize = 10; | 24 const int kPicasaINIReadBatchSize = 10; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
89 base::Bind(&SafePicasaAlbumsIndexer::StartWorkOnIOThread, this)); | 91 base::Bind(&SafePicasaAlbumsIndexer::StartWorkOnIOThread, this)); |
90 } | 92 } |
91 } | 93 } |
92 | 94 |
93 void SafePicasaAlbumsIndexer::StartWorkOnIOThread() { | 95 void SafePicasaAlbumsIndexer::StartWorkOnIOThread() { |
94 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 96 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
95 DCHECK_EQ(INITIAL_STATE, parser_state_); | 97 DCHECK_EQ(INITIAL_STATE, parser_state_); |
96 | 98 |
97 UtilityProcessHost* host = | 99 UtilityProcessHost* host = |
98 UtilityProcessHost::Create(this, base::MessageLoopProxy::current()); | 100 UtilityProcessHost::Create(this, base::MessageLoopProxy::current()); |
101 host->SetName(l10n_util::GetStringUTF16( | |
102 IDS_UTILITY_PROCESS_PROXY_RESOLVER_NAME)); | |
Charlie Reis
2015/04/06 23:47:40
This doesn't look right.
| |
99 host->Send(new ChromeUtilityMsg_IndexPicasaAlbumsContents(album_uids_, | 103 host->Send(new ChromeUtilityMsg_IndexPicasaAlbumsContents(album_uids_, |
100 folders_inis_)); | 104 folders_inis_)); |
101 parser_state_ = STARTED_PARSING_STATE; | 105 parser_state_ = STARTED_PARSING_STATE; |
102 } | 106 } |
103 | 107 |
104 void SafePicasaAlbumsIndexer::OnIndexPicasaAlbumsContentsFinished( | 108 void SafePicasaAlbumsIndexer::OnIndexPicasaAlbumsContentsFinished( |
105 const AlbumImagesMap& albums_images) { | 109 const AlbumImagesMap& albums_images) { |
106 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 110 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
107 DCHECK(!callback_.is_null()); | 111 DCHECK(!callback_.is_null()); |
108 if (parser_state_ != STARTED_PARSING_STATE) | 112 if (parser_state_ != STARTED_PARSING_STATE) |
(...skipping 20 matching lines...) Expand all Loading... | |
129 IPC_BEGIN_MESSAGE_MAP(SafePicasaAlbumsIndexer, message) | 133 IPC_BEGIN_MESSAGE_MAP(SafePicasaAlbumsIndexer, message) |
130 IPC_MESSAGE_HANDLER( | 134 IPC_MESSAGE_HANDLER( |
131 ChromeUtilityHostMsg_IndexPicasaAlbumsContents_Finished, | 135 ChromeUtilityHostMsg_IndexPicasaAlbumsContents_Finished, |
132 OnIndexPicasaAlbumsContentsFinished) | 136 OnIndexPicasaAlbumsContentsFinished) |
133 IPC_MESSAGE_UNHANDLED(handled = false) | 137 IPC_MESSAGE_UNHANDLED(handled = false) |
134 IPC_END_MESSAGE_MAP() | 138 IPC_END_MESSAGE_MAP() |
135 return handled; | 139 return handled; |
136 } | 140 } |
137 | 141 |
138 } // namespace picasa | 142 } // namespace picasa |
OLD | NEW |