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

Side by Side Diff: chrome/browser/chromeos/arc/arc_downloads_watcher_service.h

Issue 2190483003: arc: Revamp the ArcBridgeService interface (Closed) Base URL: https://chromium.googlesource.com/a/chromium/src.git@2785
Patch Set: One less diff line Created 4 years, 4 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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 #ifndef CHROME_BROWSER_CHROMEOS_ARC_ARC_DOWNLOADS_WATCHER_SERVICE_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_ARC_ARC_DOWNLOADS_WATCHER_SERVICE_H_
6 #define CHROME_BROWSER_CHROMEOS_ARC_ARC_DOWNLOADS_WATCHER_SERVICE_H_ 6 #define CHROME_BROWSER_CHROMEOS_ARC_ARC_DOWNLOADS_WATCHER_SERVICE_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "components/arc/arc_bridge_service.h" 13 #include "components/arc/arc_bridge_service.h"
14 #include "components/arc/arc_service.h" 14 #include "components/arc/arc_service.h"
15 #include "components/arc/instance_holder.h"
15 16
16 namespace base { 17 namespace base {
17 18
18 class FilePath; 19 class FilePath;
19 20
20 } // namespace base 21 } // namespace base
21 22
22 namespace arc { 23 namespace arc {
23 24
24 // Watches Downloads directory and registers newly created media files to 25 // Watches Downloads directory and registers newly created media files to
25 // Android MediaProvider. 26 // Android MediaProvider.
26 class ArcDownloadsWatcherService : public ArcService, 27 class ArcDownloadsWatcherService
27 public ArcBridgeService::Observer { 28 : public ArcService,
29 public InstanceHolder<mojom::FileSystemInstance>::Observer {
28 public: 30 public:
29 explicit ArcDownloadsWatcherService(ArcBridgeService* bridge_service); 31 explicit ArcDownloadsWatcherService(ArcBridgeService* bridge_service);
30 ~ArcDownloadsWatcherService() override; 32 ~ArcDownloadsWatcherService() override;
31 33
32 // ArcBridgeService::Observer 34 // InstanceHolder<mojom::FileSystemInstance>::Observer
33 void OnFileSystemInstanceReady() override; 35 void OnInstanceReady() override;
34 void OnFileSystemInstanceClosed() override; 36 void OnInstanceClosed() override;
35 37
36 private: 38 private:
37 class DownloadsWatcher; 39 class DownloadsWatcher;
38 40
39 void StartWatchingDownloads(); 41 void StartWatchingDownloads();
40 void StopWatchingDownloads(); 42 void StopWatchingDownloads();
41 43
42 void OnDownloadsChanged(const std::vector<base::FilePath>& paths); 44 void OnDownloadsChanged(const std::vector<base::FilePath>& paths);
43 45
44 std::unique_ptr<DownloadsWatcher> watcher_; 46 std::unique_ptr<DownloadsWatcher> watcher_;
45 47
46 // Note: This should remain the last member so it'll be destroyed and 48 // Note: This should remain the last member so it'll be destroyed and
47 // invalidate the weak pointers before any other members are destroyed. 49 // invalidate the weak pointers before any other members are destroyed.
48 base::WeakPtrFactory<ArcDownloadsWatcherService> weak_ptr_factory_; 50 base::WeakPtrFactory<ArcDownloadsWatcherService> weak_ptr_factory_;
49 51
50 DISALLOW_COPY_AND_ASSIGN(ArcDownloadsWatcherService); 52 DISALLOW_COPY_AND_ASSIGN(ArcDownloadsWatcherService);
51 }; 53 };
52 54
53 } // namespace arc 55 } // namespace arc
54 56
55 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_DOWNLOADS_WATCHER_SERVICE_H_ 57 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_DOWNLOADS_WATCHER_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/arc/arc_auth_service.cc ('k') | chrome/browser/chromeos/arc/arc_downloads_watcher_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698