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 UI_APP_LIST_PRESENTER_APP_LIST_H_ | 5 #ifndef UI_APP_LIST_PRESENTER_APP_LIST_H_ |
6 #define UI_APP_LIST_PRESENTER_APP_LIST_H_ | 6 #define UI_APP_LIST_PRESENTER_APP_LIST_H_ |
7 | 7 |
8 #include "mojo/public/cpp/bindings/binding_set.h" | 8 #include "mojo/public/cpp/bindings/binding_set.h" |
9 #include "ui/app_list/presenter/app_list_presenter.mojom.h" | 9 #include "ui/app_list/presenter/app_list_presenter.mojom.h" |
10 #include "ui/app_list/presenter/app_list_presenter_export.h" | 10 #include "ui/app_list/presenter/app_list_presenter_export.h" |
11 | 11 |
12 namespace app_list { | 12 namespace app_list { |
13 | 13 |
14 // Stores the app list presenter interface pointer. | 14 // Stores the app list presenter interface pointer. |
15 class APP_LIST_PRESENTER_EXPORT AppList : public mojom::AppList { | 15 class APP_LIST_PRESENTER_EXPORT AppList : public mojom::AppList { |
16 public: | 16 public: |
17 AppList(); | 17 AppList(); |
18 ~AppList() override; | 18 ~AppList() override; |
19 | 19 |
20 // Binds the mojom::AppList interface request to this object. | 20 // Binds the mojom::AppList interface request to this object. |
21 void BindRequest(mojom::AppListRequest request); | 21 void BindRequest(mojom::AppListRequest request); |
22 | 22 |
23 // Get a raw pointer to the mojom::AppListPresenter interface; may be null. | 23 // Get a raw pointer to the mojom::AppListPresenter interface; may be null. |
24 mojom::AppListPresenter* GetAppListPresenter(); | 24 mojom::AppListPresenter* GetAppListPresenter(); |
25 | 25 |
| 26 // Helper functions to call the underlying functionality on the presenter. |
| 27 void Show(int64_t display_id); |
| 28 void Dismiss(); |
| 29 void ToggleAppList(int64_t display_id); |
| 30 |
| 31 // Helper functions to get the cached state as reported by the presenter. |
| 32 bool IsVisible() const; |
| 33 bool GetTargetVisibility() const; |
| 34 |
26 // mojom::AppList: | 35 // mojom::AppList: |
27 void SetAppListPresenter(mojom::AppListPresenterPtr presenter) override; | 36 void SetAppListPresenter(mojom::AppListPresenterPtr presenter) override; |
| 37 void OnTargetVisibilityChanged(bool visible) override; |
| 38 void OnVisibilityChanged(bool visible) override; |
28 | 39 |
29 private: | 40 private: |
30 // Bindings for the mojom::AppList interface. | 41 // Bindings for the mojom::AppList interface. |
31 mojo::BindingSet<mojom::AppList> bindings_; | 42 mojo::BindingSet<mojom::AppList> bindings_; |
32 | 43 |
33 // App list presenter interface in chrome; used to show/hide the app list. | 44 // App list presenter interface in chrome; used to show/hide the app list. |
34 mojom::AppListPresenterPtr presenter_; | 45 mojom::AppListPresenterPtr presenter_; |
35 | 46 |
| 47 // The cached [target] visibility, as reported by the presenter. |
| 48 bool target_visible_ = false; |
| 49 bool visible_ = false; |
| 50 |
36 DISALLOW_COPY_AND_ASSIGN(AppList); | 51 DISALLOW_COPY_AND_ASSIGN(AppList); |
37 }; | 52 }; |
38 | 53 |
39 } // namespace app_list | 54 } // namespace app_list |
40 | 55 |
41 #endif // UI_APP_LIST_PRESENTER_APP_LIST_H_ | 56 #endif // UI_APP_LIST_PRESENTER_APP_LIST_H_ |
OLD | NEW |