Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1610)

Unified Diff: ash/mus/app_list_presenter_mus.cc

Issue 2567523002: mash: Have chrome set itself as the app list presenter. (Closed)
Patch Set: Address comments. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/mus/app_list_presenter_mus.cc
diff --git a/ash/mus/app_list_presenter_mus.cc b/ash/mus/app_list_presenter_mus.cc
index 9bb13fbf99566f98d53ea2570efc2e76cac3fbe8..2e8bfbd888683d42b840ee08c8909604f7c0b722 100644
--- a/ash/mus/app_list_presenter_mus.cc
+++ b/ash/mus/app_list_presenter_mus.cc
@@ -4,37 +4,31 @@
#include "ash/mus/app_list_presenter_mus.h"
-#include "content/public/common/service_names.mojom.h"
-#include "services/service_manager/public/cpp/connector.h"
+#include "ash/common/wm_shell.h"
+#include "ui/app_list/presenter/app_list.h"
namespace ash {
-namespace {
-
-bool HasConnection(app_list::mojom::AppListPresenterPtr* interface_ptr) {
- return interface_ptr->is_bound() && !interface_ptr->encountered_error();
-}
-
-} // namespace
-
-AppListPresenterMus::AppListPresenterMus(service_manager::Connector* connector)
- : connector_(connector) {}
+AppListPresenterMus::AppListPresenterMus() {}
AppListPresenterMus::~AppListPresenterMus() {}
void AppListPresenterMus::Show(int64_t display_id) {
- ConnectIfNeeded();
- presenter_->Show(display_id);
+ app_list::AppList* app_list = WmShell::Get()->app_list();
mfomitchev 2016/12/12 22:59:49 nit: why not do app_list_presenter = WmShell::Get
msw 2016/12/12 23:47:54 Done.
+ if (app_list->GetAppListPresenter())
+ app_list->GetAppListPresenter()->Show(display_id);
}
void AppListPresenterMus::Dismiss() {
- ConnectIfNeeded();
- presenter_->Dismiss();
+ app_list::AppList* app_list = WmShell::Get()->app_list();
+ if (app_list->GetAppListPresenter())
+ app_list->GetAppListPresenter()->Dismiss();
}
void AppListPresenterMus::ToggleAppList(int64_t display_id) {
- ConnectIfNeeded();
- presenter_->ToggleAppList(display_id);
+ app_list::AppList* app_list = WmShell::Get()->app_list();
+ if (app_list->GetAppListPresenter())
+ app_list->GetAppListPresenter()->ToggleAppList(display_id);
}
bool AppListPresenterMus::IsVisible() const {
@@ -49,13 +43,4 @@ bool AppListPresenterMus::GetTargetVisibility() const {
return false;
}
-void AppListPresenterMus::ConnectIfNeeded() {
- if (!connector_ || HasConnection(&presenter_))
- return;
- connector_->ConnectToInterface(content::mojom::kBrowserServiceName,
- &presenter_);
- CHECK(HasConnection(&presenter_))
- << "Could not connect to app_list::mojom::AppListPresenter.";
-}
-
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698