OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ash/shell/example_app_list_presenter.h" |
| 6 |
| 7 #include "ash/app_list/app_list_presenter_delegate_factory.h" |
| 8 #include "ash/shell/example_factory.h" |
| 9 #include "ui/app_list/presenter/app_list_view_delegate_factory.h" |
| 10 |
| 11 namespace { |
| 12 |
| 13 // An example app list view delegate factory. |
| 14 class ExampleAppListViewDelegateFactory |
| 15 : public app_list::AppListViewDelegateFactory { |
| 16 public: |
| 17 ExampleAppListViewDelegateFactory() |
| 18 : app_list_view_delegate_(ash::shell::CreateAppListViewDelegate()) {} |
| 19 ~ExampleAppListViewDelegateFactory() override {} |
| 20 |
| 21 // app_list::AppListViewDelegateFactory: |
| 22 app_list::AppListViewDelegate* GetDelegate() override { |
| 23 return app_list_view_delegate_.get(); |
| 24 } |
| 25 |
| 26 private: |
| 27 std::unique_ptr<app_list::AppListViewDelegate> app_list_view_delegate_; |
| 28 |
| 29 DISALLOW_COPY_AND_ASSIGN(ExampleAppListViewDelegateFactory); |
| 30 }; |
| 31 |
| 32 } // namespace |
| 33 |
| 34 namespace ash { |
| 35 namespace shell { |
| 36 |
| 37 ExampleAppListPresenter::ExampleAppListPresenter() |
| 38 : binding_(this), |
| 39 app_list_presenter_impl_( |
| 40 base::MakeUnique<AppListPresenterDelegateFactory>( |
| 41 base::MakeUnique<ExampleAppListViewDelegateFactory>())) { |
| 42 // Note: This example |app_list_presenter_impl_| does not report visibility |
| 43 // changes to the app_list::mojom::AppList implementation owned by WmShell. |
| 44 } |
| 45 |
| 46 ExampleAppListPresenter::~ExampleAppListPresenter() {} |
| 47 |
| 48 app_list::mojom::AppListPresenterPtr |
| 49 ExampleAppListPresenter::CreateInterfacePtrAndBind() { |
| 50 return binding_.CreateInterfacePtrAndBind(); |
| 51 } |
| 52 |
| 53 void ExampleAppListPresenter::Show(int64_t display_id) { |
| 54 app_list_presenter_impl_.Show(display_id); |
| 55 } |
| 56 |
| 57 void ExampleAppListPresenter::Dismiss() { |
| 58 app_list_presenter_impl_.Dismiss(); |
| 59 } |
| 60 |
| 61 void ExampleAppListPresenter::ToggleAppList(int64_t display_id) { |
| 62 app_list_presenter_impl_.ToggleAppList(display_id); |
| 63 } |
| 64 |
| 65 } // namespace shell |
| 66 } // namespace ash |
OLD | NEW |