Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 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 #ifndef CHROME_BROWSER_CHROMEOS_ARC_ARC_DOWNLOADS_WATCHER_SERVICE_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_ARC_ARC_DOWNLOADS_WATCHER_SERVICE_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/macros.h" | |
| 12 #include "base/memory/weak_ptr.h" | |
| 13 #include "components/arc/arc_bridge_service.h" | |
| 14 #include "components/arc/arc_service.h" | |
| 15 | |
| 16 namespace base { | |
| 17 | |
| 18 class FilePath; | |
| 19 | |
| 20 } // namespace base | |
| 21 | |
| 22 namespace arc { | |
| 23 | |
| 24 // Watches Downloads directory and registers newly created media files to | |
| 25 // Android MediaProvider. | |
| 26 class ArcDownloadsWatcherService : public ArcService, | |
| 27 public ArcBridgeService::Observer { | |
| 28 public: | |
| 29 explicit ArcDownloadsWatcherService(ArcBridgeService* bridge_service); | |
| 30 ~ArcDownloadsWatcherService() override; | |
| 31 | |
| 32 // ArcBridgeService::Observer | |
| 33 void OnFileSystemInstanceReady() override; | |
| 34 void OnFileSystemInstanceClosed() override; | |
| 35 | |
| 36 private: | |
| 37 class DownloadsWatcher; | |
| 38 | |
| 39 void StartWatchDownloads(); | |
|
Luis Héctor Chávez
2016/05/20 15:18:59
nit: StartWatchingDownloads() or StartDownloadsWat
Shuhei Takahashi
2016/05/24 08:46:34
Done.
| |
| 40 void StopWatchDownloads(); | |
| 41 | |
| 42 void OnDownloadsChanged(const std::vector<base::FilePath>& paths); | |
| 43 | |
| 44 std::unique_ptr<DownloadsWatcher> watcher_; | |
| 45 | |
| 46 // Note: This should remain the last member so it'll be destroyed and | |
| 47 // invalidate the weak pointers before any other members are destroyed. | |
| 48 base::WeakPtrFactory<ArcDownloadsWatcherService> weak_ptr_factory_; | |
| 49 | |
| 50 DISALLOW_COPY_AND_ASSIGN(ArcDownloadsWatcherService); | |
| 51 }; | |
| 52 | |
| 53 } // namespace arc | |
| 54 | |
| 55 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_DOWNLOADS_WATCHER_SERVICE_H_ | |
| OLD | NEW |