Index: ash/shell/example_app_list_presenter.cc |
diff --git a/ash/shell/example_app_list_presenter.cc b/ash/shell/example_app_list_presenter.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..150a6c6f77110a04784cec287845ecea6ec9edc6 |
--- /dev/null |
+++ b/ash/shell/example_app_list_presenter.cc |
@@ -0,0 +1,61 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "ash/shell/example_app_list_presenter.h" |
+ |
+#include "ash/shell/example_factory.h" |
+#include "ui/app_list/presenter/app_list_view_delegate_factory.h" |
+ |
+namespace { |
+ |
+// An example app list view delegate factory. |
+class ExampleAppListViewDelegateFactory |
+ : public app_list::AppListViewDelegateFactory { |
+ public: |
+ ExampleAppListViewDelegateFactory() {} |
+ ~ExampleAppListViewDelegateFactory() override {} |
+ |
+ app_list::AppListViewDelegate* GetDelegate() override { |
+ return ash::shell::CreateAppListViewDelegate(); |
+ } |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(ExampleAppListViewDelegateFactory); |
+}; |
+ |
+} // namespace |
+ |
+namespace ash { |
+namespace shell { |
+ |
+ExampleAppListPresenter::ExampleAppListPresenter() |
+ : binding_(this), |
+ app_list_presenter_delegate_factory_( |
+ base::MakeUnique<ExampleAppListViewDelegateFactory>()), |
+ app_list_presenter_impl_(&app_list_presenter_delegate_factory_) { |
+ // Note: This example |app_list_presenter_impl_| does not report visibility |
+ // changes to the app_list::mojom::AppList implementation owned by WmShell. |
+} |
+ |
+ExampleAppListPresenter::~ExampleAppListPresenter() {} |
Daniel Erat
2016/12/22 18:17:57
is "= default;" preferred in cases like these now?
msw
2016/12/23 03:59:34
The style guide doesn't state a preference, and I
|
+ |
+app_list::mojom::AppListPresenterPtr |
+ExampleAppListPresenter::CreateInterfacePtrAndBind() { |
+ return binding_.CreateInterfacePtrAndBind(); |
+} |
+ |
+void ExampleAppListPresenter::Show(int64_t display_id) { |
+ app_list_presenter_impl_.Show(display_id); |
+} |
+ |
+void ExampleAppListPresenter::Dismiss() { |
+ app_list_presenter_impl_.Dismiss(); |
+} |
+ |
+void ExampleAppListPresenter::ToggleAppList(int64_t display_id) { |
+ app_list_presenter_impl_.ToggleAppList(display_id); |
+} |
+ |
+} // namespace shell |
+} // namespace ash |