| OLD | NEW |
| 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/task_runner.h" | 13 #include "base/task_runner.h" |
| 14 #include "base/threading/thread_checker.h" | 14 #include "base/threading/thread_checker.h" |
| 15 #include "components/arc/intent_helper/activity_icon_loader.h" | 15 #include "components/arc/intent_helper/activity_icon_loader.h" |
| 16 #include "components/prefs/pref_member.h" |
| 16 #include "components/signin/core/account_id/account_id.h" | 17 #include "components/signin/core/account_id/account_id.h" |
| 17 | 18 |
| 18 namespace arc { | 19 namespace arc { |
| 19 | 20 |
| 20 class ArcBridgeService; | 21 class ArcBridgeService; |
| 21 class ArcService; | 22 class ArcService; |
| 22 | 23 |
| 23 // Manages creation and destruction of services that communicate with the ARC | 24 // Manages creation and destruction of services that communicate with the ARC |
| 24 // instance via the ArcBridgeService. | 25 // instance via the ArcBridgeService. |
| 25 class ArcServiceManager { | 26 class ArcServiceManager { |
| 26 public: | 27 public: |
| 27 explicit ArcServiceManager( | 28 explicit ArcServiceManager( |
| 28 scoped_refptr<base::TaskRunner> blocking_task_runner); | 29 scoped_refptr<base::TaskRunner> blocking_task_runner); |
| 29 virtual ~ArcServiceManager(); | 30 virtual ~ArcServiceManager(); |
| 30 | 31 |
| 31 // |arc_bridge_service| can only be accessed on the thread that this | 32 // |arc_bridge_service| can only be accessed on the thread that this |
| 32 // class was created on. | 33 // class was created on. |
| 33 ArcBridgeService* arc_bridge_service(); | 34 ArcBridgeService* arc_bridge_service(); |
| 34 | 35 |
| 35 // Adds a service to the managed services list. | 36 // Adds a service to the managed services list. |
| 36 void AddService(std::unique_ptr<ArcService> service); | 37 void AddService(std::unique_ptr<ArcService> service); |
| 37 | 38 |
| 38 // Gets the global instance of the ARC Service Manager. This can only be | 39 // Gets the global instance of the ARC Service Manager. This can only be |
| 39 // called on the thread that this class was created on. | 40 // called on the thread that this class was created on. |
| 40 static ArcServiceManager* Get(); | 41 static ArcServiceManager* Get(); |
| 41 | 42 |
| 42 // Called when the main profile is initialized after user logs in. | 43 // Called when the main profile is initialized after user logs in. |
| 43 void OnPrimaryUserProfilePrepared(const AccountId& account_id); | 44 void OnPrimaryUserProfilePrepared( |
| 45 const AccountId& account_id, |
| 46 std::unique_ptr<BooleanPrefMember> arc_enabled_pref); |
| 44 | 47 |
| 45 // Called once the windowing system (ash) has been started. | 48 // Called once the windowing system (ash) has been started. |
| 46 void OnAshStarted(); | 49 void OnAshStarted(); |
| 47 | 50 |
| 48 // Called to shut down all ARC services. | 51 // Called to shut down all ARC services. |
| 49 void Shutdown(); | 52 void Shutdown(); |
| 50 | 53 |
| 51 scoped_refptr<base::TaskRunner> blocking_task_runner() const { | 54 scoped_refptr<base::TaskRunner> blocking_task_runner() const { |
| 52 return blocking_task_runner_; | 55 return blocking_task_runner_; |
| 53 } | 56 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 71 // True once the window manager service got added, barring adding any more | 74 // True once the window manager service got added, barring adding any more |
| 72 // of those since OnAshStarted() might be called multiple times. | 75 // of those since OnAshStarted() might be called multiple times. |
| 73 bool on_ash_started_called_ = false; | 76 bool on_ash_started_called_ = false; |
| 74 | 77 |
| 75 DISALLOW_COPY_AND_ASSIGN(ArcServiceManager); | 78 DISALLOW_COPY_AND_ASSIGN(ArcServiceManager); |
| 76 }; | 79 }; |
| 77 | 80 |
| 78 } // namespace arc | 81 } // namespace arc |
| 79 | 82 |
| 80 #endif // COMPONENTS_ARC_ARC_SERVICE_MANAGER_H_ | 83 #endif // COMPONENTS_ARC_ARC_SERVICE_MANAGER_H_ |
| OLD | NEW |