iapps_finder_impl.cc revision 4e180b6a0b4720a9b8e9e959a882386f690f08ff
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 3// found in the LICENSE file. 4 5#include "chrome/browser/media_galleries/fileapi/iapps_finder_impl.h" 6 7#include "base/bind.h" 8#include "base/logging.h" 9#include "content/public/browser/browser_thread.h" 10 11namespace iapps { 12 13namespace { 14 15void PostResultToUIThread(StorageInfo::Type type, 16 const IAppsFinderCallback& callback, 17 const std::string& unique_id) { 18 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); 19 20 std::string device_id; 21 if (!unique_id.empty()) 22 device_id = StorageInfo::MakeDeviceId(type, unique_id); 23 24 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, 25 base::Bind(callback, unique_id)); 26} 27 28} // namespace 29 30void FindIAppsOnFileThread(StorageInfo::Type type, const IAppsFinderTask& task, 31 const IAppsFinderCallback& callback) { 32 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 33 DCHECK(!task.is_null()); 34 DCHECK(!callback.is_null()); 35 36 content::BrowserThread::PostTask( 37 content::BrowserThread::FILE, 38 FROM_HERE, 39 base::Bind(task, base::Bind(PostResultToUIThread, type, callback))); 40} 41 42// iPhoto is only supported on OSX. 43#if !defined(OS_MACOSX) 44void FindIPhotoLibrary(const IAppsFinderCallback& callback) { 45 callback.Run(std::string()); 46} 47#endif // !defined(OS_MACOSX) 48 49// iTunes is only support on OSX and Windows. 50#if !defined(OS_MACOSX) && !defined(OS_WIN) 51void FindITunesLibrary(const IAppsFinderCallback& callback) { 52 callback.Run(std::string()); 53} 54#endif 55 56} // namespace iapps 57