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

Side by Side Diff: components/arc/arc_service_manager.h

Issue 2580303002: mediaview: Mount ARC documents provider file system volumes. (Closed)
Patch Set: Rebased. Created 3 years, 11 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 COMPONENTS_ARC_ARC_SERVICE_MANAGER_H_ 5 #ifndef COMPONENTS_ARC_ARC_SERVICE_MANAGER_H_
6 #define COMPONENTS_ARC_ARC_SERVICE_MANAGER_H_ 6 #define COMPONENTS_ARC_ARC_SERVICE_MANAGER_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/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/observer_list.h" 13 #include "base/observer_list.h"
14 #include "base/task_runner.h" 14 #include "base/task_runner.h"
15 #include "base/threading/thread_checker.h" 15 #include "base/threading/thread_checker.h"
16 #include "components/arc/intent_helper/activity_icon_loader.h" 16 #include "components/arc/intent_helper/activity_icon_loader.h"
17 #include "components/arc/intent_helper/local_activity_resolver.h" 17 #include "components/arc/intent_helper/local_activity_resolver.h"
18 18
19 namespace arc { 19 namespace arc {
20 20
21 class ArcBridgeService; 21 class ArcBridgeService;
22 class ArcFileSystemObserver;
22 class ArcIntentHelperObserver; 23 class ArcIntentHelperObserver;
23 class ArcService; 24 class ArcService;
24 25
25 // Manages creation and destruction of services that communicate with the ARC 26 // Manages creation and destruction of services that communicate with the ARC
26 // instance via the ArcBridgeService. 27 // instance via the ArcBridgeService.
27 class ArcServiceManager { 28 class ArcServiceManager {
28 public: 29 public:
29 class Observer { 30 class Observer {
30 public: 31 public:
31 // Called when ArcServiceManager is being shut down. Observer 32 // Called when ArcServiceManager is being shut down. Observer
32 // implementation should clean up ARC related stuff here. One of the 33 // implementation should clean up ARC related stuff here. One of the
33 // typical use cases is calling ArcServiceManager::RemoveObserver(). 34 // typical use cases is calling ArcServiceManager::RemoveObserver().
34 virtual void OnArcShutdown() = 0; 35 virtual void OnArcShutdown() {}
35 36
36 // Called when intent filters are added or removed. 37 // Called when intent filters are added or removed.
37 virtual void OnIntentFiltersUpdated() = 0; 38 virtual void OnIntentFiltersUpdated() {}
39
40 // Called when ARC filesystems are ready.
41 virtual void OnFileSystemsReady() {}
38 42
39 protected: 43 protected:
40 virtual ~Observer() = default; 44 virtual ~Observer() = default;
41 }; 45 };
42 46
43 explicit ArcServiceManager( 47 explicit ArcServiceManager(
44 scoped_refptr<base::TaskRunner> blocking_task_runner); 48 scoped_refptr<base::TaskRunner> blocking_task_runner);
45 ~ArcServiceManager(); 49 ~ArcServiceManager();
46 50
47 // |arc_bridge_service| can only be accessed on the thread that this 51 // |arc_bridge_service| can only be accessed on the thread that this
(...skipping 18 matching lines...) Expand all
66 } 70 }
67 71
68 // Returns the icon loader owned by ArcServiceManager and shared by services. 72 // Returns the icon loader owned by ArcServiceManager and shared by services.
69 scoped_refptr<ActivityIconLoader> icon_loader() { return icon_loader_; } 73 scoped_refptr<ActivityIconLoader> icon_loader() { return icon_loader_; }
70 74
71 // Returns the activity resolver owned by ArcServiceManager. 75 // Returns the activity resolver owned by ArcServiceManager.
72 scoped_refptr<LocalActivityResolver> activity_resolver() { 76 scoped_refptr<LocalActivityResolver> activity_resolver() {
73 return activity_resolver_; 77 return activity_resolver_;
74 } 78 }
75 79
76 // Returns the IntentHelperObserver instance owned by ArcServiceManager. 80 // Returns the ArcIntentHelperObserver instance owned by ArcServiceManager.
77 ArcIntentHelperObserver* intent_helper_observer() { 81 ArcIntentHelperObserver* intent_helper_observer() {
78 return intent_helper_observer_.get(); 82 return intent_helper_observer_.get();
79 } 83 }
80 84
85 // Returns the ArcFileSystemObserver instance owned by ArcServiceManager.
86 ArcFileSystemObserver* file_system_observer() {
87 return file_system_observer_.get();
88 }
89
81 private: 90 private:
91 class FileSystemObserverImpl; // implemented in arc_service_manager.cc.
82 class IntentHelperObserverImpl; // implemented in arc_service_manager.cc. 92 class IntentHelperObserverImpl; // implemented in arc_service_manager.cc.
83 93
84 base::ThreadChecker thread_checker_; 94 base::ThreadChecker thread_checker_;
85 scoped_refptr<base::TaskRunner> blocking_task_runner_; 95 scoped_refptr<base::TaskRunner> blocking_task_runner_;
86 96
87 // An object for observing the ArcIntentHelper instance in |services_|. 97 // An object for observing the ArcIntentHelper instance in |services_|.
88 std::unique_ptr<ArcIntentHelperObserver> intent_helper_observer_; 98 std::unique_ptr<ArcIntentHelperObserver> intent_helper_observer_;
89 99
100 // An object for observing the ArcFileSystemService instance in |services_|.
101 std::unique_ptr<ArcFileSystemObserver> file_system_observer_;
102
90 std::unique_ptr<ArcBridgeService> arc_bridge_service_; 103 std::unique_ptr<ArcBridgeService> arc_bridge_service_;
91 std::vector<std::unique_ptr<ArcService>> services_; 104 std::vector<std::unique_ptr<ArcService>> services_;
92 scoped_refptr<ActivityIconLoader> icon_loader_; 105 scoped_refptr<ActivityIconLoader> icon_loader_;
93 scoped_refptr<LocalActivityResolver> activity_resolver_; 106 scoped_refptr<LocalActivityResolver> activity_resolver_;
94 107
95 base::ObserverList<Observer> observer_list_; 108 base::ObserverList<Observer> observer_list_;
96 109
97 DISALLOW_COPY_AND_ASSIGN(ArcServiceManager); 110 DISALLOW_COPY_AND_ASSIGN(ArcServiceManager);
98 }; 111 };
99 112
100 } // namespace arc 113 } // namespace arc
101 114
102 #endif // COMPONENTS_ARC_ARC_SERVICE_MANAGER_H_ 115 #endif // COMPONENTS_ARC_ARC_SERVICE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698