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

Unified Diff: ash/shell/shell_delegate_impl.cc

Issue 1861013004: 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: Addressing review feedback. 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: ash/shell/shell_delegate_impl.cc
diff --git a/ash/shell/shell_delegate_impl.cc b/ash/shell/shell_delegate_impl.cc
index 6fd7660fb96ff41af4fcde704d7562eadb02421a..6be9abf19d4b2d3a4541663ce3b718c547e19dac 100644
--- a/ash/shell/shell_delegate_impl.cc
+++ b/ash/shell/shell_delegate_impl.cc
@@ -18,11 +18,15 @@
#include "ash/shell_window_ids.h"
#include "ash/system/tray/default_system_tray_delegate.h"
#include "ash/test/test_keyboard_ui.h"
+#include "ash/wm/app_list_shower_delegate_factory.h"
+#include "ash/wm/app_list_view_delegate_factory.h"
#include "ash/wm/window_state.h"
+#include "base/memory/ptr_util.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "components/user_manager/user_info_impl.h"
#include "ui/app_list/app_list_view_delegate.h"
+#include "ui/app_list/shower/app_list_shower_impl.h"
#include "ui/aura/window.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/image/image_skia.h"
@@ -129,14 +133,35 @@ class SessionStateDelegateImpl : public SessionStateDelegate {
bool screen_locked_;
// A pseudo user info.
- scoped_ptr<user_manager::UserInfo> user_info_;
+ std::unique_ptr<user_manager::UserInfo> user_info_;
DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateImpl);
};
+class AppListViewDelegateFactoryImpl : public ash::AppListViewDelegateFactory {
+ public:
+ AppListViewDelegateFactoryImpl() {}
+ ~AppListViewDelegateFactoryImpl() override {}
+
+ // app_list::AppListViewDelegateFactory:
+ app_list::AppListViewDelegate* GetDelegate() override {
+ if (!app_list_view_delegate_.get())
+ app_list_view_delegate_.reset(CreateAppListViewDelegate());
+ return app_list_view_delegate_.get();
+ }
+
+ private:
+ std::unique_ptr<app_list::AppListViewDelegate> app_list_view_delegate_;
+
+ DISALLOW_COPY_AND_ASSIGN(AppListViewDelegateFactoryImpl);
+};
+
} // namespace
-ShellDelegateImpl::ShellDelegateImpl() : shelf_delegate_(nullptr) {}
+ShellDelegateImpl::ShellDelegateImpl()
+ : shelf_delegate_(nullptr),
+ app_list_shower_delegate_factory_(new AppListShowerDelegateFactory(
+ base::WrapUnique(new AppListViewDelegateFactoryImpl))) {}
ShellDelegateImpl::~ShellDelegateImpl() {}
@@ -191,10 +216,12 @@ void ShellDelegateImpl::RemoveVirtualKeyboardStateObserver(
void ShellDelegateImpl::OpenUrl(const GURL& url) {}
-app_list::AppListViewDelegate* ShellDelegateImpl::GetAppListViewDelegate() {
- if (!app_list_view_delegate_)
- app_list_view_delegate_.reset(ash::shell::CreateAppListViewDelegate());
- return app_list_view_delegate_.get();
+app_list::AppListShower* ShellDelegateImpl::GetAppListShower() {
+ if (!app_list_shower_) {
+ app_list_shower_.reset(new app_list::AppListShowerImpl(
+ app_list_shower_delegate_factory_.get()));
+ }
+ return app_list_shower_.get();
}
ShelfDelegate* ShellDelegateImpl::CreateShelfDelegate(ShelfModel* model) {

Powered by Google App Engine
This is Rietveld 408576698