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

Unified Diff: chrome/browser/ui/ash/app_list/app_list_service_ash.cc

Issue 1866403006: Revert of AppListController refactoring part 3: Switching over to use AppListShower in Ash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mus_chrome_delegates_ash_impl
Patch Set: Created 4 years, 8 months 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: chrome/browser/ui/ash/app_list/app_list_service_ash.cc
diff --git a/chrome/browser/ui/ash/app_list/app_list_service_ash.cc b/chrome/browser/ui/ash/app_list/app_list_service_ash.cc
index b420c882993b1a57bd44b94d2e8b1b2ffb87d0de..fb76d99edba1ce83e081a4f641fd4c7831af9779 100644
--- a/chrome/browser/ui/ash/app_list/app_list_service_ash.cc
+++ b/chrome/browser/ui/ash/app_list/app_list_service_ash.cc
@@ -4,48 +4,18 @@
#include "chrome/browser/ui/ash/app_list/app_list_service_ash.h"
-#include "ash/app_list/app_list_shower_delegate.h"
-#include "ash/app_list/app_list_shower_delegate_factory.h"
-#include "ash/app_list/app_list_view_delegate_factory.h"
#include "ash/shell.h"
#include "base/files/file_path.h"
-#include "base/memory/ptr_util.h"
#include "base/memory/singleton.h"
#include "build/build_config.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/app_list/app_list_view_delegate.h"
#include "chrome/browser/ui/app_list/start_page_service.h"
#include "chrome/browser/ui/ash/app_list/app_list_controller_ash.h"
#include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
-#include "chrome/browser/ui/ash/session_util.h"
#include "ui/app_list/app_list_switches.h"
-#include "ui/app_list/shower/app_list_shower_delegate_factory.h"
-#include "ui/app_list/shower/app_list_shower_impl.h"
#include "ui/app_list/views/app_list_main_view.h"
#include "ui/app_list/views/app_list_view.h"
#include "ui/app_list/views/contents_view.h"
-
-namespace {
-
-class ViewDelegateFactoryImpl : public ash::AppListViewDelegateFactory {
- public:
- explicit ViewDelegateFactoryImpl(AppListServiceImpl* factory)
- : factory_(factory) {}
- ~ViewDelegateFactoryImpl() override {}
-
- // app_list::AppListViewDelegateFactory:
- app_list::AppListViewDelegate* GetDelegate() override {
- return factory_->GetViewDelegate(
- Profile::FromBrowserContext(GetActiveBrowserContext()));
- }
-
- private:
- AppListServiceImpl* factory_;
-
- DISALLOW_COPY_AND_ASSIGN(ViewDelegateFactoryImpl);
-};
-
-} // namespace
// static
AppListServiceAsh* AppListServiceAsh::GetInstance() {
@@ -54,19 +24,33 @@
}
AppListServiceAsh::AppListServiceAsh()
- : shower_delegate_factory_(new ash::AppListShowerDelegateFactory(
- base::WrapUnique(new ViewDelegateFactoryImpl(this)))) {
- app_list_shower_.reset(
- new app_list::AppListShowerImpl(shower_delegate_factory_.get()));
- controller_delegate_.reset(
- new AppListControllerDelegateAsh(app_list_shower_.get()));
+ : controller_delegate_(new AppListControllerDelegateAsh()) {
}
AppListServiceAsh::~AppListServiceAsh() {
}
-app_list::AppListShower* AppListServiceAsh::GetAppListShower() {
- return app_list_shower_.get();
+void AppListServiceAsh::ShowAndSwitchToState(
+ app_list::AppListModel::State state) {
+ bool app_list_was_open = true;
+ app_list::AppListView* app_list_view =
+ ash::Shell::GetInstance()->GetAppListView();
+ if (!app_list_view) {
+ // TODO(calamity): This may cause the app list to show briefly before the
+ // state change. If this becomes an issue, add the ability to ash::Shell to
+ // load the app list without showing it.
+ ash::Shell::GetInstance()->ShowAppList(NULL);
+ app_list_was_open = false;
+ app_list_view = ash::Shell::GetInstance()->GetAppListView();
+ DCHECK(app_list_view);
+ }
+
+ if (state == app_list::AppListModel::INVALID_STATE)
+ return;
+
+ app_list::ContentsView* contents_view =
+ app_list_view->app_list_main_view()->contents_view();
+ contents_view->SetActiveState(state, app_list_was_open /* animate */);
}
void AppListServiceAsh::Init(Profile* initial_profile) {
@@ -79,28 +63,7 @@
}
void AppListServiceAsh::OnProfileWillBeRemoved(
- const base::FilePath& profile_path) {}
-
-void AppListServiceAsh::ShowAndSwitchToState(
- app_list::AppListModel::State state) {
- bool app_list_was_open = true;
- app_list::AppListView* app_list_view = app_list_shower_->GetView();
- if (!app_list_view) {
- // TODO(calamity): This may cause the app list to show briefly before the
- // state change. If this becomes an issue, add the ability to ash::Shell to
- // load the app list without showing it.
- app_list_shower_->Show(ash::Shell::GetTargetRootWindow());
- app_list_was_open = false;
- app_list_view = app_list_shower_->GetView();
- DCHECK(app_list_view);
- }
-
- if (state == app_list::AppListModel::INVALID_STATE)
- return;
-
- app_list::ContentsView* contents_view =
- app_list_view->app_list_main_view()->contents_view();
- contents_view->SetActiveState(state, app_list_was_open /* animate */);
+ const base::FilePath& profile_path) {
}
base::FilePath AppListServiceAsh::GetProfilePath(
@@ -112,7 +75,7 @@
// This may not work correctly if the profile passed in is different from the
// one the ash Shell is currently using.
// TODO(ananta): Handle profile changes correctly when !defined(OS_CHROMEOS).
- app_list_shower_->Show(ash::Shell::GetTargetRootWindow());
+ ash::Shell::GetInstance()->ShowAppList(NULL);
}
void AppListServiceAsh::ShowForAppInstall(Profile* profile,
@@ -130,7 +93,8 @@
}
void AppListServiceAsh::HideCustomLauncherPage() {
- app_list::AppListView* app_list_view = app_list_shower_->GetView();
+ app_list::AppListView* app_list_view =
+ ash::Shell::GetInstance()->GetAppListView();
if (!app_list_view)
return;
@@ -143,18 +107,20 @@
}
bool AppListServiceAsh::IsAppListVisible() const {
- return app_list_shower_->GetTargetVisibility();
+ return ash::Shell::GetInstance()->GetAppListTargetVisibility();
}
void AppListServiceAsh::DismissAppList() {
- app_list_shower_->Dismiss();
+ ash::Shell::GetInstance()->DismissAppList();
}
void AppListServiceAsh::EnableAppList(Profile* initial_profile,
AppListEnableSource enable_source) {}
gfx::NativeWindow AppListServiceAsh::GetAppListWindow() {
- return app_list_shower_->GetWindow();
+ if (ash::Shell::HasInstance())
+ return ash::Shell::GetInstance()->GetAppListWindow();
+ return NULL;
}
Profile* AppListServiceAsh::GetCurrentAppListProfile() {

Powered by Google App Engine
This is Rietveld 408576698