| 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/picasa_finder.h" | 5 #include "chrome/browser/media_galleries/fileapi/picasa_finder.h" |
| 6 | 6 |
| 7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 // Verify actual existence | 40 // Verify actual existence |
| 41 if (!base::DirectoryExists(path)) | 41 if (!base::DirectoryExists(path)) |
| 42 path.clear(); | 42 path.clear(); |
| 43 | 43 |
| 44 return path; | 44 return path; |
| 45 } | 45 } |
| 46 | 46 |
| 47 void FinishOnOriginalThread(const PicasaFinder::DeviceIDCallback& callback, | 47 void FinishOnOriginalThread(const PicasaFinder::DeviceIDCallback& callback, |
| 48 const base::FilePath& database_path) { | 48 const base::FilePath& database_path) { |
| 49 if (!database_path.empty()) | 49 std::string device_id; |
| 50 callback.Run(StorageInfo::MakeDeviceId(StorageInfo::PICASA, | 50 if (!database_path.empty()) { |
| 51 database_path.AsUTF8Unsafe())); | 51 device_id = StorageInfo::MakeDeviceId(StorageInfo::PICASA, |
| 52 database_path.AsUTF8Unsafe()); |
| 53 } |
| 54 callback.Run(device_id); |
| 52 } | 55 } |
| 53 | 56 |
| 54 } // namespace | 57 } // namespace |
| 55 | 58 |
| 56 void PicasaFinder::FindPicasaDatabase( | 59 void PicasaFinder::FindPicasaDatabase( |
| 57 const PicasaFinder::DeviceIDCallback& callback) { | 60 const PicasaFinder::DeviceIDCallback& callback) { |
| 58 content::BrowserThread::PostTaskAndReplyWithResult( | 61 content::BrowserThread::PostTaskAndReplyWithResult( |
| 59 content::BrowserThread::FILE, | 62 content::BrowserThread::FILE, |
| 60 FROM_HERE, | 63 FROM_HERE, |
| 61 base::Bind(&FindPicasaDatabaseOnFileThread), | 64 base::Bind(&FindPicasaDatabaseOnFileThread), |
| 62 base::Bind(&FinishOnOriginalThread, callback)); | 65 base::Bind(&FinishOnOriginalThread, callback)); |
| 63 } | 66 } |
| 64 | 67 |
| 65 } // namespace picasa | 68 } // namespace picasa |
| OLD | NEW |