| 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 #include "chrome/browser/ui/ash/app_list/app_list_presenter_service.h" | 5 #include "chrome/browser/ui/ash/app_list/app_list_presenter_service.h" |
| 6 | 6 |
| 7 #include "ash/public/interfaces/constants.mojom.h" |
| 7 #include "chrome/browser/ui/ash/app_list/app_list_service_ash.h" | 8 #include "chrome/browser/ui/ash/app_list/app_list_service_ash.h" |
| 8 #include "chrome/browser/ui/ash/ash_util.h" | |
| 9 #include "content/public/common/service_manager_connection.h" | 9 #include "content/public/common/service_manager_connection.h" |
| 10 #include "services/service_manager/public/cpp/connector.h" | 10 #include "services/service_manager/public/cpp/connector.h" |
| 11 #include "ui/app_list/presenter/app_list_presenter_impl.h" | 11 #include "ui/app_list/presenter/app_list_presenter_impl.h" |
| 12 | 12 |
| 13 AppListPresenterService::AppListPresenterService() : binding_(this) { | 13 AppListPresenterService::AppListPresenterService() : binding_(this) { |
| 14 content::ServiceManagerConnection* connection = | 14 content::ServiceManagerConnection* connection = |
| 15 content::ServiceManagerConnection::GetForProcess(); | 15 content::ServiceManagerConnection::GetForProcess(); |
| 16 if (connection && connection->GetConnector()) { | 16 if (connection && connection->GetConnector()) { |
| 17 // Connect to the app list interface in the ash service. | 17 // Connect to the app list interface in the ash service. |
| 18 app_list::mojom::AppListPtr app_list_ptr; | 18 app_list::mojom::AppListPtr app_list_ptr; |
| 19 connection->GetConnector()->BindInterface(ash_util::GetAshServiceName(), | 19 connection->GetConnector()->BindInterface(ash::mojom::kServiceName, |
| 20 &app_list_ptr); | 20 &app_list_ptr); |
| 21 // Register this object as the app list presenter. | 21 // Register this object as the app list presenter. |
| 22 app_list_ptr->SetAppListPresenter(binding_.CreateInterfacePtrAndBind()); | 22 app_list_ptr->SetAppListPresenter(binding_.CreateInterfacePtrAndBind()); |
| 23 // Pass the interface pointer to the presenter to report visibility changes. | 23 // Pass the interface pointer to the presenter to report visibility changes. |
| 24 GetPresenter()->SetAppList(std::move(app_list_ptr)); | 24 GetPresenter()->SetAppList(std::move(app_list_ptr)); |
| 25 } | 25 } |
| 26 } | 26 } |
| 27 | 27 |
| 28 AppListPresenterService::~AppListPresenterService() {} | 28 AppListPresenterService::~AppListPresenterService() {} |
| 29 | 29 |
| 30 void AppListPresenterService::Show(int64_t display_id) { | 30 void AppListPresenterService::Show(int64_t display_id) { |
| 31 GetPresenter()->Show(display_id); | 31 GetPresenter()->Show(display_id); |
| 32 } | 32 } |
| 33 | 33 |
| 34 void AppListPresenterService::Dismiss() { | 34 void AppListPresenterService::Dismiss() { |
| 35 GetPresenter()->Dismiss(); | 35 GetPresenter()->Dismiss(); |
| 36 } | 36 } |
| 37 | 37 |
| 38 void AppListPresenterService::ToggleAppList(int64_t display_id) { | 38 void AppListPresenterService::ToggleAppList(int64_t display_id) { |
| 39 GetPresenter()->ToggleAppList(display_id); | 39 GetPresenter()->ToggleAppList(display_id); |
| 40 } | 40 } |
| 41 | 41 |
| 42 app_list::AppListPresenterImpl* AppListPresenterService::GetPresenter() { | 42 app_list::AppListPresenterImpl* AppListPresenterService::GetPresenter() { |
| 43 return AppListServiceAsh::GetInstance()->GetAppListPresenter(); | 43 return AppListServiceAsh::GetInstance()->GetAppListPresenter(); |
| 44 } | 44 } |
| OLD | NEW |