Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(273)

Side by Side Diff: chrome/browser/media_galleries/fileapi/itunes_data_provider.cc

Issue 23727009: Cleanup: Remove chrome namespace for storage monitor and media galleries. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nit Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/itunes_data_provider.h" 5 #include "chrome/browser/media_galleries/fileapi/itunes_data_provider.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/format_macros.h" 11 #include "base/format_macros.h"
12 #include "base/location.h" 12 #include "base/location.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/platform_file.h" 14 #include "base/platform_file.h"
15 #include "base/stl_util.h" 15 #include "base/stl_util.h"
16 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
17 #include "base/strings/stringprintf.h" 17 #include "base/strings/stringprintf.h"
18 #include "base/threading/thread_restrictions.h" 18 #include "base/threading/thread_restrictions.h"
19 #include "chrome/browser/media_galleries/fileapi/file_path_watcher_util.h" 19 #include "chrome/browser/media_galleries/fileapi/file_path_watcher_util.h"
20 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" 20 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h"
21 #include "chrome/browser/media_galleries/imported_media_gallery_registry.h" 21 #include "chrome/browser/media_galleries/imported_media_gallery_registry.h"
22 #include "chrome/common/media_galleries/itunes_library.h" 22 #include "chrome/common/media_galleries/itunes_library.h"
23 #include "content/public/browser/browser_thread.h" 23 #include "content/public/browser/browser_thread.h"
24 #include "third_party/icu/source/common/unicode/locid.h" 24 #include "third_party/icu/source/common/unicode/locid.h"
25 #include "webkit/browser/fileapi/native_file_util.h" 25 #include "webkit/browser/fileapi/native_file_util.h"
26 26
27 using chrome::MediaFileSystemBackend;
28
29 namespace itunes { 27 namespace itunes {
30 28
31 namespace { 29 namespace {
32 30
33 // Colon and slash are not allowed in filenames, replace them with underscore. 31 // Colon and slash are not allowed in filenames, replace them with underscore.
34 std::string EscapeBadCharacters(const std::string& input) { 32 std::string EscapeBadCharacters(const std::string& input) {
35 std::string result; 33 std::string result;
36 ReplaceChars(input, ":/", "_", &result); 34 ReplaceChars(input, ":/", "_", &result);
37 return result; 35 return result;
38 } 36 }
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 179
182 ITunesDataProvider::ITunesDataProvider(const base::FilePath& library_path) 180 ITunesDataProvider::ITunesDataProvider(const base::FilePath& library_path)
183 : library_path_(library_path), 181 : library_path_(library_path),
184 auto_add_path_(GetAutoAddPath(library_path)), 182 auto_add_path_(GetAutoAddPath(library_path)),
185 needs_refresh_(true), 183 needs_refresh_(true),
186 is_valid_(false), 184 is_valid_(false),
187 weak_factory_(this) { 185 weak_factory_(this) {
188 DCHECK(MediaFileSystemBackend::CurrentlyOnMediaTaskRunnerThread()); 186 DCHECK(MediaFileSystemBackend::CurrentlyOnMediaTaskRunnerThread());
189 DCHECK(!library_path_.empty()); 187 DCHECK(!library_path_.empty());
190 188
191 chrome::StartFilePathWatchOnMediaTaskRunner( 189 StartFilePathWatchOnMediaTaskRunner(
192 library_path_, 190 library_path_,
193 base::Bind(&ITunesDataProvider::OnLibraryWatchStarted, 191 base::Bind(&ITunesDataProvider::OnLibraryWatchStarted,
194 weak_factory_.GetWeakPtr()), 192 weak_factory_.GetWeakPtr()),
195 base::Bind(&ITunesDataProvider::OnLibraryChanged, 193 base::Bind(&ITunesDataProvider::OnLibraryChanged,
196 weak_factory_.GetWeakPtr())); 194 weak_factory_.GetWeakPtr()));
197 } 195 }
198 196
199 ITunesDataProvider::~ITunesDataProvider() {} 197 ITunesDataProvider::~ITunesDataProvider() {}
200 198
201 // TODO(vandebo): add a file watch that resets |needs_refresh_| when the 199 // TODO(vandebo): add a file watch that resets |needs_refresh_| when the
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 std::string album_name = EscapeBadCharacters(album_it->first); 332 std::string album_name = EscapeBadCharacters(album_it->first);
335 library_[artist_name][album_name] = 333 library_[artist_name][album_name] =
336 MakeUniqueTrackNames(album_it->second); 334 MakeUniqueTrackNames(album_it->second);
337 } 335 }
338 } 336 }
339 } 337 }
340 ready_callback.Run(is_valid_); 338 ready_callback.Run(is_valid_);
341 } 339 }
342 340
343 } // namespace itunes 341 } // namespace itunes
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698