| 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/picasa_finder.h" | 5 #include "chrome/browser/media_galleries/fileapi/picasa/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 18 matching lines...) Expand all Loading... |
| 29 // TODO(tommycli): Check Mac Preferences for alternative path. | 29 // TODO(tommycli): Check Mac Preferences for alternative path. |
| 30 if (!PathService::Get(base::DIR_APP_DATA, &path)) | 30 if (!PathService::Get(base::DIR_APP_DATA, &path)) |
| 31 return base::FilePath(); | 31 return base::FilePath(); |
| 32 #else | 32 #else |
| 33 return base::FilePath(); | 33 return base::FilePath(); |
| 34 #endif | 34 #endif |
| 35 | 35 |
| 36 path = path.AppendASCII("Google").AppendASCII("Picasa2").AppendASCII("db3"); | 36 path = path.AppendASCII("Google").AppendASCII("Picasa2").AppendASCII("db3"); |
| 37 | 37 |
| 38 // Verify actual existence | 38 // Verify actual existence |
| 39 if (!file_util::DirectoryExists(path)) | 39 if (!base::DirectoryExists(path)) |
| 40 path.clear(); | 40 path.clear(); |
| 41 | 41 |
| 42 return path; | 42 return path; |
| 43 } | 43 } |
| 44 | 44 |
| 45 void FinishOnOriginalThread(const PicasaFinder::DeviceIDCallback& callback, | 45 void FinishOnOriginalThread(const PicasaFinder::DeviceIDCallback& callback, |
| 46 const base::FilePath& database_path) { | 46 const base::FilePath& database_path) { |
| 47 if (!database_path.empty()) | 47 if (!database_path.empty()) |
| 48 callback.Run(chrome::StorageInfo::MakeDeviceId( | 48 callback.Run(chrome::StorageInfo::MakeDeviceId( |
| 49 chrome::StorageInfo::PICASA, | 49 chrome::StorageInfo::PICASA, |
| 50 database_path.AsUTF8Unsafe())); | 50 database_path.AsUTF8Unsafe())); |
| 51 } | 51 } |
| 52 | 52 |
| 53 } | 53 } |
| 54 | 54 |
| 55 void PicasaFinder::FindPicasaDatabase( | 55 void PicasaFinder::FindPicasaDatabase( |
| 56 const PicasaFinder::DeviceIDCallback& callback) { | 56 const PicasaFinder::DeviceIDCallback& callback) { |
| 57 content::BrowserThread::PostTaskAndReplyWithResult( | 57 content::BrowserThread::PostTaskAndReplyWithResult( |
| 58 content::BrowserThread::FILE, | 58 content::BrowserThread::FILE, |
| 59 FROM_HERE, | 59 FROM_HERE, |
| 60 base::Bind(&FindPicasaDatabaseOnFileThread), | 60 base::Bind(&FindPicasaDatabaseOnFileThread), |
| 61 base::Bind(&FinishOnOriginalThread, callback)); | 61 base::Bind(&FinishOnOriginalThread, callback)); |
| 62 } | 62 } |
| 63 | 63 |
| 64 } // namespace picasa | 64 } // namespace picasa |
| OLD | NEW |