| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/itunes_finder_win.h" | 5 #include "chrome/browser/media_galleries/fileapi/itunes_finder_win.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/base_paths_win.h" | 9 #include "base/base_paths_win.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 // Try to read the iTunes preferences file from the default location and return | 22 // Try to read the iTunes preferences file from the default location and return |
| 23 // its contents if found. | 23 // its contents if found. |
| 24 std::string GetPrefFileData() { | 24 std::string GetPrefFileData() { |
| 25 std::string xml_pref_data; | 25 std::string xml_pref_data; |
| 26 | 26 |
| 27 base::FilePath appdata_dir; | 27 base::FilePath appdata_dir; |
| 28 if (PathService::Get(base::DIR_APP_DATA, &appdata_dir)) { | 28 if (PathService::Get(base::DIR_APP_DATA, &appdata_dir)) { |
| 29 base::FilePath pref_file = appdata_dir.AppendASCII("Apple Computer") | 29 base::FilePath pref_file = appdata_dir.AppendASCII("Apple Computer") |
| 30 .AppendASCII("iTunes") | 30 .AppendASCII("iTunes") |
| 31 .AppendASCII("iTunesPrefs.xml"); | 31 .AppendASCII("iTunesPrefs.xml"); |
| 32 file_util::ReadFileToString(pref_file, &xml_pref_data); | 32 base::ReadFileToString(pref_file, &xml_pref_data); |
| 33 } | 33 } |
| 34 return xml_pref_data; | 34 return xml_pref_data; |
| 35 } | 35 } |
| 36 | 36 |
| 37 } // namespace | 37 } // namespace |
| 38 | 38 |
| 39 ITunesFinderWin::ITunesFinderWin(const ITunesFinderCallback& callback) | 39 ITunesFinderWin::ITunesFinderWin(const ITunesFinderCallback& callback) |
| 40 : ITunesFinder(callback) { | 40 : ITunesFinder(callback) { |
| 41 } | 41 } |
| 42 | 42 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); | 82 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); |
| 83 | 83 |
| 84 if (library_file.empty() || !base::PathExists(library_file)) { | 84 if (library_file.empty() || !base::PathExists(library_file)) { |
| 85 TryDefaultLocation(); | 85 TryDefaultLocation(); |
| 86 return; | 86 return; |
| 87 } | 87 } |
| 88 PostResultToUIThread(library_file.AsUTF8Unsafe()); | 88 PostResultToUIThread(library_file.AsUTF8Unsafe()); |
| 89 } | 89 } |
| 90 | 90 |
| 91 } // namespace itunes | 91 } // namespace itunes |
| OLD | NEW |