OLD | NEW |
---|---|
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 COMPONENTS_ARC_INTENT_HELPER_ARC_INTENT_HELPER_BRIDGE_H_ | 5 #ifndef COMPONENTS_ARC_INTENT_HELPER_ARC_INTENT_HELPER_BRIDGE_H_ |
6 #define COMPONENTS_ARC_INTENT_HELPER_ARC_INTENT_HELPER_BRIDGE_H_ | 6 #define COMPONENTS_ARC_INTENT_HELPER_ARC_INTENT_HELPER_BRIDGE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "ash/link_handler_model_factory.h" | 11 #include "ash/link_handler_model_factory.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/observer_list.h" | |
14 #include "base/threading/thread_checker.h" | 15 #include "base/threading/thread_checker.h" |
15 #include "components/arc/arc_service.h" | 16 #include "components/arc/arc_service.h" |
16 #include "components/arc/common/intent_helper.mojom.h" | 17 #include "components/arc/common/intent_helper.mojom.h" |
17 #include "components/arc/instance_holder.h" | 18 #include "components/arc/instance_holder.h" |
18 #include "mojo/public/cpp/bindings/binding.h" | 19 #include "mojo/public/cpp/bindings/binding.h" |
19 | 20 |
20 namespace ash { | 21 namespace ash { |
21 | 22 |
22 class LinkHandlerModel; | 23 class LinkHandlerModel; |
23 | 24 |
(...skipping 15 matching lines...) Expand all Loading... | |
39 public: | 40 public: |
40 enum class GetResult { | 41 enum class GetResult { |
41 // Failed. The intent_helper instance is not yet ready. This is a temporary | 42 // Failed. The intent_helper instance is not yet ready. This is a temporary |
42 // error. | 43 // error. |
43 FAILED_ARC_NOT_READY, | 44 FAILED_ARC_NOT_READY, |
44 // Failed. Either ARC is not supported at all or intent_helper instance | 45 // Failed. Either ARC is not supported at all or intent_helper instance |
45 // version is too old. | 46 // version is too old. |
46 FAILED_ARC_NOT_SUPPORTED, | 47 FAILED_ARC_NOT_SUPPORTED, |
47 }; | 48 }; |
48 | 49 |
50 class Observer { | |
51 public: | |
52 virtual void OnAppsUpdated() = 0; | |
hidehiko
2016/11/17 07:34:19
Document please.
oka
2016/11/21 07:02:15
Done.
| |
53 }; | |
Yusuke Sato
2016/11/17 02:29:54
Don't we need
protected:
virtual ~Observer() {
oka
2016/11/21 07:02:15
Done.
| |
54 | |
49 ArcIntentHelperBridge( | 55 ArcIntentHelperBridge( |
50 ArcBridgeService* bridge_service, | 56 ArcBridgeService* bridge_service, |
51 const scoped_refptr<ActivityIconLoader>& icon_loader, | 57 const scoped_refptr<ActivityIconLoader>& icon_loader, |
52 const scoped_refptr<LocalActivityResolver>& activity_resolver); | 58 const scoped_refptr<LocalActivityResolver>& activity_resolver); |
53 ~ArcIntentHelperBridge() override; | 59 ~ArcIntentHelperBridge() override; |
54 | 60 |
61 static ArcIntentHelperBridge* Get(); | |
hidehiko
2016/11/17 07:34:19
It's better to note this is something workaround,
oka
2016/11/21 07:02:15
Done.
| |
62 | |
63 void AddObserver(Observer* observer); | |
64 | |
55 // InstanceHolder<mojom::IntentHelperInstance>::Observer | 65 // InstanceHolder<mojom::IntentHelperInstance>::Observer |
56 void OnInstanceReady() override; | 66 void OnInstanceReady() override; |
57 void OnInstanceClosed() override; | 67 void OnInstanceClosed() override; |
58 | 68 |
59 // mojom::IntentHelperHost | 69 // mojom::IntentHelperHost |
60 void OnIconInvalidated(const mojo::String& package_name) override; | 70 void OnIconInvalidated(const mojo::String& package_name) override; |
61 void OnIntentFiltersUpdated( | 71 void OnIntentFiltersUpdated( |
62 mojo::Array<mojom::IntentFilterPtr> intent_filters) override; | 72 mojo::Array<mojom::IntentFilterPtr> intent_filters) override; |
63 void OnOpenDownloads() override; | 73 void OnOpenDownloads() override; |
64 void OnOpenUrl(const mojo::String& url) override; | 74 void OnOpenUrl(const mojo::String& url) override; |
(...skipping 25 matching lines...) Expand all Loading... | |
90 | 100 |
91 static const char kArcIntentHelperPackageName[]; | 101 static const char kArcIntentHelperPackageName[]; |
92 | 102 |
93 private: | 103 private: |
94 mojo::Binding<mojom::IntentHelperHost> binding_; | 104 mojo::Binding<mojom::IntentHelperHost> binding_; |
95 scoped_refptr<ActivityIconLoader> icon_loader_; | 105 scoped_refptr<ActivityIconLoader> icon_loader_; |
96 scoped_refptr<LocalActivityResolver> activity_resolver_; | 106 scoped_refptr<LocalActivityResolver> activity_resolver_; |
97 | 107 |
98 base::ThreadChecker thread_checker_; | 108 base::ThreadChecker thread_checker_; |
99 | 109 |
110 base::ObserverList<Observer> observer_list_; | |
111 | |
100 DISALLOW_COPY_AND_ASSIGN(ArcIntentHelperBridge); | 112 DISALLOW_COPY_AND_ASSIGN(ArcIntentHelperBridge); |
101 }; | 113 }; |
102 | 114 |
103 } // namespace arc | 115 } // namespace arc |
104 | 116 |
105 #endif // COMPONENTS_ARC_INTENT_HELPER_ARC_INTENT_HELPER_BRIDGE_H_ | 117 #endif // COMPONENTS_ARC_INTENT_HELPER_ARC_INTENT_HELPER_BRIDGE_H_ |
OLD | NEW |