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

Unified Diff: components/arc/arc_service_manager.cc

Issue 2538263005: Simplify ArcServiceManager by stop deriving it from ArcIntentHelperObserver (Closed)
Patch Set: Address comment Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/arc/arc_service_manager.h ('k') | components/arc/intent_helper/arc_intent_helper_observer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/arc/arc_service_manager.cc
diff --git a/components/arc/arc_service_manager.cc b/components/arc/arc_service_manager.cc
index fd92b9d567a94e46c49fae1ff9dcaeb40dc4d46c..6a7bcfae5a60231693c597688c4dce4afa4d10e9 100644
--- a/components/arc/arc_service_manager.cc
+++ b/components/arc/arc_service_manager.cc
@@ -6,11 +6,13 @@
#include <utility>
+#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/sequenced_task_runner.h"
#include "base/threading/thread_task_runner_handle.h"
#include "components/arc/arc_bridge_service.h"
#include "components/arc/arc_bridge_service_impl.h"
+#include "components/arc/intent_helper/arc_intent_helper_observer.h"
namespace arc {
@@ -24,9 +26,33 @@ ArcBridgeService* g_arc_bridge_service_for_testing = nullptr;
} // namespace
+class ArcServiceManager::IntentHelperObserverImpl
+ : public ArcIntentHelperObserver {
+ public:
+ explicit IntentHelperObserverImpl(ArcServiceManager* manager);
+ ~IntentHelperObserverImpl() override = default;
+
+ private:
+ void OnAppsUpdated() override;
+ ArcServiceManager* const manager_;
+
+ DISALLOW_COPY_AND_ASSIGN(IntentHelperObserverImpl);
+};
+
+ArcServiceManager::IntentHelperObserverImpl::IntentHelperObserverImpl(
+ ArcServiceManager* manager)
+ : manager_(manager) {}
+
+void ArcServiceManager::IntentHelperObserverImpl::OnAppsUpdated() {
+ DCHECK(manager_->thread_checker_.CalledOnValidThread());
+ for (auto& observer : manager_->observer_list_)
+ observer.OnAppsUpdated();
+}
+
ArcServiceManager::ArcServiceManager(
scoped_refptr<base::TaskRunner> blocking_task_runner)
: blocking_task_runner_(blocking_task_runner),
+ intent_helper_observer_(base::MakeUnique<IntentHelperObserverImpl>(this)),
icon_loader_(new ActivityIconLoader()),
activity_resolver_(new LocalActivityResolver()) {
DCHECK(!g_arc_service_manager);
@@ -85,12 +111,6 @@ void ArcServiceManager::RemoveObserver(Observer* observer) {
observer_list_.RemoveObserver(observer);
}
-void ArcServiceManager::OnAppsUpdated() {
- DCHECK(thread_checker_.CalledOnValidThread());
- for (auto& observer : observer_list_)
- observer.OnAppsUpdated();
-}
-
void ArcServiceManager::Shutdown() {
DCHECK(thread_checker_.CalledOnValidThread());
icon_loader_ = nullptr;
« no previous file with comments | « components/arc/arc_service_manager.h ('k') | components/arc/intent_helper/arc_intent_helper_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698