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 } | |
46 | 44 |
47 bool IAppsDataProvider::valid() const { | 45 bool IAppsDataProvider::valid() const { |
48 return is_valid_; | 46 return is_valid_; |
49 } | 47 } |
50 | 48 |
51 void IAppsDataProvider::set_valid(bool valid) { | 49 void IAppsDataProvider::set_valid(bool valid) { |
52 is_valid_ = valid; | 50 is_valid_ = valid; |
53 } | 51 } |
54 | 52 |
55 void IAppsDataProvider::RefreshData(const ReadyCallback& ready_callback) { | 53 void IAppsDataProvider::RefreshData(const ReadyCallback& ready_callback) { |
(...skipping 21 matching lines...) Expand all Loading... |
77 void IAppsDataProvider::OnLibraryChanged(const base::FilePath& path, | 75 void IAppsDataProvider::OnLibraryChanged(const base::FilePath& path, |
78 bool error) { | 76 bool error) { |
79 MediaFileSystemBackend::AssertCurrentlyOnMediaSequence(); | 77 MediaFileSystemBackend::AssertCurrentlyOnMediaSequence(); |
80 DCHECK_EQ(library_path_.value(), path.value()); | 78 DCHECK_EQ(library_path_.value(), path.value()); |
81 if (error) | 79 if (error) |
82 LOG(ERROR) << "Error watching " << library_path_.value(); | 80 LOG(ERROR) << "Error watching " << library_path_.value(); |
83 needs_refresh_ = true; | 81 needs_refresh_ = true; |
84 } | 82 } |
85 | 83 |
86 } // namespace iapps | 84 } // namespace iapps |
OLD | NEW |