diff options
author | tapted@chromium.org <tapted@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-03 03:55:19 +0000 |
---|---|---|
committer | tapted@chromium.org <tapted@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-03 03:55:19 +0000 |
commit | 51b195f89df9949639c88b57d8a1642788a31540 (patch) | |
tree | 15672b967158bcd73cad20d6a652bfc06056430a | |
parent | a43849ba735dd08f53eead610ade7083e7fc79e4 (diff) | |
download | chromium_src-51b195f89df9949639c88b57d8a1642788a31540.zip chromium_src-51b195f89df9949639c88b57d8a1642788a31540.tar.gz chromium_src-51b195f89df9949639c88b57d8a1642788a31540.tar.bz2 |
Refactor views app list services to allow more code sharing
To run the toolkit-views app launcher on Mac, it needs a new app list
service + supporting classes. It's going to look a lot like the Linux
one. This CL starts by sharing what can be shared between Windows and
Linux, in preparation for using it on Mac as well.
It does this principally by:
- Moving `app_list_shower` to `app_list_shower_views`, making it views-specific;
- Adding AppListServiceViews, which Win/Linux (and soon Mac) inherit from;
- Rearranging the delegation to eliminate some boilerplate.
Other changes:
- Removed AppList container abstract interface (now just access AppListView);
- Removed AppListFactory (now AppListShower::MakeViewForCurrentProfile());
- Moved AppListControllerDelegateLinux to AppListControllerDelegateViews;
- Most of AppListServiceLinux moves to AppListServiceViews;
- Added AppListShowerDelegate and AppListShower given virtual method
hooks to assist testability (previously AppListShower was given a NULL
service/delegate in tests);
- Positioning logic in AppListWin/AppListLinux made static/stateless;
- Removes the `on_should_dismiss_` closure (now just dismiss via the service;
- Big trim of AppListServiceWin and AppListServiceLinux - now these are
just platform-specific stuff.
BUG=365977
TEST=Just refactoring, nothing should change
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=267184
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=267354
Review URL: https://codereview.chromium.org/225053004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@268035 0039d316-1c4b-4281-b951-d872f2087c98
29 files changed, 535 insertions, 728 deletions
diff --git a/build/filename_rules.gypi b/build/filename_rules.gypi index 001b975..8b49202 100644 --- a/build/filename_rules.gypi +++ b/build/filename_rules.gypi @@ -72,7 +72,7 @@ ], }], ['<(toolkit_views)==0 or >(nacl_untrusted_build)==1', { - 'sources/': [ ['exclude', '_views\\.(h|cc)$'] ] + 'sources/': [ ['exclude', '_views(_browsertest|_unittest)?\\.(h|cc)$'] ] }], ['<(use_aura)==0 or >(nacl_untrusted_build)==1', { 'sources/': [ ['exclude', '_aura(_browsertest|_unittest)?\\.(h|cc)$'], diff --git a/chrome/browser/ui/app_list/app_list.h b/chrome/browser/ui/app_list/app_list.h deleted file mode 100644 index fcc321c..0000000 --- a/chrome/browser/ui/app_list/app_list.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_UI_APP_LIST_APP_LIST_H_ -#define CHROME_BROWSER_UI_APP_LIST_APP_LIST_H_ - -#include "ui/gfx/native_widget_types.h" - -class Profile; - -// A container for an AppListView that can be positioned and knows when it has -// lost focus. Has platform-specific implementations. -class AppList { - public: - virtual ~AppList() {} - virtual void Show() = 0; - virtual void Hide() = 0; - virtual void MoveNearCursor() = 0; - virtual bool IsVisible() = 0; - virtual void Prerender() = 0; - virtual gfx::NativeWindow GetWindow() = 0; - virtual void SetProfile(Profile* profile) = 0; -}; - -#endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_H_ diff --git a/chrome/browser/ui/app_list/app_list_controller_delegate_views.cc b/chrome/browser/ui/app_list/app_list_controller_delegate_views.cc new file mode 100644 index 0000000..2ec4e9b --- /dev/null +++ b/chrome/browser/ui/app_list/app_list_controller_delegate_views.cc @@ -0,0 +1,31 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ui/app_list/app_list_controller_delegate_views.h" + +#include "chrome/browser/ui/app_list/app_list_service_views.h" + +AppListControllerDelegateViews::AppListControllerDelegateViews( + AppListServiceViews* service) + : AppListControllerDelegateImpl(service), + service_(service) { +} + +AppListControllerDelegateViews::~AppListControllerDelegateViews() {} + +void AppListControllerDelegateViews::ViewClosing() { + service_->OnViewBeingDestroyed(); +} + +void AppListControllerDelegateViews::OnShowExtensionPrompt() { + service_->set_can_dismiss(false); +} + +void AppListControllerDelegateViews::OnCloseExtensionPrompt() { + service_->set_can_dismiss(true); +} + +bool AppListControllerDelegateViews::CanDoCreateShortcutsFlow() { + return true; +} diff --git a/chrome/browser/ui/app_list/app_list_controller_delegate_views.h b/chrome/browser/ui/app_list/app_list_controller_delegate_views.h new file mode 100644 index 0000000..c17d042 --- /dev/null +++ b/chrome/browser/ui/app_list/app_list_controller_delegate_views.h @@ -0,0 +1,31 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_UI_APP_LIST_APP_LIST_CONTROLLER_DELEGATE_VIEWS_H_ +#define CHROME_BROWSER_UI_APP_LIST_APP_LIST_CONTROLLER_DELEGATE_VIEWS_H_ + +#include "chrome/browser/ui/app_list/app_list_controller_delegate_impl.h" + +class AppListServiceViews; + +// Conveys messages from a views-backed app list to the AppListService that +// created it. +class AppListControllerDelegateViews : public AppListControllerDelegateImpl { + public: + explicit AppListControllerDelegateViews(AppListServiceViews* service); + virtual ~AppListControllerDelegateViews(); + + // AppListControllerDelegate overrides: + virtual void ViewClosing() OVERRIDE; + virtual void OnShowExtensionPrompt() OVERRIDE; + virtual void OnCloseExtensionPrompt() OVERRIDE; + virtual bool CanDoCreateShortcutsFlow() OVERRIDE; + + private: + AppListServiceViews* service_; // Weak. Owns us. + + DISALLOW_COPY_AND_ASSIGN(AppListControllerDelegateViews); +}; + +#endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_CONTROLLER_DELEGATE_VIEWS_H_ diff --git a/chrome/browser/ui/app_list/app_list_factory.h b/chrome/browser/ui/app_list/app_list_factory.h deleted file mode 100644 index 56b1f05..0000000 --- a/chrome/browser/ui/app_list/app_list_factory.h +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_UI_APP_LIST_APP_LIST_FACTORY_H_ -#define CHROME_BROWSER_UI_APP_LIST_APP_LIST_FACTORY_H_ - -#include "base/callback_forward.h" -#include "chrome/browser/ui/app_list/app_list.h" - -class AppListService; -class Profile; - -namespace app_list { -class PaginationModel; -} - -// Factory for AppLists. Used to allow us to create fake app lists in tests. -class AppListFactory { - public: - virtual ~AppListFactory() {} - virtual AppList* CreateAppList(Profile* profile, - AppListService* service, - const base::Closure& on_should_dismiss) = 0; -}; - -#endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_FACTORY_H_ diff --git a/chrome/browser/ui/app_list/app_list_service_views.cc b/chrome/browser/ui/app_list/app_list_service_views.cc new file mode 100644 index 0000000..7be99f9 --- /dev/null +++ b/chrome/browser/ui/app_list/app_list_service_views.cc @@ -0,0 +1,71 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ui/app_list/app_list_service_views.h" + +#include "chrome/browser/ui/app_list/app_list_controller_delegate.h" +#include "chrome/browser/ui/app_list/scoped_keep_alive.h" + +AppListServiceViews::AppListServiceViews( + scoped_ptr<AppListControllerDelegate> controller_delegate) + : shower_(this), + can_dismiss_(true), + controller_delegate_(controller_delegate.Pass()) { +} + +AppListServiceViews::~AppListServiceViews() {} + +void AppListServiceViews::OnViewBeingDestroyed() { + can_dismiss_ = true; + shower_.HandleViewBeingDestroyed(); +} + +void AppListServiceViews::Init(Profile* initial_profile) { + PerformStartupChecks(initial_profile); +} + +void AppListServiceViews::CreateForProfile(Profile* requested_profile) { + shower_.CreateViewForProfile(requested_profile); +} + +void AppListServiceViews::ShowForProfile(Profile* requested_profile) { + DCHECK(requested_profile); + if (requested_profile->IsManaged()) + return; + + ScopedKeepAlive keep_alive; + + InvalidatePendingProfileLoads(); + SetProfilePath(requested_profile->GetPath()); + shower_.ShowForProfile(requested_profile); + RecordAppListLaunch(); +} + +void AppListServiceViews::DismissAppList() { + if (!can_dismiss_) + return; + + shower_.DismissAppList(); +} + +bool AppListServiceViews::IsAppListVisible() const { + return shower_.IsAppListVisible(); +} + +gfx::NativeWindow AppListServiceViews::GetAppListWindow() { + return shower_.GetWindow(); +} + +Profile* AppListServiceViews::GetCurrentAppListProfile() { + return shower_.profile(); +} + +AppListControllerDelegate* AppListServiceViews::GetControllerDelegate() { + return controller_delegate_.get(); +} + +AppListControllerDelegate* +AppListServiceViews::GetControllerDelegateForCreate() { + return controller_delegate_.get(); +} diff --git a/chrome/browser/ui/app_list/app_list_service_views.h b/chrome/browser/ui/app_list/app_list_service_views.h new file mode 100644 index 0000000..925f4f1 --- /dev/null +++ b/chrome/browser/ui/app_list/app_list_service_views.h @@ -0,0 +1,56 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_VIEWS_H_ +#define CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_VIEWS_H_ + +#include "base/memory/scoped_ptr.h" +#include "chrome/browser/ui/app_list/app_list_service_impl.h" +#include "chrome/browser/ui/app_list/app_list_shower_delegate.h" +#include "chrome/browser/ui/app_list/app_list_shower_views.h" + +class AppListControllerDelegate; + +// AppListServiceViews manages a desktop app list that uses toolkit-views. +class AppListServiceViews : public AppListServiceImpl, + public AppListShowerDelegate { + public: + explicit AppListServiceViews( + scoped_ptr<AppListControllerDelegate> controller_delegate); + virtual ~AppListServiceViews(); + + // Set |can_dismiss| to prevent the app list dismissing when losing focus. For + // example, while showing a window-modal dialog. + void set_can_dismiss(bool can_dismiss) { can_dismiss_ = can_dismiss; } + + AppListShower& shower() { return shower_; } + + // Called by the AppListControllerDelegate when it is told that the app list + // view must be destroyed. + virtual void OnViewBeingDestroyed(); + + // AppListService overrides: + virtual void Init(Profile* initial_profile) OVERRIDE; + virtual void CreateForProfile(Profile* requested_profile) OVERRIDE; + virtual void ShowForProfile(Profile* requested_profile) OVERRIDE; + virtual void DismissAppList() OVERRIDE; + virtual bool IsAppListVisible() const OVERRIDE; + virtual gfx::NativeWindow GetAppListWindow() OVERRIDE; + virtual Profile* GetCurrentAppListProfile() OVERRIDE; + virtual AppListControllerDelegate* GetControllerDelegate() OVERRIDE; + + // AppListShowerDelegate overrides: + virtual AppListControllerDelegate* GetControllerDelegateForCreate() OVERRIDE; + + private: + // Responsible for creating the app list and responding to profile changes. + AppListShower shower_; + + bool can_dismiss_; + scoped_ptr<AppListControllerDelegate> controller_delegate_; + + DISALLOW_COPY_AND_ASSIGN(AppListServiceViews); +}; + +#endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_VIEWS_H_ diff --git a/chrome/browser/ui/app_list/app_list_shower.h b/chrome/browser/ui/app_list/app_list_shower.h deleted file mode 100644 index 4228d95..0000000 --- a/chrome/browser/ui/app_list/app_list_shower.h +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_UI_APP_LIST_APP_LIST_SHOWER_H_ -#define CHROME_BROWSER_UI_APP_LIST_APP_LIST_SHOWER_H_ - -#include "base/memory/scoped_ptr.h" -#include "chrome/browser/ui/app_list/app_list.h" -#include "chrome/browser/ui/app_list/app_list_factory.h" -#include "ui/app_list/pagination_model.h" -#include "ui/gfx/native_widget_types.h" - -namespace app_list { -class AppListModel; -} - -class AppListShowerUnitTest; -class Profile; -class ScopedKeepAlive; - -// Creates and shows an AppList as needed for non-Ash desktops. It is owned -// by AppListService. -class AppListShower { - public: - AppListShower(scoped_ptr<AppListFactory> factory, - AppListService* service); - ~AppListShower(); - - void set_can_close(bool can_close) { - can_close_app_list_ = can_close; - } - - void ShowForProfile(Profile* requested_profile); - gfx::NativeWindow GetWindow(); - - AppList* app_list() { return app_list_.get(); } - Profile* profile() const { return profile_; } - - // Create or recreate, and initialize |app_list_| from |requested_profile|. - void CreateViewForProfile(Profile* requested_profile); - - void DismissAppList(); - void HandleViewBeingDestroyed(); - bool IsAppListVisible() const; - void WarmupForProfile(Profile* profile); - bool HasView() const; - - private: - friend class ::AppListShowerUnitTest; - - void ResetKeepAlive(); - - scoped_ptr<AppListFactory> factory_; - scoped_ptr<ScopedKeepAlive> keep_alive_; - scoped_ptr<AppList> app_list_; - AppListService* service_; // Weak ptr, owns this. - Profile* profile_; - bool can_close_app_list_; - - // Used to keep the browser process alive while the app list is visible. - - DISALLOW_COPY_AND_ASSIGN(AppListShower); -}; - -#endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SHOWER_H_ diff --git a/chrome/browser/ui/app_list/app_list_shower_delegate.h b/chrome/browser/ui/app_list/app_list_shower_delegate.h new file mode 100644 index 0000000..9283cf49f --- /dev/null +++ b/chrome/browser/ui/app_list/app_list_shower_delegate.h @@ -0,0 +1,23 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_UI_APP_LIST_APP_LIST_SHOWER_DELEGATE_H_ +#define CHROME_BROWSER_UI_APP_LIST_APP_LIST_SHOWER_DELEGATE_H_ + +namespace app_list { +class AppListView; +} + +class AppListControllerDelegate; + +// Allows platform-specific hooks for the AppListShower. +class AppListShowerDelegate { + public: + virtual AppListControllerDelegate* GetControllerDelegateForCreate() = 0; + virtual void OnViewCreated() = 0; + virtual void OnViewDismissed() = 0; + virtual void MoveNearCursor(app_list::AppListView* view) = 0; +}; + +#endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SHOWER_DELEGATE_H_ diff --git a/chrome/browser/ui/app_list/app_list_shower.cc b/chrome/browser/ui/app_list/app_list_shower_views.cc index d657c7c..de3ddb6 100644 --- a/chrome/browser/ui/app_list/app_list_shower.cc +++ b/chrome/browser/ui/app_list/app_list_shower_views.cc @@ -2,17 +2,23 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "chrome/browser/ui/app_list/app_list_shower_views.h" + #include "base/bind.h" #include "base/message_loop/message_loop.h" -#include "chrome/browser/ui/app_list/app_list_shower.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/ui/app_list/app_list_shower_delegate.h" +#include "chrome/browser/ui/app_list/app_list_view_delegate.h" #include "chrome/browser/ui/app_list/scoped_keep_alive.h" +#include "ui/app_list/views/app_list_view.h" +#include "ui/gfx/geometry/point.h" +#include "ui/gfx/screen.h" -AppListShower::AppListShower(scoped_ptr<AppListFactory> factory, - AppListService* service) - : factory_(factory.Pass()), - service_(service), +AppListShower::AppListShower(AppListShowerDelegate* delegate) + : delegate_(delegate), profile_(NULL), - can_close_app_list_(true) { + app_list_(NULL), + window_icon_updated_(false) { } AppListShower::~AppListShower() { @@ -22,48 +28,46 @@ void AppListShower::ShowForProfile(Profile* requested_profile) { // If the app list is already displaying |profile| just activate it (in case // we have lost focus). if (IsAppListVisible() && (requested_profile == profile_)) { - app_list_->Show(); + Show(); return; } - if (!app_list_) { + if (!HasView()) { CreateViewForProfile(requested_profile); } else if (requested_profile != profile_) { profile_ = requested_profile; - app_list_->SetProfile(requested_profile); + UpdateViewForNewProfile(); } keep_alive_.reset(new ScopedKeepAlive); if (!IsAppListVisible()) - app_list_->MoveNearCursor(); - app_list_->Show(); + delegate_->MoveNearCursor(app_list_); + Show(); } gfx::NativeWindow AppListShower::GetWindow() { if (!IsAppListVisible()) return NULL; - return app_list_->GetWindow(); + return app_list_->GetWidget()->GetNativeWindow(); } void AppListShower::CreateViewForProfile(Profile* requested_profile) { profile_ = requested_profile; - app_list_.reset(factory_->CreateAppList( - profile_, - service_, - base::Bind(&AppListShower::DismissAppList, base::Unretained(this)))); + app_list_ = MakeViewForCurrentProfile(); + delegate_->OnViewCreated(); } void AppListShower::DismissAppList() { - if (app_list_ && can_close_app_list_) { - app_list_->Hide(); + if (HasView()) { + Hide(); + delegate_->OnViewDismissed(); keep_alive_.reset(); } } void AppListShower::HandleViewBeingDestroyed() { - app_list_.reset(); + app_list_ = NULL; profile_ = NULL; - can_close_app_list_ = true; // We may end up here as the result of the OS deleting the AppList's // widget (WidgetObserver::OnWidgetDestroyed). If this happens and there @@ -84,7 +88,7 @@ void AppListShower::HandleViewBeingDestroyed() { } bool AppListShower::IsAppListVisible() const { - return app_list_ && app_list_->IsVisible(); + return app_list_ && app_list_->GetWidget()->IsVisible(); } void AppListShower::WarmupForProfile(Profile* profile) { @@ -97,6 +101,38 @@ bool AppListShower::HasView() const { return !!app_list_; } +app_list::AppListView* AppListShower::MakeViewForCurrentProfile() { + // The view delegate will be owned by the app list view. The app list view + // manages its own lifetime. + AppListViewDelegate* view_delegate = new AppListViewDelegate( + profile_, delegate_->GetControllerDelegateForCreate()); + app_list::AppListView* view = new app_list::AppListView(view_delegate); + gfx::Point cursor = gfx::Screen::GetNativeScreen()->GetCursorScreenPoint(); + view->InitAsBubbleAtFixedLocation(NULL, + &pagination_model_, + cursor, + views::BubbleBorder::FLOAT, + false /* border_accepts_events */); + return view; +} + +void AppListShower::UpdateViewForNewProfile() { + app_list_->SetProfileByPath(profile_->GetPath()); +} + +void AppListShower::Show() { + app_list_->GetWidget()->Show(); + if (!window_icon_updated_) { + app_list_->GetWidget()->GetTopLevelWidget()->UpdateWindowIcon(); + window_icon_updated_ = true; + } + app_list_->GetWidget()->Activate(); +} + +void AppListShower::Hide() { + app_list_->GetWidget()->Hide(); +} + void AppListShower::ResetKeepAlive() { keep_alive_.reset(); } diff --git a/chrome/browser/ui/app_list/app_list_shower_views.h b/chrome/browser/ui/app_list/app_list_shower_views.h new file mode 100644 index 0000000..f574a2f --- /dev/null +++ b/chrome/browser/ui/app_list/app_list_shower_views.h @@ -0,0 +1,75 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_UI_APP_LIST_APP_LIST_SHOWER_VIEWS_H_ +#define CHROME_BROWSER_UI_APP_LIST_APP_LIST_SHOWER_VIEWS_H_ + +#include "base/memory/scoped_ptr.h" +#include "ui/app_list/pagination_model.h" +#include "ui/gfx/native_widget_types.h" + +namespace app_list { +class AppListView; +} + +class AppListShowerDelegate; +class AppListShowerUnitTest; +class Profile; +class ScopedKeepAlive; + +// Creates and shows an AppList as needed for non-Ash desktops. It is owned by +// AppListServiceViews. +class AppListShower { + public: + explicit AppListShower(AppListShowerDelegate* delegate); + virtual ~AppListShower(); + + void ShowForProfile(Profile* requested_profile); + gfx::NativeWindow GetWindow(); + + app_list::AppListView* app_list() { return app_list_; } + Profile* profile() const { return profile_; } + + // Create or recreate, and initialize |app_list_| from |requested_profile|. + void CreateViewForProfile(Profile* requested_profile); + + void DismissAppList(); + + // Virtual functions mocked out in tests. + virtual void HandleViewBeingDestroyed(); + virtual bool IsAppListVisible() const; + void WarmupForProfile(Profile* profile); + virtual bool HasView() const; + + protected: + virtual app_list::AppListView* MakeViewForCurrentProfile(); + virtual void UpdateViewForNewProfile(); + + // Shows the app list, activates it, and ensures the taskbar icon is updated. + virtual void Show(); + virtual void Hide(); + + private: + friend class ::AppListShowerUnitTest; + + void ResetKeepAlive(); + + AppListShowerDelegate* delegate_; // Weak. Owns this. + + // The profile currently shown by |app_list_|. + Profile* profile_; + + // The view, once created. Owned by native widget. + app_list::AppListView* app_list_; + + // Used to keep the browser process alive while the app list is visible. + scoped_ptr<ScopedKeepAlive> keep_alive_; + + bool window_icon_updated_; + app_list::PaginationModel pagination_model_; + + DISALLOW_COPY_AND_ASSIGN(AppListShower); +}; + +#endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SHOWER_VIEWS_H_ diff --git a/chrome/browser/ui/app_list/test/app_list_shower_unittest.cc b/chrome/browser/ui/app_list/app_list_shower_views_unittest.cc index 0174963..fb2f747 100644 --- a/chrome/browser/ui/app_list/test/app_list_shower_unittest.cc +++ b/chrome/browser/ui/app_list/app_list_shower_views_unittest.cc @@ -2,26 +2,38 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "chrome/browser/ui/app_list/app_list_shower_views.h" + #include "base/files/file_path.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/ui/app_list/app_list.h" -#include "chrome/browser/ui/app_list/app_list_factory.h" -#include "chrome/browser/ui/app_list/app_list_shower.h" +#include "chrome/browser/ui/app_list/app_list_shower_delegate.h" #include "chrome/browser/ui/app_list/scoped_keep_alive.h" #include "chrome/browser/ui/app_list/test/fake_profile.h" #include "testing/gtest/include/gtest/gtest.h" -class FakeAppList : public AppList { +namespace { + +class FakeAppListShower : public AppListShower { public: - explicit FakeAppList(Profile* profile) - : profile_(profile) { + explicit FakeAppListShower(AppListShowerDelegate* delegate) + : AppListShower(delegate), has_view_(false), visible_(false) {} + + // AppListShower: + virtual void HandleViewBeingDestroyed() OVERRIDE { + AppListShower::HandleViewBeingDestroyed(); + has_view_ = false; + visible_ = false; } - std::string profile_name() { - return profile_->GetProfileName(); + virtual bool IsAppListVisible() const OVERRIDE { return visible_; } + + virtual app_list::AppListView* MakeViewForCurrentProfile() OVERRIDE { + has_view_ = true; + return NULL; } - // AppList overrides. + virtual void UpdateViewForNewProfile() OVERRIDE {} + virtual void Show() OVERRIDE { visible_ = true; } @@ -30,54 +42,28 @@ class FakeAppList : public AppList { visible_ = false; } - virtual void MoveNearCursor() OVERRIDE { + virtual bool HasView() const OVERRIDE { + return has_view_; } - virtual bool IsVisible() OVERRIDE { - return visible_; - } - - virtual void Prerender() OVERRIDE { - prerendered_ = true; - } - - virtual gfx::NativeWindow GetWindow() OVERRIDE { - return NULL; - } - - virtual void SetProfile(Profile* profile) OVERRIDE { - profile_ = profile; - } - - Profile* profile_; + private: + bool has_view_; bool visible_; - bool prerendered_; -}; - -class FakeFactory : public AppListFactory { - public: - FakeFactory() - : views_created_(0) { - } - - virtual AppList* CreateAppList( - Profile* profile, - AppListService* service, - const base::Closure& on_should_dismiss) OVERRIDE { - views_created_++; - return new FakeAppList(profile); - } - int views_created_; + DISALLOW_COPY_AND_ASSIGN(FakeAppListShower); }; -class AppListShowerUnitTest : public testing::Test { +} // namespace + +class AppListShowerUnitTest : public testing::Test, + public AppListShowerDelegate { public: + AppListShowerUnitTest() + : views_created_(0), + views_dismissed_(0) {} + virtual void SetUp() OVERRIDE { - factory_ = new FakeFactory; - shower_.reset( - new AppListShower(scoped_ptr<AppListFactory>(factory_), - NULL /* service */)); + shower_.reset(new FakeAppListShower(this)); profile1_ = CreateProfile("p1").Pass(); profile2_ = CreateProfile("p2").Pass(); } @@ -89,19 +75,26 @@ class AppListShowerUnitTest : public testing::Test { return make_scoped_ptr(new FakeProfile(name)); } - FakeAppList* GetCurrentAppList() { - return static_cast<FakeAppList*>(shower_->app_list()); + // AppListCreatorDelegate: + virtual AppListControllerDelegate* GetControllerDelegateForCreate() OVERRIDE { + return NULL; } bool HasKeepAlive() const { return shower_->keep_alive_.get() != NULL; } - // Owned by |shower_|. - FakeFactory* factory_; - scoped_ptr<AppListShower> shower_; + virtual void OnViewCreated() OVERRIDE { ++views_created_; } + virtual void OnViewDismissed() OVERRIDE { ++views_dismissed_; } + virtual void MoveNearCursor(app_list::AppListView* view) OVERRIDE {} + + protected: + scoped_ptr<FakeAppListShower> shower_; scoped_ptr<FakeProfile> profile1_; scoped_ptr<FakeProfile> profile2_; + + int views_created_; + int views_dismissed_; }; TEST_F(AppListShowerUnitTest, Preconditions) { @@ -126,17 +119,23 @@ TEST_F(AppListShowerUnitTest, HidingViewRemovesKeepalive) { } TEST_F(AppListShowerUnitTest, HideAndShowReusesView) { + EXPECT_EQ(0, views_created_); shower_->ShowForProfile(profile1_.get()); + EXPECT_EQ(1, views_created_); + EXPECT_EQ(0, views_dismissed_); shower_->DismissAppList(); + EXPECT_EQ(1, views_dismissed_); shower_->ShowForProfile(profile1_.get()); - EXPECT_EQ(1, factory_->views_created_); + EXPECT_EQ(1, views_created_); } TEST_F(AppListShowerUnitTest, CloseAndShowRecreatesView) { shower_->ShowForProfile(profile1_.get()); shower_->HandleViewBeingDestroyed(); + // Destroying implies hiding. A separate notification shouldn't go out. + EXPECT_EQ(0, views_dismissed_); shower_->ShowForProfile(profile1_.get()); - EXPECT_EQ(2, factory_->views_created_); + EXPECT_EQ(2, views_created_); } TEST_F(AppListShowerUnitTest, CloseRemovesView) { @@ -157,10 +156,11 @@ TEST_F(AppListShowerUnitTest, CloseAppListClearsProfile) { TEST_F(AppListShowerUnitTest, SwitchingProfiles) { shower_->ShowForProfile(profile1_.get()); - EXPECT_EQ("p1", GetCurrentAppList()->profile_name()); + EXPECT_EQ("p1", shower_->profile()->GetProfileName()); shower_->ShowForProfile(profile2_.get()); - EXPECT_EQ("p2", GetCurrentAppList()->profile_name()); + EXPECT_EQ("p2", shower_->profile()->GetProfileName()); // Shouldn't create new view for second profile - it should switch in place. - EXPECT_EQ(1, factory_->views_created_); + EXPECT_EQ(1, views_created_); + EXPECT_EQ(0, views_dismissed_); } diff --git a/chrome/browser/ui/views/app_list/linux/app_list_controller_delegate_linux.cc b/chrome/browser/ui/views/app_list/linux/app_list_controller_delegate_linux.cc deleted file mode 100644 index e3ed29a..0000000 --- a/chrome/browser/ui/views/app_list/linux/app_list_controller_delegate_linux.cc +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/ui/views/app_list/linux/app_list_controller_delegate_linux.h" - -#include "chrome/browser/ui/views/app_list/linux/app_list_service_linux.h" - -AppListControllerDelegateLinux::AppListControllerDelegateLinux( - AppListServiceLinux* service) - : AppListControllerDelegateImpl(service), - service_(service) { -} - -AppListControllerDelegateLinux::~AppListControllerDelegateLinux() {} - -void AppListControllerDelegateLinux::ViewClosing() { - service_->OnViewBeingDestroyed(); -} - -void AppListControllerDelegateLinux::OnShowExtensionPrompt() { - service_->set_can_close(false); -} - -void AppListControllerDelegateLinux::OnCloseExtensionPrompt() { - service_->set_can_close(true); -} - -bool AppListControllerDelegateLinux::CanDoCreateShortcutsFlow() { - return true; -} diff --git a/chrome/browser/ui/views/app_list/linux/app_list_controller_delegate_linux.h b/chrome/browser/ui/views/app_list/linux/app_list_controller_delegate_linux.h deleted file mode 100644 index 2235aa6..0000000 --- a/chrome/browser/ui/views/app_list/linux/app_list_controller_delegate_linux.h +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_UI_VIEWS_APP_LIST_LINUX_APP_LIST_CONTROLLER_DELEGATE_LINUX_H_ -#define CHROME_BROWSER_UI_VIEWS_APP_LIST_LINUX_APP_LIST_CONTROLLER_DELEGATE_LINUX_H_ - -#include "base/files/file_path.h" -#include "chrome/browser/ui/app_list/app_list_controller_delegate_impl.h" -#include "ui/gfx/image/image_skia.h" -#include "ui/gfx/native_widget_types.h" - -class AppListServiceLinux; -class Profile; - -namespace extensions { -class Extension; -} - -// Linux-specific configuration and behaviour for the AppList. -class AppListControllerDelegateLinux : public AppListControllerDelegateImpl { - public: - explicit AppListControllerDelegateLinux(AppListServiceLinux* service); - virtual ~AppListControllerDelegateLinux(); - - // AppListControllerDelegate overrides: - virtual void ViewClosing() OVERRIDE; - virtual void OnShowExtensionPrompt() OVERRIDE; - virtual void OnCloseExtensionPrompt() OVERRIDE; - virtual bool CanDoCreateShortcutsFlow() OVERRIDE; - - private: - AppListServiceLinux* service_; - - DISALLOW_COPY_AND_ASSIGN(AppListControllerDelegateLinux); -}; - -#endif // CHROME_BROWSER_UI_VIEWS_APP_LIST_LINUX_APP_LIST_CONTROLLER_DELEGATE_LINUX_H_ diff --git a/chrome/browser/ui/views/app_list/linux/app_list_linux.cc b/chrome/browser/ui/views/app_list/linux/app_list_linux.cc index 71374c9..278d374 100644 --- a/chrome/browser/ui/views/app_list/linux/app_list_linux.cc +++ b/chrome/browser/ui/views/app_list/linux/app_list_linux.cc @@ -4,30 +4,12 @@ #include "chrome/browser/ui/views/app_list/linux/app_list_linux.h" -#include "base/command_line.h" -#include "base/location.h" -#include "base/single_thread_task_runner.h" -#include "base/thread_task_runner_handle.h" -#include "chrome/browser/profiles/profile.h" -#include "chrome/browser/ui/app_list/app_list_positioner.h" #include "ui/app_list/app_list_switches.h" #include "ui/app_list/views/app_list_view.h" #include "ui/gfx/screen.h" #include "ui/views/linux_ui/linux_ui.h" #include "ui/views/widget/widget.h" -AppListLinux::AppListLinux(app_list::AppListView* view, - const base::Closure& on_should_dismiss) - : view_(view), - window_icon_updated_(false), - on_should_dismiss_(on_should_dismiss) { - view_->AddObserver(this); -} - -AppListLinux::~AppListLinux() { - view_->RemoveObserver(this); -} - // static AppListPositioner::ScreenEdge AppListLinux::ShelfLocationInDisplay( const gfx::Display& display) { @@ -98,26 +80,14 @@ gfx::Point AppListLinux::FindAnchorPoint(const gfx::Size& view_size, return positioner.GetAnchorPointForShelfCursor(edge, cursor); } -void AppListLinux::Show() { - view_->GetWidget()->Show(); - if (!window_icon_updated_) { - view_->GetWidget()->GetTopLevelWidget()->UpdateWindowIcon(); - window_icon_updated_ = true; - } - view_->GetWidget()->Activate(); -} - -void AppListLinux::Hide() { - view_->GetWidget()->Hide(); -} - -void AppListLinux::MoveNearCursor() { +// static +void AppListLinux::MoveNearCursor(app_list::AppListView* view) { gfx::Point cursor = gfx::Screen::GetNativeScreen()->GetCursorScreenPoint(); gfx::Screen* screen = - gfx::Screen::GetScreenFor(view_->GetWidget()->GetNativeView()); + gfx::Screen::GetScreenFor(view->GetWidget()->GetNativeView()); gfx::Display display = screen->GetDisplayNearestPoint(cursor); - view_->SetBubbleArrow(views::BubbleBorder::FLOAT); + view->SetBubbleArrow(views::BubbleBorder::FLOAT); // In the Unity desktop environment, special case SCREEN_EDGE_LEFT. It is // always on the left side in Unity, but ShelfLocationInDisplay will not @@ -131,32 +101,6 @@ void AppListLinux::MoveNearCursor() { edge = AppListPositioner::SCREEN_EDGE_LEFT; else edge = ShelfLocationInDisplay(display); - view_->SetAnchorPoint( - FindAnchorPoint(view_->GetPreferredSize(), display, cursor, edge)); -} - -bool AppListLinux::IsVisible() { - return view_->GetWidget()->IsVisible(); -} - -void AppListLinux::Prerender() { - view_->Prerender(); -} - -gfx::NativeWindow AppListLinux::GetWindow() { - return view_->GetWidget()->GetNativeWindow(); -} - -void AppListLinux::SetProfile(Profile* profile) { - view_->SetProfileByPath(profile->GetPath()); -} - -void AppListLinux::OnActivationChanged( - views::Widget* /*widget*/, bool active) { - if (active) - return; - - // Call |on_should_dismiss_| asynchronously. This must be done asynchronously - // or our caller will crash, as it expects the app list to remain alive. - base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, on_should_dismiss_); + view->SetAnchorPoint( + FindAnchorPoint(view->GetPreferredSize(), display, cursor, edge)); } diff --git a/chrome/browser/ui/views/app_list/linux/app_list_linux.h b/chrome/browser/ui/views/app_list/linux/app_list_linux.h index 68046d3..e12d2c6 100644 --- a/chrome/browser/ui/views/app_list/linux/app_list_linux.h +++ b/chrome/browser/ui/views/app_list/linux/app_list_linux.h @@ -5,10 +5,7 @@ #ifndef CHROME_BROWSER_UI_VIEWS_APP_LIST_LINUX_APP_LIST_LINUX_H_ #define CHROME_BROWSER_UI_VIEWS_APP_LIST_LINUX_APP_LIST_LINUX_H_ -#include "base/callback.h" -#include "chrome/browser/ui/app_list/app_list.h" #include "chrome/browser/ui/app_list/app_list_positioner.h" -#include "ui/app_list/views/app_list_view_observer.h" namespace app_list { class AppListView; @@ -20,16 +17,10 @@ class Point; class Size; } // namespace gfx -// Responsible for positioning, hiding and showing an AppListView on Linux. -// This includes watching window activation/deactivation messages to determine -// if the user has clicked away from it. -class AppListLinux : public AppList, - public app_list::AppListViewObserver { +// Responsible for positioning an AppListView on Linux. +// TODO(tapted): Shouldn't be a class - move the static member functions out. +class AppListLinux { public: - AppListLinux(app_list::AppListView* view, - const base::Closure& on_should_dismiss); - virtual ~AppListLinux(); - // Determines which screen edge the shelf is aligned to. This tries to find // the edge of the surface where the user normally launches apps from (so, for // example, on Gnome Classic, this is the applications menu, not the taskbar). @@ -46,27 +37,7 @@ class AppListLinux : public AppList, const gfx::Point& cursor, AppListPositioner::ScreenEdge edge); - // AppList: - virtual void Show() OVERRIDE; - virtual void Hide() OVERRIDE; - virtual void MoveNearCursor() OVERRIDE; - virtual bool IsVisible() OVERRIDE; - virtual void Prerender() OVERRIDE; - virtual gfx::NativeWindow GetWindow() OVERRIDE; - virtual void SetProfile(Profile* profile) OVERRIDE; - - // app_list::AppListViewObserver: - virtual void OnActivationChanged(views::Widget* widget, bool active) OVERRIDE; - - private: - // Weak pointer. The view manages its own lifetime. - app_list::AppListView* view_; - bool window_icon_updated_; - - // Called to request |view_| be closed. - base::Closure on_should_dismiss_; - - DISALLOW_COPY_AND_ASSIGN(AppListLinux); + static void MoveNearCursor(app_list::AppListView* view); }; #endif // CHROME_BROWSER_UI_VIEWS_APP_LIST_LINUX_APP_LIST_LINUX_H_ diff --git a/chrome/browser/ui/views/app_list/linux/app_list_linux_unittest.cc b/chrome/browser/ui/views/app_list/linux/app_list_linux_unittest.cc index a701353..aa4c871 100644 --- a/chrome/browser/ui/views/app_list/linux/app_list_linux_unittest.cc +++ b/chrome/browser/ui/views/app_list/linux/app_list_linux_unittest.cc @@ -4,6 +4,7 @@ #include "chrome/browser/ui/views/app_list/linux/app_list_linux.h" +#include "base/logging.h" #include "chrome/browser/ui/app_list/app_list_positioner.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/gfx/display.h" diff --git a/chrome/browser/ui/views/app_list/linux/app_list_service_linux.cc b/chrome/browser/ui/views/app_list/linux/app_list_service_linux.cc index 16b19ce..d6e0f86 100644 --- a/chrome/browser/ui/views/app_list/linux/app_list_service_linux.cc +++ b/chrome/browser/ui/views/app_list/linux/app_list_service_linux.cc @@ -5,14 +5,11 @@ #include "chrome/browser/ui/views/app_list/linux/app_list_service_linux.h" #include "base/memory/singleton.h" +#include "base/thread_task_runner_handle.h" #include "chrome/browser/shell_integration.h" #include "chrome/browser/shell_integration_linux.h" -#include "chrome/browser/ui/app_list/app_list_controller_delegate.h" -#include "chrome/browser/ui/app_list/app_list_factory.h" -#include "chrome/browser/ui/app_list/app_list_shower.h" -#include "chrome/browser/ui/app_list/app_list_view_delegate.h" -#include "chrome/browser/ui/app_list/scoped_keep_alive.h" -#include "chrome/browser/ui/views/app_list/linux/app_list_controller_delegate_linux.h" +#include "chrome/browser/ui/app_list/app_list_controller_delegate_views.h" +#include "chrome/browser/ui/app_list/app_list_shower_views.h" #include "chrome/browser/ui/views/app_list/linux/app_list_linux.h" #include "content/public/browser/browser_thread.h" #include "grit/chromium_strings.h" @@ -20,42 +17,9 @@ #include "ui/app_list/app_list_constants.h" #include "ui/app_list/views/app_list_view.h" #include "ui/base/l10n/l10n_util.h" -#include "ui/gfx/screen.h" namespace { -class AppListFactoryLinux : public AppListFactory { - public: - explicit AppListFactoryLinux(AppListServiceLinux* service) - : service_(service) {} - virtual ~AppListFactoryLinux() {} - - virtual AppList* CreateAppList( - Profile* profile, - AppListService* service, - const base::Closure& on_should_dismiss) OVERRIDE { - // The view delegate will be owned by the app list view. The app list view - // manages it's own lifetime. - AppListViewDelegate* view_delegate = new AppListViewDelegate( - profile, service->GetControllerDelegate()); - app_list::AppListView* view = new app_list::AppListView(view_delegate); - gfx::Point cursor = gfx::Screen::GetNativeScreen()->GetCursorScreenPoint(); - view->InitAsBubbleAtFixedLocation(NULL, - &pagination_model_, - cursor, - views::BubbleBorder::FLOAT, - false /* border_accepts_events */); - return new AppListLinux(view, on_should_dismiss); - } - - private: - // PaginationModel that is shared across all views. - app_list::PaginationModel pagination_model_; - AppListServiceLinux* service_; - - DISALLOW_COPY_AND_ASSIGN(AppListFactoryLinux); -}; - void CreateShortcuts() { std::string app_list_title = l10n_util::GetStringUTF8(IDS_APP_LIST_SHORTCUT_NAME); @@ -77,65 +41,40 @@ AppListServiceLinux* AppListServiceLinux::GetInstance() { LeakySingletonTraits<AppListServiceLinux> >::get(); } -void AppListServiceLinux::set_can_close(bool can_close) { - shower_->set_can_close(can_close); -} - -void AppListServiceLinux::OnViewBeingDestroyed() { - shower_->HandleViewBeingDestroyed(); -} - -void AppListServiceLinux::Init(Profile* initial_profile) { - PerformStartupChecks(initial_profile); -} - -void AppListServiceLinux::CreateForProfile(Profile* requested_profile) { - shower_->CreateViewForProfile(requested_profile); +void AppListServiceLinux::CreateShortcut() { + content::BrowserThread::PostTask( + content::BrowserThread::FILE, FROM_HERE, base::Bind(&CreateShortcuts)); } -void AppListServiceLinux::ShowForProfile(Profile* requested_profile) { - DCHECK(requested_profile); - if (requested_profile->IsManaged()) +void AppListServiceLinux::OnActivationChanged(views::Widget* /*widget*/, + bool active) { + if (active) return; - ScopedKeepAlive keep_alive; - - InvalidatePendingProfileLoads(); - SetProfilePath(requested_profile->GetPath()); - shower_->ShowForProfile(requested_profile); - RecordAppListLaunch(); -} - -void AppListServiceLinux::DismissAppList() { - shower_->DismissAppList(); + // Dismiss the app list asynchronously. This must be done asynchronously + // or our caller will crash, as it expects the app list to remain alive. + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, + base::Bind(&AppListServiceLinux::DismissAppList, base::Unretained(this))); } -bool AppListServiceLinux::IsAppListVisible() const { - return shower_->IsAppListVisible(); -} - -gfx::NativeWindow AppListServiceLinux::GetAppListWindow() { - return shower_->GetWindow(); -} +AppListServiceLinux::AppListServiceLinux() + : AppListServiceViews(scoped_ptr<AppListControllerDelegate>( + new AppListControllerDelegateViews(this))) {} -Profile* AppListServiceLinux::GetCurrentAppListProfile() { - return shower_->profile(); +void AppListServiceLinux::OnViewCreated() { + shower().app_list()->AddObserver(this); } -AppListControllerDelegate* AppListServiceLinux::GetControllerDelegate() { - return controller_delegate_.get(); +void AppListServiceLinux::OnViewBeingDestroyed() { + shower().app_list()->RemoveObserver(this); } -void AppListServiceLinux::CreateShortcut() { - content::BrowserThread::PostTask( - content::BrowserThread::FILE, FROM_HERE, base::Bind(&CreateShortcuts)); +void AppListServiceLinux::OnViewDismissed() { } -AppListServiceLinux::AppListServiceLinux() - : shower_(new AppListShower( - scoped_ptr<AppListFactory>(new AppListFactoryLinux(this)), - this)), - controller_delegate_(new AppListControllerDelegateLinux(this)) { +void AppListServiceLinux::MoveNearCursor(app_list::AppListView* view) { + AppListLinux::MoveNearCursor(view); } // static diff --git a/chrome/browser/ui/views/app_list/linux/app_list_service_linux.h b/chrome/browser/ui/views/app_list/linux/app_list_service_linux.h index 81a2046..1dc35f2 100644 --- a/chrome/browser/ui/views/app_list/linux/app_list_service_linux.h +++ b/chrome/browser/ui/views/app_list/linux/app_list_service_linux.h @@ -5,44 +5,36 @@ #ifndef CHROME_BROWSER_UI_VIEWS_APP_LIST_LINUX_APP_LIST_SERVICE_LINUX_H_ #define CHROME_BROWSER_UI_VIEWS_APP_LIST_LINUX_APP_LIST_SERVICE_LINUX_H_ -#include "base/memory/scoped_ptr.h" -#include "chrome/browser/ui/app_list/app_list_service_impl.h" +#include "chrome/browser/ui/app_list/app_list_service_views.h" +#include "ui/app_list/views/app_list_view_observer.h" template <typename T> struct DefaultSingletonTraits; -class AppListShower; - // AppListServiceLinux manages global resources needed for the app list to // operate, and controls when the app list is opened and closed. -class AppListServiceLinux : public AppListServiceImpl { +class AppListServiceLinux : public AppListServiceViews, + public app_list::AppListViewObserver { public: virtual ~AppListServiceLinux(); static AppListServiceLinux* GetInstance(); - void set_can_close(bool can_close); - void OnViewBeingDestroyed(); - - // AppListService overrides: - virtual void Init(Profile* initial_profile) OVERRIDE; - virtual void CreateForProfile(Profile* requested_profile) OVERRIDE; - virtual void ShowForProfile(Profile* requested_profile) OVERRIDE; - virtual void DismissAppList() OVERRIDE; - virtual bool IsAppListVisible() const OVERRIDE; - virtual gfx::NativeWindow GetAppListWindow() OVERRIDE; - virtual Profile* GetCurrentAppListProfile() OVERRIDE; - virtual AppListControllerDelegate* GetControllerDelegate() OVERRIDE; // AppListServiceImpl overrides: virtual void CreateShortcut() OVERRIDE; + // app_list::AppListViewObserver overrides: + virtual void OnActivationChanged(views::Widget* widget, bool active) OVERRIDE; + private: friend struct DefaultSingletonTraits<AppListServiceLinux>; - AppListServiceLinux(); + // AppListShowerDelegate overrides: + virtual void OnViewCreated() OVERRIDE; + virtual void OnViewBeingDestroyed() OVERRIDE; + virtual void OnViewDismissed() OVERRIDE; + virtual void MoveNearCursor(app_list::AppListView* view) OVERRIDE; - // Responsible for putting views on the screen. - scoped_ptr<AppListShower> shower_; - scoped_ptr<AppListControllerDelegate> controller_delegate_; + AppListServiceLinux(); DISALLOW_COPY_AND_ASSIGN(AppListServiceLinux); }; diff --git a/chrome/browser/ui/views/app_list/win/activation_tracker_win.cc b/chrome/browser/ui/views/app_list/win/activation_tracker_win.cc index 932fc7e..f4ab2fe 100644 --- a/chrome/browser/ui/views/app_list/win/activation_tracker_win.cc +++ b/chrome/browser/ui/views/app_list/win/activation_tracker_win.cc @@ -5,6 +5,8 @@ #include "chrome/browser/ui/views/app_list/win/activation_tracker_win.h" #include "base/time/time.h" +#include "chrome/browser/ui/app_list/app_list_shower_views.h" +#include "chrome/browser/ui/views/app_list/win/app_list_service_win.h" #include "ui/app_list/views/app_list_view.h" #include "ui/views/widget/widget.h" @@ -16,17 +18,15 @@ const int kFocusCheckIntervalMS = 250; } // namespace -ActivationTrackerWin::ActivationTrackerWin( - app_list::AppListView* view, - const base::Closure& on_should_dismiss) - : view_(view), - on_should_dismiss_(on_should_dismiss), +ActivationTrackerWin::ActivationTrackerWin(AppListServiceWin* service) + : service_(service), taskbar_has_focus_(false) { - view_->AddObserver(this); + service_->shower().app_list()->AddObserver(this); } ActivationTrackerWin::~ActivationTrackerWin() { - view_->RemoveObserver(this); + DCHECK(service_->shower().app_list()); + service_->shower().app_list()->RemoveObserver(this); timer_.Stop(); } @@ -51,7 +51,7 @@ void ActivationTrackerWin::MaybeDismissAppList() { if (!ShouldDismissAppList()) return; - on_should_dismiss_.Run(); + service_->DismissAppList(); } bool ActivationTrackerWin::ShouldDismissAppList() { @@ -92,7 +92,8 @@ bool ActivationTrackerWin::ShouldDismissAppList() { while (focused_hwnd) { // If the focused window is the right click menu (called a jump list) or // the app list, don't hide the launcher. - if (focused_hwnd == jump_list_hwnd || focused_hwnd == view_->GetHWND()) + HWND app_list_hwnd = service_->shower().app_list()->GetHWND(); + if (focused_hwnd == jump_list_hwnd || focused_hwnd == app_list_hwnd) return false; if (focused_hwnd == taskbar_hwnd) { diff --git a/chrome/browser/ui/views/app_list/win/activation_tracker_win.h b/chrome/browser/ui/views/app_list/win/activation_tracker_win.h index e347624..1fed8d4 100644 --- a/chrome/browser/ui/views/app_list/win/activation_tracker_win.h +++ b/chrome/browser/ui/views/app_list/win/activation_tracker_win.h @@ -5,20 +5,16 @@ #ifndef CHROME_BROWSER_UI_VIEWS_APP_LIST_WIN_ACTIVATION_TRACKER_WIN_H_ #define CHROME_BROWSER_UI_VIEWS_APP_LIST_WIN_ACTIVATION_TRACKER_WIN_H_ -#include "base/basictypes.h" -#include "base/callback.h" +#include "base/macros.h" #include "base/timer/timer.h" #include "ui/app_list/views/app_list_view_observer.h" -namespace app_list { -class AppListView; -} +class AppListServiceWin; // Periodically checks to see if an AppListView has lost focus using a timer. class ActivationTrackerWin : public app_list::AppListViewObserver { public: - ActivationTrackerWin(app_list::AppListView* view, - const base::Closure& on_should_dismiss); + explicit ActivationTrackerWin(AppListServiceWin* service); ~ActivationTrackerWin(); // app_list::AppListViewObserver: @@ -37,11 +33,7 @@ class ActivationTrackerWin : public app_list::AppListViewObserver { // app list). bool ShouldDismissAppList(); - // The window to track the active state of. - app_list::AppListView* view_; - - // Called to request |view_| be closed. - base::Closure on_should_dismiss_; + AppListServiceWin* service_; // Weak. Owns this. // Records whether, on the previous timer tick, the taskbar had focus without // the right mouse button being down. We allow the taskbar to have focus for diff --git a/chrome/browser/ui/views/app_list/win/app_list_controller_delegate_win.cc b/chrome/browser/ui/views/app_list/win/app_list_controller_delegate_win.cc index 222f4c7..4b21517 100644 --- a/chrome/browser/ui/views/app_list/win/app_list_controller_delegate_win.cc +++ b/chrome/browser/ui/views/app_list/win/app_list_controller_delegate_win.cc @@ -7,17 +7,15 @@ #include "apps/app_window.h" #include "apps/app_window_registry.h" #include "chrome/browser/metro_utils/metro_chrome_win.h" +#include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/app_list/app_list_icon_win.h" #include "chrome/browser/ui/extensions/application_launch.h" #include "chrome/browser/ui/host_desktop.h" -#include "chrome/browser/ui/views/app_list/win/app_list_service_win.h" -#include "extensions/common/extension.h" #include "ui/base/resource/resource_bundle.h" AppListControllerDelegateWin::AppListControllerDelegateWin( - AppListServiceWin* service) - : AppListControllerDelegateImpl(service), - service_(service) {} + AppListServiceViews* service) + : AppListControllerDelegateViews(service) {} AppListControllerDelegateWin::~AppListControllerDelegateWin() {} @@ -25,28 +23,12 @@ bool AppListControllerDelegateWin::ForceNativeDesktop() const { return true; } -void AppListControllerDelegateWin::ViewClosing() { - service_->OnViewBeingDestroyed(); -} - gfx::ImageSkia AppListControllerDelegateWin::GetWindowIcon() { gfx::ImageSkia* resource = ResourceBundle::GetSharedInstance(). GetImageSkiaNamed(GetAppListIconResourceId()); return *resource; } -void AppListControllerDelegateWin::OnShowExtensionPrompt() { - service_->set_can_close(false); -} - -void AppListControllerDelegateWin::OnCloseExtensionPrompt() { - service_->set_can_close(true); -} - -bool AppListControllerDelegateWin::CanDoCreateShortcutsFlow() { - return true; -} - void AppListControllerDelegateWin::FillLaunchParams(AppLaunchParams* params) { params->desktop_type = chrome::HOST_DESKTOP_TYPE_NATIVE; apps::AppWindow* any_existing_window = diff --git a/chrome/browser/ui/views/app_list/win/app_list_controller_delegate_win.h b/chrome/browser/ui/views/app_list/win/app_list_controller_delegate_win.h index c67cb57..34d42e9 100644 --- a/chrome/browser/ui/views/app_list/win/app_list_controller_delegate_win.h +++ b/chrome/browser/ui/views/app_list/win/app_list_controller_delegate_win.h @@ -5,38 +5,22 @@ #ifndef CHROME_BROWSER_UI_VIEWS_APP_LIST_WIN_APP_LIST_CONTROLLER_DELEGATE_WIN_H_ #define CHROME_BROWSER_UI_VIEWS_APP_LIST_WIN_APP_LIST_CONTROLLER_DELEGATE_WIN_H_ -#include "base/files/file_path.h" -#include "chrome/browser/ui/app_list/app_list_controller_delegate_impl.h" -#include "ui/gfx/image/image_skia.h" -#include "ui/gfx/native_widget_types.h" - -class AppListServiceWin; -class Profile; - -namespace extensions { -class Extension; -} +#include "chrome/browser/ui/app_list/app_list_controller_delegate_views.h" // Windows specific configuration and behaviour for the AppList. -class AppListControllerDelegateWin : public AppListControllerDelegateImpl { +class AppListControllerDelegateWin : public AppListControllerDelegateViews { public: - explicit AppListControllerDelegateWin(AppListServiceWin* service); + explicit AppListControllerDelegateWin(AppListServiceViews* service); virtual ~AppListControllerDelegateWin(); // AppListControllerDelegate overrides: virtual bool ForceNativeDesktop() const OVERRIDE; - virtual void ViewClosing() OVERRIDE; virtual gfx::ImageSkia GetWindowIcon() OVERRIDE; - virtual void OnShowExtensionPrompt() OVERRIDE; - virtual void OnCloseExtensionPrompt() OVERRIDE; - virtual bool CanDoCreateShortcutsFlow() OVERRIDE; private: // AppListcontrollerDelegateImpl: virtual void FillLaunchParams(AppLaunchParams* params) OVERRIDE; - AppListServiceWin* service_; - DISALLOW_COPY_AND_ASSIGN(AppListControllerDelegateWin); }; diff --git a/chrome/browser/ui/views/app_list/win/app_list_service_win.cc b/chrome/browser/ui/views/app_list/win/app_list_service_win.cc index f5ac4fc..b213b93 100644 --- a/chrome/browser/ui/views/app_list/win/app_list_service_win.cc +++ b/chrome/browser/ui/views/app_list/win/app_list_service_win.cc @@ -26,12 +26,6 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/shell_integration.h" -#include "chrome/browser/ui/app_list/app_list.h" -#include "chrome/browser/ui/app_list/app_list_controller_delegate.h" -#include "chrome/browser/ui/app_list/app_list_factory.h" -#include "chrome/browser/ui/app_list/app_list_shower.h" -#include "chrome/browser/ui/app_list/app_list_view_delegate.h" -#include "chrome/browser/ui/app_list/scoped_keep_alive.h" #include "chrome/browser/ui/ash/app_list/app_list_service_ash.h" #include "chrome/browser/ui/views/app_list/win/activation_tracker_win.h" #include "chrome/browser/ui/views/app_list/win/app_list_controller_delegate_win.h" @@ -47,7 +41,6 @@ #include "content/public/browser/browser_thread.h" #include "ui/app_list/views/app_list_view.h" #include "ui/base/win/shell.h" -#include "ui/gfx/screen.h" // static AppListService* AppListService::Get(chrome::HostDesktopType desktop_type) { @@ -249,43 +242,6 @@ void SetWindowAttributes(HWND hwnd) { ui::win::SetAppIconForWindow(icon_path, hwnd); } -class AppListFactoryWin : public AppListFactory { - public: - explicit AppListFactoryWin(AppListServiceWin* service) - : service_(service) { - } - - virtual ~AppListFactoryWin() { - } - - virtual AppList* CreateAppList( - Profile* profile, - AppListService* service, - const base::Closure& on_should_dismiss) OVERRIDE { - // The view delegate will be owned by the app list view. The app list view - // manages it's own lifetime. - AppListViewDelegate* view_delegate = - new AppListViewDelegate(profile, - service->GetControllerDelegate()); - app_list::AppListView* view = new app_list::AppListView(view_delegate); - gfx::Point cursor = gfx::Screen::GetNativeScreen()->GetCursorScreenPoint(); - view->InitAsBubbleAtFixedLocation(NULL, - &pagination_model_, - cursor, - views::BubbleBorder::FLOAT, - false /* border_accepts_events */); - SetWindowAttributes(view->GetHWND()); - return new AppListWin(view, on_should_dismiss); - } - - private: - // PaginationModel that is shared across all views. - app_list::PaginationModel pagination_model_; - AppListServiceWin* service_; - - DISALLOW_COPY_AND_ASSIGN(AppListFactoryWin); -}; - } // namespace // static @@ -295,54 +251,18 @@ AppListServiceWin* AppListServiceWin::GetInstance() { } AppListServiceWin::AppListServiceWin() - : enable_app_list_on_next_init_(false), - shower_(new AppListShower( - scoped_ptr<AppListFactory>(new AppListFactoryWin(this)), - this)), - controller_delegate_(new AppListControllerDelegateWin(this)) { + : AppListServiceViews(scoped_ptr<AppListControllerDelegate>( + new AppListControllerDelegateWin(this))), + enable_app_list_on_next_init_(false) { } AppListServiceWin::~AppListServiceWin() { } -void AppListServiceWin::set_can_close(bool can_close) { - shower_->set_can_close(can_close); -} - -gfx::NativeWindow AppListServiceWin::GetAppListWindow() { - return shower_->GetWindow(); -} - -Profile* AppListServiceWin::GetCurrentAppListProfile() { - return shower_->profile(); -} - -AppListControllerDelegate* AppListServiceWin::GetControllerDelegate() { - return controller_delegate_.get(); -} - void AppListServiceWin::ShowForProfile(Profile* requested_profile) { - DCHECK(requested_profile); - if (requested_profile->IsManaged()) - return; - - ScopedKeepAlive keep_alive; - + AppListServiceViews::ShowForProfile(requested_profile); content::BrowserThread::PostBlockingPoolTask( FROM_HERE, base::Bind(SetDidRunForNDayActiveStats)); - - InvalidatePendingProfileLoads(); - SetProfilePath(requested_profile->GetPath()); - shower_->ShowForProfile(requested_profile); - RecordAppListLaunch(); -} - -void AppListServiceWin::DismissAppList() { - shower_->DismissAppList(); -} - -void AppListServiceWin::OnViewBeingDestroyed() { - shower_->HandleViewBeingDestroyed(); } void AppListServiceWin::OnLoadProfileForWarmup(Profile* initial_profile) { @@ -350,7 +270,7 @@ void AppListServiceWin::OnLoadProfileForWarmup(Profile* initial_profile) { return; base::Time before_warmup(base::Time::Now()); - shower_->WarmupForProfile(initial_profile); + shower().WarmupForProfile(initial_profile); UMA_HISTOGRAM_TIMES("Apps.AppListWarmupDuration", base::Time::Now() - before_warmup); } @@ -380,15 +300,7 @@ void AppListServiceWin::Init(Profile* initial_profile) { ScheduleWarmup(); MigrateAppLauncherEnabledPref(); - PerformStartupChecks(initial_profile); -} - -void AppListServiceWin::CreateForProfile(Profile* profile) { - shower_->CreateViewForProfile(profile); -} - -bool AppListServiceWin::IsAppListVisible() const { - return shower_->IsAppListVisible(); + AppListServiceViews::Init(initial_profile); } void AppListServiceWin::CreateShortcut() { @@ -430,7 +342,7 @@ bool AppListServiceWin::IsWarmupNeeded() { // We only need to initialize the view if there's no view already created and // there's no profile loading to be shown. - return !shower_->HasView() && !profile_loader().IsAnyProfileLoading(); + return !shower().HasView() && !profile_loader().IsAnyProfileLoading(); } void AppListServiceWin::LoadProfileForWarmup() { @@ -445,3 +357,21 @@ void AppListServiceWin::LoadProfileForWarmup() { base::Bind(&AppListServiceWin::OnLoadProfileForWarmup, base::Unretained(this))); } + +void AppListServiceWin::OnViewBeingDestroyed() { + activation_tracker_.reset(); + AppListServiceViews::OnViewBeingDestroyed(); +} + +void AppListServiceWin::OnViewCreated() { + SetWindowAttributes(shower().app_list()->GetHWND()); + activation_tracker_.reset(new ActivationTrackerWin(this)); +} + +void AppListServiceWin::OnViewDismissed() { + activation_tracker_->OnViewHidden(); +} + +void AppListServiceWin::MoveNearCursor(app_list::AppListView* view) { + AppListWin::MoveNearCursor(view); +} diff --git a/chrome/browser/ui/views/app_list/win/app_list_service_win.h b/chrome/browser/ui/views/app_list/win/app_list_service_win.h index e4d0069..6181a74 100644 --- a/chrome/browser/ui/views/app_list/win/app_list_service_win.h +++ b/chrome/browser/ui/views/app_list/win/app_list_service_win.h @@ -6,36 +6,23 @@ #define CHROME_BROWSER_UI_VIEWS_APP_LIST_WIN_APP_LIST_SERVICE_WIN_H_ #include "base/memory/scoped_ptr.h" -#include "chrome/browser/ui/app_list/app_list_service_impl.h" +#include "chrome/browser/ui/app_list/app_list_service_views.h" -namespace app_list{ -class AppListModel; -} +class ActivationTrackerWin; -class AppListControllerDelegateWin; -class AppListShower; template <typename T> struct DefaultSingletonTraits; -class AppListServiceWin : public AppListServiceImpl { +class AppListServiceWin : public AppListServiceViews { public: - AppListServiceWin(); virtual ~AppListServiceWin(); static AppListServiceWin* GetInstance(); - void set_can_close(bool can_close); - void OnViewBeingDestroyed(); // AppListService overrides: virtual void SetAppListNextPaintCallback(void (*callback)()) OVERRIDE; virtual void HandleFirstRun() OVERRIDE; virtual void Init(Profile* initial_profile) OVERRIDE; - virtual void CreateForProfile(Profile* requested_profile) OVERRIDE; virtual void ShowForProfile(Profile* requested_profile) OVERRIDE; - virtual void DismissAppList() OVERRIDE; - virtual bool IsAppListVisible() const OVERRIDE; - virtual gfx::NativeWindow GetAppListWindow() OVERRIDE; - virtual Profile* GetCurrentAppListProfile() OVERRIDE; - virtual AppListControllerDelegate* GetControllerDelegate() OVERRIDE; // AppListServiceImpl overrides: virtual void CreateShortcut() OVERRIDE; @@ -43,6 +30,16 @@ class AppListServiceWin : public AppListServiceImpl { private: friend struct DefaultSingletonTraits<AppListServiceWin>; + // AppListServiceViews overrides: + virtual void OnViewBeingDestroyed(); + + // AppListShowerDelegate overrides: + virtual void OnViewCreated() OVERRIDE; + virtual void OnViewDismissed() OVERRIDE; + virtual void MoveNearCursor(app_list::AppListView* view) OVERRIDE; + + AppListServiceWin(); + bool IsWarmupNeeded(); void ScheduleWarmup(); @@ -54,11 +51,7 @@ class AppListServiceWin : public AppListServiceImpl { void OnLoadProfileForWarmup(Profile* initial_profile); bool enable_app_list_on_next_init_; - - // Responsible for putting views on the screen. - scoped_ptr<AppListShower> shower_; - - scoped_ptr<AppListControllerDelegateWin> controller_delegate_; + scoped_ptr<ActivationTrackerWin> activation_tracker_; DISALLOW_COPY_AND_ASSIGN(AppListServiceWin); }; diff --git a/chrome/browser/ui/views/app_list/win/app_list_win.cc b/chrome/browser/ui/views/app_list/win/app_list_win.cc index 78d347e..85b86e0 100644 --- a/chrome/browser/ui/views/app_list/win/app_list_win.cc +++ b/chrome/browser/ui/views/app_list/win/app_list_win.cc @@ -4,8 +4,6 @@ #include "chrome/browser/ui/views/app_list/win/app_list_win.h" -#include "base/command_line.h" -#include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/app_list/app_list_positioner.h" #include "ui/app_list/app_list_switches.h" #include "ui/app_list/views/app_list_view.h" @@ -44,14 +42,7 @@ bool GetTaskbarRect(gfx::Rect* rect) { } // namespace -AppListWin::AppListWin(app_list::AppListView* view, - const base::Closure& on_should_dismiss) - : view_(view), - activation_tracker_(view, on_should_dismiss), - window_icon_updated_(false) {} - -AppListWin::~AppListWin() {} - +// static gfx::Point AppListWin::FindAnchorPoint(const gfx::Size& view_size, const gfx::Display& display, const gfx::Point& cursor, @@ -85,45 +76,16 @@ gfx::Point AppListWin::FindAnchorPoint(const gfx::Size& view_size, return positioner.GetAnchorPointForShelfCursor(edge, cursor); } -void AppListWin::Show() { - view_->GetWidget()->Show(); - if (!window_icon_updated_) { - view_->GetWidget()->GetTopLevelWidget()->UpdateWindowIcon(); - window_icon_updated_ = true; - } - view_->GetWidget()->Activate(); -} - -void AppListWin::Hide() { - view_->GetWidget()->Hide(); - activation_tracker_.OnViewHidden(); -} - -void AppListWin::MoveNearCursor() { +// static +void AppListWin::MoveNearCursor(app_list::AppListView* view) { gfx::Point cursor = gfx::Screen::GetNativeScreen()->GetCursorScreenPoint(); gfx::Screen* screen = - gfx::Screen::GetScreenFor(view_->GetWidget()->GetNativeView()); + gfx::Screen::GetScreenFor(view->GetWidget()->GetNativeView()); gfx::Display display = screen->GetDisplayNearestPoint(cursor); - view_->SetBubbleArrow(views::BubbleBorder::FLOAT); + view->SetBubbleArrow(views::BubbleBorder::FLOAT); gfx::Rect taskbar_rect; GetTaskbarRect(&taskbar_rect); - view_->SetAnchorPoint(FindAnchorPoint(view_->GetPreferredSize(), display, - cursor, taskbar_rect)); -} - -bool AppListWin::IsVisible() { - return view_->GetWidget()->IsVisible(); -} - -void AppListWin::Prerender() { - view_->Prerender(); -} - -gfx::NativeWindow AppListWin::GetWindow() { - return view_->GetWidget()->GetNativeWindow(); -} - -void AppListWin::SetProfile(Profile* profile) { - view_->SetProfileByPath(profile->GetPath()); + view->SetAnchorPoint( + FindAnchorPoint(view->GetPreferredSize(), display, cursor, taskbar_rect)); } diff --git a/chrome/browser/ui/views/app_list/win/app_list_win.h b/chrome/browser/ui/views/app_list/win/app_list_win.h index 37d5643..81352c9 100644 --- a/chrome/browser/ui/views/app_list/win/app_list_win.h +++ b/chrome/browser/ui/views/app_list/win/app_list_win.h @@ -5,26 +5,21 @@ #ifndef CHROME_BROWSER_UI_VIEWS_APP_LIST_WIN_APP_LIST_WIN_H_ #define CHROME_BROWSER_UI_VIEWS_APP_LIST_WIN_APP_LIST_WIN_H_ -#include "base/callback_forward.h" -#include "chrome/browser/ui/app_list/app_list.h" -#include "chrome/browser/ui/views/app_list/win/activation_tracker_win.h" -#include "ui/app_list/views/app_list_view.h" +namespace app_list { +class AppListView; +} namespace gfx { class Display; class Point; +class Rect; class Size; -} // namespace gfx +} -// Responsible for positioning, hiding and showing an AppListView on Windows. -// This includes watching window activation/deactivation messages to determine -// if the user has clicked away from it. -class AppListWin : public AppList { +// Responsible for positioning an AppListView on Windows. +// TODO(tapted): Shouldn't be a class - move the static member functions out. +class AppListWin { public: - AppListWin(app_list::AppListView* view, - const base::Closure& on_should_dismiss); - virtual ~AppListWin(); - // Finds the position for a window to anchor it to the taskbar. This chooses // the most appropriate position for the window based on whether the taskbar // exists, the position of the taskbar, and the mouse cursor. Returns the @@ -35,22 +30,7 @@ class AppListWin : public AppList { const gfx::Point& cursor, const gfx::Rect& taskbar_rect); - // AppList overrides. - virtual void Show() OVERRIDE; - virtual void Hide() OVERRIDE; - virtual void MoveNearCursor() OVERRIDE; - virtual bool IsVisible() OVERRIDE; - virtual void Prerender() OVERRIDE; - virtual gfx::NativeWindow GetWindow() OVERRIDE; - virtual void SetProfile(Profile* profile) OVERRIDE; - - private: - // Weak pointer. The view manages its own lifetime. - app_list::AppListView* view_; - ActivationTrackerWin activation_tracker_; - bool window_icon_updated_; - - DISALLOW_COPY_AND_ASSIGN(AppListWin); + static void MoveNearCursor(app_list::AppListView* view); }; #endif // CHROME_BROWSER_UI_VIEWS_APP_LIST_WIN_APP_LIST_WIN_H_ diff --git a/chrome/chrome_browser_ui.gypi b/chrome/chrome_browser_ui.gypi index 6ec0d1a..9f7dd0e 100644 --- a/chrome/chrome_browser_ui.gypi +++ b/chrome/chrome_browser_ui.gypi @@ -135,12 +135,12 @@ 'browser/ui/app_list/app_context_menu.cc', 'browser/ui/app_list/app_context_menu.h', 'browser/ui/app_list/app_context_menu_delegate.h', - 'browser/ui/app_list/app_list.h', 'browser/ui/app_list/app_list_controller_delegate.cc', 'browser/ui/app_list/app_list_controller_delegate.h', 'browser/ui/app_list/app_list_controller_delegate_impl.cc', 'browser/ui/app_list/app_list_controller_delegate_impl.h', - 'browser/ui/app_list/app_list_factory.h', + 'browser/ui/app_list/app_list_controller_delegate_views.cc', + 'browser/ui/app_list/app_list_controller_delegate_views.h', 'browser/ui/app_list/app_list_icon_win.cc', 'browser/ui/app_list/app_list_icon_win.h', 'browser/ui/app_list/app_list_positioner.cc', @@ -152,8 +152,11 @@ 'browser/ui/app_list/app_list_service_impl.h', 'browser/ui/app_list/app_list_service_mac.h', 'browser/ui/app_list/app_list_service_mac.mm', - 'browser/ui/app_list/app_list_shower.cc', - 'browser/ui/app_list/app_list_shower.h', + 'browser/ui/app_list/app_list_service_views.cc', + 'browser/ui/app_list/app_list_service_views.h', + 'browser/ui/app_list/app_list_shower_delegate.h', + 'browser/ui/app_list/app_list_shower_views.cc', + 'browser/ui/app_list/app_list_shower_views.h', 'browser/ui/app_list/app_list_syncable_service.cc', 'browser/ui/app_list/app_list_syncable_service.h', 'browser/ui/app_list/app_list_syncable_service_factory.cc', @@ -1442,8 +1445,6 @@ 'browser/ui/views/accessibility/accessibility_event_router_views.h', 'browser/ui/views/accessibility/invert_bubble_view.cc', 'browser/ui/views/accessibility/invert_bubble_view.h', - 'browser/ui/views/app_list/linux/app_list_controller_delegate_linux.cc', - 'browser/ui/views/app_list/linux/app_list_controller_delegate_linux.h', 'browser/ui/views/app_list/linux/app_list_linux.cc', 'browser/ui/views/app_list/linux/app_list_linux.h', 'browser/ui/views/app_list/linux/app_list_service_linux.cc', diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi index abfff82..0dd87b7 100644 --- a/chrome/chrome_tests_unit.gypi +++ b/chrome/chrome_tests_unit.gypi @@ -1428,8 +1428,8 @@ 'browser/ui/app_list/app_list_service_mac_unittest.mm', 'browser/ui/app_list/app_list_service_unittest.cc', 'browser/ui/app_list/extension_app_model_builder_unittest.cc', + 'browser/ui/app_list/app_list_shower_views_unittest.cc', 'browser/ui/app_list/profile_loader_unittest.cc', - 'browser/ui/app_list/test/app_list_shower_unittest.cc', 'browser/ui/app_list/test/fake_profile.cc', 'browser/ui/app_list/test/fake_profile.h', 'browser/ui/app_list/test/fake_profile_store.cc', |