| 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/file_util.h" | 7 #include "base/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/chrome_utility_messages.h" | 9 #include "chrome/common/chrome_utility_messages.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 void SafePicasaAlbumsIndexer::ProcessFoldersBatch() { | 60 void SafePicasaAlbumsIndexer::ProcessFoldersBatch() { |
| 61 DCHECK(MediaFileSystemBackend::CurrentlyOnMediaTaskRunnerThread()); | 61 DCHECK(MediaFileSystemBackend::CurrentlyOnMediaTaskRunnerThread()); |
| 62 | 62 |
| 63 for (int i = 0; i < kPicasaINIReadBatchSize && !folders_queue_.empty(); ++i) { | 63 for (int i = 0; i < kPicasaINIReadBatchSize && !folders_queue_.empty(); ++i) { |
| 64 base::FilePath folder_path = folders_queue_.front(); | 64 base::FilePath folder_path = folders_queue_.front(); |
| 65 folders_queue_.pop(); | 65 folders_queue_.pop(); |
| 66 | 66 |
| 67 folders_inis_.push_back(FolderINIContents()); | 67 folders_inis_.push_back(FolderINIContents()); |
| 68 | 68 |
| 69 bool ini_read = | 69 bool ini_read = |
| 70 file_util::ReadFileToString( | 70 base::ReadFileToString( |
| 71 folder_path.AppendASCII(kPicasaINIFilename), | 71 folder_path.AppendASCII(kPicasaINIFilename), |
| 72 &folders_inis_.back().ini_contents) || | 72 &folders_inis_.back().ini_contents) || |
| 73 file_util::ReadFileToString( | 73 base::ReadFileToString( |
| 74 folder_path.AppendASCII(kPicasaINIFilenameLegacy), | 74 folder_path.AppendASCII(kPicasaINIFilenameLegacy), |
| 75 &folders_inis_.back().ini_contents); | 75 &folders_inis_.back().ini_contents); |
| 76 | 76 |
| 77 // See kPicasaINIFilename declaration for details. | 77 // See kPicasaINIFilename declaration for details. |
| 78 if (ini_read) | 78 if (ini_read) |
| 79 folders_inis_.back().folder_path = folder_path; | 79 folders_inis_.back().folder_path = folder_path; |
| 80 else | 80 else |
| 81 folders_inis_.pop_back(); | 81 folders_inis_.pop_back(); |
| 82 } | 82 } |
| 83 | 83 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 IPC_BEGIN_MESSAGE_MAP(SafePicasaAlbumsIndexer, message) | 132 IPC_BEGIN_MESSAGE_MAP(SafePicasaAlbumsIndexer, message) |
| 133 IPC_MESSAGE_HANDLER( | 133 IPC_MESSAGE_HANDLER( |
| 134 ChromeUtilityHostMsg_IndexPicasaAlbumsContents_Finished, | 134 ChromeUtilityHostMsg_IndexPicasaAlbumsContents_Finished, |
| 135 OnIndexPicasaAlbumsContentsFinished) | 135 OnIndexPicasaAlbumsContentsFinished) |
| 136 IPC_MESSAGE_UNHANDLED(handled = false) | 136 IPC_MESSAGE_UNHANDLED(handled = false) |
| 137 IPC_END_MESSAGE_MAP() | 137 IPC_END_MESSAGE_MAP() |
| 138 return handled; | 138 return handled; |
| 139 } | 139 } |
| 140 | 140 |
| 141 } // namespace picasa | 141 } // namespace picasa |
| OLD | NEW |