Chromium Code Reviews| 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 class AppListDelegate; | |
| 15 | |
| 14 // Stores the app list presenter interface pointer. | 16 // Stores the app list presenter interface pointer. |
| 15 class APP_LIST_PRESENTER_EXPORT AppList : public mojom::AppList { | 17 class APP_LIST_PRESENTER_EXPORT AppList : public mojom::AppList { |
| 16 public: | 18 public: |
| 17 AppList(); | 19 AppList(); |
| 18 ~AppList() override; | 20 ~AppList() override; |
| 19 | 21 |
| 22 void set_delegate(AppListDelegate* delegate) { delegate_ = delegate; } | |
|
xiyuan
2017/01/20 17:20:49
nit: move accessor to the last of declarations sin
sky
2017/01/20 17:45:56
Done.
| |
| 23 | |
| 20 // Binds the mojom::AppList interface request to this object. | 24 // Binds the mojom::AppList interface request to this object. |
| 21 void BindRequest(mojom::AppListRequest request); | 25 void BindRequest(mojom::AppListRequest request); |
| 22 | 26 |
| 23 // Get a raw pointer to the mojom::AppListPresenter interface; may be null. | 27 // Get a raw pointer to the mojom::AppListPresenter interface; may be null. |
| 24 mojom::AppListPresenter* GetAppListPresenter(); | 28 mojom::AppListPresenter* GetAppListPresenter(); |
| 25 | 29 |
| 26 // Helper functions to call the underlying functionality on the presenter. | 30 // Helper functions to call the underlying functionality on the presenter. |
| 27 void Show(int64_t display_id); | 31 void Show(int64_t display_id); |
| 28 void Dismiss(); | 32 void Dismiss(); |
| 29 void ToggleAppList(int64_t display_id); | 33 void ToggleAppList(int64_t display_id); |
| 30 | 34 |
| 31 // Helper functions to get the cached state as reported by the presenter. | 35 // Helper functions to get the cached state as reported by the presenter. |
| 32 bool IsVisible() const; | 36 bool IsVisible() const; |
| 33 bool GetTargetVisibility() const; | 37 bool GetTargetVisibility() const; |
| 34 | 38 |
| 35 // mojom::AppList: | 39 // mojom::AppList: |
| 36 void SetAppListPresenter(mojom::AppListPresenterPtr presenter) override; | 40 void SetAppListPresenter(mojom::AppListPresenterPtr presenter) override; |
| 37 void OnTargetVisibilityChanged(bool visible) override; | 41 void OnTargetVisibilityChanged(bool visible) override; |
| 38 void OnVisibilityChanged(bool visible) override; | 42 void OnVisibilityChanged(bool visible, int64_t display_id) override; |
| 39 | 43 |
| 40 private: | 44 private: |
| 41 // Bindings for the mojom::AppList interface. | 45 // Bindings for the mojom::AppList interface. |
| 42 mojo::BindingSet<mojom::AppList> bindings_; | 46 mojo::BindingSet<mojom::AppList> bindings_; |
| 43 | 47 |
| 44 // App list presenter interface in chrome; used to show/hide the app list. | 48 // App list presenter interface in chrome; used to show/hide the app list. |
| 45 mojom::AppListPresenterPtr presenter_; | 49 mojom::AppListPresenterPtr presenter_; |
| 46 | 50 |
| 47 // The cached [target] visibility, as reported by the presenter. | 51 // The cached [target] visibility, as reported by the presenter. |
| 48 bool target_visible_ = false; | 52 bool target_visible_ = false; |
| 49 bool visible_ = false; | 53 bool visible_ = false; |
| 50 | 54 |
| 55 AppListDelegate* delegate_ = nullptr; | |
| 56 | |
| 51 DISALLOW_COPY_AND_ASSIGN(AppList); | 57 DISALLOW_COPY_AND_ASSIGN(AppList); |
| 52 }; | 58 }; |
| 53 | 59 |
| 54 } // namespace app_list | 60 } // namespace app_list |
| 55 | 61 |
| 56 #endif // UI_APP_LIST_PRESENTER_APP_LIST_H_ | 62 #endif // UI_APP_LIST_PRESENTER_APP_LIST_H_ |
| OLD | NEW |