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

Unified Diff: ash/test/test_shell_delegate.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/test/test_shell_delegate.cc
diff --git a/ash/test/test_shell_delegate.cc b/ash/test/test_shell_delegate.cc
index fbfb2193878887f55f9173470347b3ee31e342c2..9bae857a33fc120207e8239b2f0154169aab8038 100644
--- a/ash/test/test_shell_delegate.cc
+++ b/ash/test/test_shell_delegate.cc
@@ -18,11 +18,14 @@
#include "ash/test/test_shelf_delegate.h"
#include "ash/test/test_system_tray_delegate.h"
#include "ash/test/test_user_wallpaper_delegate.h"
+#include "ash/wm/app_list_shower_delegate.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 "ash/wm/window_util.h"
#include "base/logging.h"
-#include "ui/app_list/app_list_model.h"
-#include "ui/app_list/app_list_view_delegate.h"
+#include "base/memory/ptr_util.h"
+#include "ui/app_list/shower/app_list_shower_impl.h"
#include "ui/app_list/test/app_list_test_view_delegate.h"
#include "ui/aura/window.h"
#include "ui/gfx/image/image.h"
@@ -76,12 +79,34 @@ class MediaDelegateImpl : public MediaDelegate {
DISALLOW_COPY_AND_ASSIGN(MediaDelegateImpl);
};
+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(
+ new app_list::test::AppListTestViewDelegate);
+ }
+ return app_list_view_delegate_.get();
+ }
+
+ private:
+ std::unique_ptr<app_list::AppListViewDelegate> app_list_view_delegate_;
+
+ DISALLOW_COPY_AND_ASSIGN(AppListViewDelegateFactoryImpl);
+};
+
} // namespace
TestShellDelegate::TestShellDelegate()
: num_exit_requests_(0),
multi_profiles_enabled_(false),
- force_maximize_on_first_run_(false) {}
+ force_maximize_on_first_run_(false),
+ app_list_shower_delegate_factory_(new AppListShowerDelegateFactory(
+ base::WrapUnique(new AppListViewDelegateFactoryImpl))) {}
TestShellDelegate::~TestShellDelegate() {
}
@@ -142,10 +167,12 @@ void TestShellDelegate::RemoveVirtualKeyboardStateObserver(
void TestShellDelegate::OpenUrl(const GURL& url) {}
-app_list::AppListViewDelegate* TestShellDelegate::GetAppListViewDelegate() {
- if (!app_list_view_delegate_)
- app_list_view_delegate_.reset(new app_list::test::AppListTestViewDelegate);
- return app_list_view_delegate_.get();
+app_list::AppListShower* TestShellDelegate::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* TestShellDelegate::CreateShelfDelegate(ShelfModel* model) {

Powered by Google App Engine
This is Rietveld 408576698