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

Unified Diff: components/arc/intent_helper/arc_intent_helper_bridge.h

Issue 2487623002: Notify Files App when ARC++ app is installed/removed (Closed)
Patch Set: Add RemoverObserver. Created 4 years, 1 month 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
Index: components/arc/intent_helper/arc_intent_helper_bridge.h
diff --git a/components/arc/intent_helper/arc_intent_helper_bridge.h b/components/arc/intent_helper/arc_intent_helper_bridge.h
index c52eb9a809c27627f34814a78ed72ebf171b0e17..936f9985c379ef778e33aabdb83d289ec40c773d 100644
--- a/components/arc/intent_helper/arc_intent_helper_bridge.h
+++ b/components/arc/intent_helper/arc_intent_helper_bridge.h
@@ -11,6 +11,7 @@
#include "ash/link_handler_model_factory.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
+#include "base/observer_list.h"
#include "base/threading/thread_checker.h"
#include "components/arc/arc_service.h"
#include "components/arc/common/intent_helper.mojom.h"
@@ -46,12 +47,29 @@ class ArcIntentHelperBridge
FAILED_ARC_NOT_SUPPORTED,
};
+ class Observer {
+ public:
+ // OnAppsUpdated is called when intent helper is updated.
Yusuke Sato 2016/11/21 17:21:05 // Called when app's intent filter is updated. ?
oka 2016/11/24 15:14:17 Done.
+ virtual void OnAppsUpdated() = 0;
+ protected:
+ virtual ~Observer() {}
+ };
+
ArcIntentHelperBridge(
ArcBridgeService* bridge_service,
const scoped_refptr<ActivityIconLoader>& icon_loader,
const scoped_refptr<LocalActivityResolver>& activity_resolver);
~ArcIntentHelperBridge() override;
+ // Get returns the only instance of ArcIntentHelperBridge, or nullptr if it
+ // has not been created.
+ // This method is a workaround for adding observer to this class from
+ // Files App. Please avoid to use this as much as possible.
+ static ArcIntentHelperBridge* Get();
+
+ void AddObserver(Observer* observer);
+ void RemoveObserver(Observer* observer);
+
// InstanceHolder<mojom::IntentHelperInstance>::Observer
void OnInstanceReady() override;
void OnInstanceClosed() override;
@@ -97,6 +115,8 @@ class ArcIntentHelperBridge
base::ThreadChecker thread_checker_;
+ base::ObserverList<Observer> observer_list_;
+
DISALLOW_COPY_AND_ASSIGN(ArcIntentHelperBridge);
};

Powered by Google App Engine
This is Rietveld 408576698