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/iapps_data_provider.h" | 5 #include "chrome/browser/media_galleries/fileapi/iapps_data_provider.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 DCHECK(!library_path_.empty()); | 33 DCHECK(!library_path_.empty()); |
34 | 34 |
35 StartFilePathWatchOnMediaTaskRunner( | 35 StartFilePathWatchOnMediaTaskRunner( |
36 library_path_, | 36 library_path_, |
37 base::Bind(&IAppsDataProvider::OnLibraryWatchStarted, | 37 base::Bind(&IAppsDataProvider::OnLibraryWatchStarted, |
38 weak_factory_.GetWeakPtr()), | 38 weak_factory_.GetWeakPtr()), |
39 base::Bind(&IAppsDataProvider::OnLibraryChanged, | 39 base::Bind(&IAppsDataProvider::OnLibraryChanged, |
40 weak_factory_.GetWeakPtr())); | 40 weak_factory_.GetWeakPtr())); |
41 } | 41 } |
42 | 42 |
43 IAppsDataProvider::~IAppsDataProvider() {} | 43 IAppsDataProvider::~IAppsDataProvider() { |
| 44 StopFilePathWatchOnMediaTaskRunner(std::move(library_watcher_)); |
| 45 } |
44 | 46 |
45 bool IAppsDataProvider::valid() const { | 47 bool IAppsDataProvider::valid() const { |
46 return is_valid_; | 48 return is_valid_; |
47 } | 49 } |
48 | 50 |
49 void IAppsDataProvider::set_valid(bool valid) { | 51 void IAppsDataProvider::set_valid(bool valid) { |
50 is_valid_ = valid; | 52 is_valid_ = valid; |
51 } | 53 } |
52 | 54 |
53 void IAppsDataProvider::RefreshData(const ReadyCallback& ready_callback) { | 55 void IAppsDataProvider::RefreshData(const ReadyCallback& ready_callback) { |
(...skipping 21 matching lines...) Expand all Loading... |
75 void IAppsDataProvider::OnLibraryChanged(const base::FilePath& path, | 77 void IAppsDataProvider::OnLibraryChanged(const base::FilePath& path, |
76 bool error) { | 78 bool error) { |
77 MediaFileSystemBackend::AssertCurrentlyOnMediaSequence(); | 79 MediaFileSystemBackend::AssertCurrentlyOnMediaSequence(); |
78 DCHECK_EQ(library_path_.value(), path.value()); | 80 DCHECK_EQ(library_path_.value(), path.value()); |
79 if (error) | 81 if (error) |
80 LOG(ERROR) << "Error watching " << library_path_.value(); | 82 LOG(ERROR) << "Error watching " << library_path_.value(); |
81 needs_refresh_ = true; | 83 needs_refresh_ = true; |
82 } | 84 } |
83 | 85 |
84 } // namespace iapps | 86 } // namespace iapps |
OLD | NEW |