Commit d35f7c61 authored by Takashi Sakamoto's avatar Takashi Sakamoto Committed by Commit Bot

Revert "Reland "app_list: merge AppListViewDelegate into AppListClientImpl in Chrome.""

This reverts commit de013df9.

Reason for revert: 
Suspect causing the following failure on Linux ChromiumOS MSan Tests:
CrashRestoreComplexTest.RestoreSessionForThreeUsers:
https://logs.chromium.org/v/?s=chromium%2Fbb%2Fchromium.memory%2FLinux_ChromiumOS_MSan_Tests%2F6545%2F%2B%2Frecipes%2Fsteps%2Fbrowser_tests%2F0%2Flogs%2FCrashRestoreComplexTest.RestoreSessionForThreeUsers%2F0

  Uninitialized value was created by a heap allocation
    #0 0xa37813 in __interceptor_posix_memalign /b/build/slave/linux_upload_clang/build/src/third_party/llvm/compiler-rt/lib/msan/msan_interceptors.cc:165:3
    #1 0x1276df0f in base::AlignedAlloc(unsigned long, unsigned long) ./../../base/memory/aligned_memory.cc:31:7
    #2 0xaab5970 in Message ./../../mojo/edk/system/channel.cc:120:7
    #3 0xaab5970 in mojo::edk::Channel::Message::Message(unsigned long, unsigned long, unsigned long) ./../../mojo/edk/system/channel.cc:74:0
    #4 0xaaf24f0 in make_unique<mojo::edk::Channel::Message, unsigned long &, const unsigned long &, unsigned long &> ./../../buildtools/third_party/libc++/trunk/include/memory:3079:32
    #5 0xaaf24f0 in CreateMessage<void> ./../../mojo/edk/system/node_channel.cc:140:0
    #6 0xaaf24f0 in mojo::edk::NodeChannel::CreateEventMessage(unsigned long, unsigned long, void**, unsigned long) ./../../mojo/edk/system/node_channel.cc:182:0
    #7 0xab389d6 in mojo::edk::(anonymous namespace)::CreateOrExtendSerializedEventMessage(mojo::edk::ports::UserMessageEvent*, unsigned long, unsigned long, mojo::edk::Dispatcher::DispatcherInTransit const*, unsigned long, std::__1::unique_ptr<mojo::edk::Channel::Message, std::__1::default_delete<mojo::edk::Channel::Message> >*, void**, unsigned long*, void**) ./../../mojo/edk/system/user_message_impl.cc:144:33
    #8 0xab3bafd in mojo::edk::UserMessageImpl::AppendData(unsigned int, unsigned int const*, unsigned int) ./../../mojo/edk/system/user_message_impl.cc:465:21
    #9 0xaac2f8c in mojo::edk::Core::AppendMessageData(unsigned long, unsigned int, unsigned int const*, unsigned int, MojoAppendMessageDataOptions const*, void**, unsigned int*) ./../../mojo/edk/system/core.cc:545:16
    #10 0xaaaceb6 in MojoAppendMessageDataImpl ./../../mojo/edk/embedder/entrypoints.cc:96:18
    #11 0x176afb6a in CreateSerializedMessageObject ./../../mojo/public/cpp/bindings/lib/message.cc:93:8
    #12 0x176afb6a in mojo::Message::Message(unsigned int, unsigned int, unsigned long, unsigned long, std::__1::vector<mojo::ScopedHandleBase<mojo::Handle>, std::__1::allocator<mojo::ScopedHandleBase<mojo::Handle> > >*) ./../../mojo/public/cpp/bindings/lib/message.cc:198:0
    #13 0xe293231 in ash::mojom::AppListControllerProxy::ResolveOemFolderPosition(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, syncer::Ordinal<syncer::StringOrdinalTraits> const&, base::OnceCallback<void (mojo::StructPtr<ash::mojom::AppListItemMetadata>)>) ./gen/ash/public/interfaces/app_list.mojom.cc:1004:17
    #14 0x21340e32 in ChromeAppListModelUpdater::ResolveOemFolderPosition(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, syncer::Ordinal<syncer::StringOrdinalTraits> const&, base::OnceCallback<void (ChromeAppListItem*)>) ./../../chrome/browser/ui/app_list/chrome_app_list_model_updater.cc:372:25
    #15 0x21318489 in app_list::AppListSyncableService::ResolveFolderPositions() ./../../chrome/browser/ui/app_list/app_list_syncable_service.cc:701:21
    #16 0x21315b92 in app_list::AppListSyncableService::HandleUpdateFinished() ./../../chrome/browser/ui/app_list/app_list_syncable_service.cc:459:3
    #17 0x21311a0d in app_list::AppListSyncableService::BuildModel() ./../../chrome/browser/ui/app_list/app_list_syncable_service.cc:412:3
    #18 0x126f6624 in Run ./../../base/callback.h:95:12

Original change's description:
> Reland "app_list: merge AppListViewDelegate into AppListClientImpl in Chrome."
> 
> This is a reland of db8976b8
> 
> Original change's description:
> > app_list: merge AppListViewDelegate into AppListClientImpl in Chrome.
> >
> > This commit does a few things:
> >
> > - merges the Chrome AppListViewDelegate into AppListClientImpl;
> > - cleans up unused references;
> > - updates methods to proper accesses.
> >
> > Ownership of major classes:
> >
> > - Each user has its own AppListSyncableService, and it holds its own
> >   AppListModelUpdater, ModelBuilders, etc.
> > - There's only one AppListClientImpl in ChromeBrowserMainExtraPartsAsh
> >   shared by all users, and it holds Search classes, a mojo pointer to
> >   the AppListControllerImpl in Ash, etc.
> > - There's only one singleton AppListServiceImpl shared by all users,
> and
> >   it holds AppListControllerDelegateImpl.
> >
> > Their lifecycles:
> >
> > - Among these classes, AppListClientImpl is the first to be initiated,
> in
> >   PreProfileInit. It binds to AppListController in Ash, and then tells
> >   AppListServiceImpl two pointers (AppListController*,
> AppListClientImpl*).
> > - When AppListServiceImpl receives the two pointers, it should have
> been
> >   initiated as a singleton.
> > - The AppListClientImpl is associated with the current active user
> profile
> >   when it's accessed from AppListServiceImpl.
> >
> > Bug: 733662
> > Change-Id: Iac6de011185bf88c4b3c575871b69bd7a67c340b
> > Reviewed-on: https://chromium-review.googlesource.com/974660
> > Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
> > Commit-Queue: Jiaquan He <hejq@google.com>
> > Cr-Commit-Position: refs/heads/master@{#546247}
> 
> Bug: 733662
> Change-Id: Ia779e0ec795a9457dc7214f38b528c2dab688b90
> Reviewed-on: https://chromium-review.googlesource.com/991232
> Commit-Queue: Jiaquan He <hejq@google.com>
> Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#547956}

TBR=xiyuan@chromium.org,hejq@google.com

Change-Id: Iccc96b53a54fbc46ca02af619c9746079d1ba7f1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 733662
Reviewed-on: https://chromium-review.googlesource.com/994438Reviewed-by: default avatarTakashi Sakamoto <tasak@google.com>
Commit-Queue: Takashi Sakamoto <tasak@google.com>
Cr-Commit-Position: refs/heads/master@{#548003}
parent dfbb726b
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include "chrome/browser/chromeos/tether/tether_service.h" #include "chrome/browser/chromeos/tether/tether_service.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/identity_manager_factory.h" #include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/browser/ui/app_list/app_list_service_impl.h"
#include "chrome/browser/ui/ash/ash_util.h" #include "chrome/browser/ui/ash/ash_util.h"
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
...@@ -165,9 +164,6 @@ void StartUserSession(Profile* user_profile, const std::string& login_user_id) { ...@@ -165,9 +164,6 @@ void StartUserSession(Profile* user_profile, const std::string& login_user_id) {
TetherService* tether_service = TetherService::Get(user_profile); TetherService* tether_service = TetherService::Get(user_profile);
if (tether_service) if (tether_service)
tether_service->StartTetherIfPossible(); tether_service->StartTetherIfPossible();
// Associates AppListClient with the current active profile.
AppListServiceImpl::GetInstance()->GetAppListClient();
} }
UserSessionManager::GetInstance()->CheckEolStatus(user_profile); UserSessionManager::GetInstance()->CheckEolStatus(user_profile);
......
...@@ -7,10 +7,8 @@ ...@@ -7,10 +7,8 @@
#include <stddef.h> #include <stddef.h>
#include <algorithm> #include <algorithm>
#include <map>
#include <set> #include <set>
#include <string> #include <string>
#include <utility>
#include <vector> #include <vector>
#include "base/base_paths.h" #include "base/base_paths.h"
...@@ -83,8 +81,7 @@ ...@@ -83,8 +81,7 @@
#include "chrome/browser/signin/signin_manager_factory.h" #include "chrome/browser/signin/signin_manager_factory.h"
#include "chrome/browser/supervised_user/child_accounts/child_account_service.h" #include "chrome/browser/supervised_user/child_accounts/child_account_service.h"
#include "chrome/browser/supervised_user/child_accounts/child_account_service_factory.h" #include "chrome/browser/supervised_user/child_accounts/child_account_service_factory.h"
#include "chrome/browser/ui/app_list/app_list_client_impl.h" #include "chrome/browser/ui/app_list/app_list_service.h"
#include "chrome/browser/ui/app_list/app_list_service_impl.h"
#include "chrome/browser/ui/chrome_pages.h" #include "chrome/browser/ui/chrome_pages.h"
#include "chrome/browser/ui/startup/startup_browser_creator.h" #include "chrome/browser/ui/startup/startup_browser_creator.h"
#include "chrome/common/channel_info.h" #include "chrome/common/channel_info.h"
...@@ -1964,9 +1961,6 @@ void UserSessionManager::DoBrowserLaunchInternal(Profile* profile, ...@@ -1964,9 +1961,6 @@ void UserSessionManager::DoBrowserLaunchInternal(Profile* profile,
profile->GetPrefs()->ClearPref(prefs::kShowSyncSettingsOnSessionStart); profile->GetPrefs()->ClearPref(prefs::kShowSyncSettingsOnSessionStart);
chrome::ShowSettingsSubPageForProfile(profile, "syncSetup"); chrome::ShowSettingsSubPageForProfile(profile, "syncSetup");
} }
// Associates AppListClient with the current active profile.
AppListServiceImpl::GetInstance()->GetAppListClient();
} }
void UserSessionManager::RespectLocalePreferenceWrapper( void UserSessionManager::RespectLocalePreferenceWrapper(
......
...@@ -3474,6 +3474,8 @@ split_static_library("ui") { ...@@ -3474,6 +3474,8 @@ split_static_library("ui") {
"app_list/app_list_syncable_service.h", "app_list/app_list_syncable_service.h",
"app_list/app_list_syncable_service_factory.cc", "app_list/app_list_syncable_service_factory.cc",
"app_list/app_list_syncable_service_factory.h", "app_list/app_list_syncable_service_factory.h",
"app_list/app_list_view_delegate.cc",
"app_list/app_list_view_delegate.h",
"app_list/chrome_app_list_item.cc", "app_list/chrome_app_list_item.cc",
"app_list/chrome_app_list_item.h", "app_list/chrome_app_list_item.h",
"app_list/chrome_app_list_model_updater.cc", "app_list/chrome_app_list_model_updater.cc",
......
...@@ -4,48 +4,30 @@ ...@@ -4,48 +4,30 @@
#include "chrome/browser/ui/app_list/app_list_client_impl.h" #include "chrome/browser/ui/app_list/app_list_client_impl.h"
#include <stddef.h>
#include <utility> #include <utility>
#include <vector>
#include "ash/public/cpp/menu_utils.h" #include "ash/public/cpp/menu_utils.h"
#include "ash/public/interfaces/constants.mojom.h" #include "ash/public/interfaces/constants.mojom.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/user_metrics.h"
#include "chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service.h" #include "chrome/browser/chromeos/arc/voice_interaction/arc_voice_interaction_framework_service.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/browser/ui/app_list/app_list_controller_delegate.h" #include "chrome/browser/ui/app_list/app_list_controller_delegate.h"
#include "chrome/browser/ui/app_list/app_list_model_updater.h" #include "chrome/browser/ui/app_list/app_list_model_updater.h"
#include "chrome/browser/ui/app_list/app_list_service_impl.h" #include "chrome/browser/ui/app_list/app_list_service_impl.h"
#include "chrome/browser/ui/app_list/app_list_syncable_service.h" #include "chrome/browser/ui/app_list/app_list_view_delegate.h"
#include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h"
#include "chrome/browser/ui/app_list/app_sync_ui_state_watcher.h"
#include "chrome/browser/ui/app_list/search/search_controller.h" #include "chrome/browser/ui/app_list/search/search_controller.h"
#include "chrome/browser/ui/app_list/search/search_controller_factory.h"
#include "chrome/browser/ui/app_list/search/search_resource_manager.h"
#include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
#include "content/public/common/service_manager_connection.h" #include "content/public/common/service_manager_connection.h"
#include "services/service_manager/public/cpp/connector.h" #include "services/service_manager/public/cpp/connector.h"
#include "ui/base/models/menu_model.h" #include "ui/base/models/menu_model.h"
#include "ui/display/types/display_constants.h"
#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect.h"
AppListClientImpl::AppListClientImpl() AppListClientImpl::AppListClientImpl() : binding_(this) {
: template_url_service_observer_(this),
binding_(this),
weak_ptr_factory_(this) {
// Bind this to the AppListController in Ash.
content::ServiceManagerConnection::GetForProcess() content::ServiceManagerConnection::GetForProcess()
->GetConnector() ->GetConnector()
->BindInterface(ash::mojom::kServiceName, &app_list_controller_); ->BindInterface(ash::mojom::kServiceName, &app_list_controller_);
ash::mojom::AppListClientPtr client; ash::mojom::AppListClientPtr client;
binding_.Bind(mojo::MakeRequest(&client)); binding_.Bind(mojo::MakeRequest(&client));
app_list_controller_->SetClient(std::move(client)); app_list_controller_->SetClient(std::move(client));
AppListServiceImpl::GetInstance()->SetAppListControllerAndClient( AppListServiceImpl::GetInstance()->SetAppListControllerAndClient(
app_list_controller_.get(), this); app_list_controller_.get(), this);
} }
...@@ -53,65 +35,49 @@ AppListClientImpl::AppListClientImpl() ...@@ -53,65 +35,49 @@ AppListClientImpl::AppListClientImpl()
AppListClientImpl::~AppListClientImpl() = default; AppListClientImpl::~AppListClientImpl() = default;
void AppListClientImpl::StartSearch(const base::string16& raw_query) { void AppListClientImpl::StartSearch(const base::string16& raw_query) {
if (search_controller_) { if (GetViewDelegate()->search_controller_) {
search_controller_->Start(raw_query); GetViewDelegate()->search_controller_->Start(raw_query);
controller_delegate_->OnSearchStarted(); GetViewDelegate()->controller_->OnSearchStarted();
} }
} }
void AppListClientImpl::OpenSearchResult(const std::string& result_id, void AppListClientImpl::OpenSearchResult(const std::string& result_id,
int event_flags) { int event_flags) {
if (!model_updater_) GetViewDelegate()->OpenSearchResult(result_id, event_flags);
return;
app_list::SearchResult* result = model_updater_->FindSearchResult(result_id);
if (result)
search_controller_->OpenResult(result, event_flags);
} }
void AppListClientImpl::InvokeSearchResultAction(const std::string& result_id, void AppListClientImpl::InvokeSearchResultAction(const std::string& result_id,
int action_index, int action_index,
int event_flags) { int event_flags) {
if (!model_updater_) GetViewDelegate()->InvokeSearchResultAction(result_id, action_index,
return; event_flags);
app_list::SearchResult* result = model_updater_->FindSearchResult(result_id);
if (result)
search_controller_->InvokeResultAction(result, action_index, event_flags);
} }
void AppListClientImpl::ViewClosing() { void AppListClientImpl::ViewClosing() {
controller_delegate_->SetAppListDisplayId(display::kInvalidDisplayId); GetViewDelegate()->ViewClosing();
} }
void AppListClientImpl::ViewShown(int64_t display_id) { void AppListClientImpl::ViewShown(int64_t display_id) {
if (model_updater_) { GetViewDelegate()->ViewShown(display_id);
base::RecordAction(base::UserMetricsAction("Launcher_Show"));
base::UmaHistogramSparse("Apps.AppListBadgedAppsCount",
model_updater_->BadgedItemCount());
}
controller_delegate_->SetAppListDisplayId(display_id);
} }
void AppListClientImpl::ActivateItem(const std::string& id, int event_flags) { void AppListClientImpl::ActivateItem(const std::string& id, int event_flags) {
if (!model_updater_) GetViewDelegate()->model_updater_->ActivateChromeItem(id, event_flags);
return;
model_updater_->ActivateChromeItem(id, event_flags);
} }
void AppListClientImpl::GetContextMenuModel( void AppListClientImpl::GetContextMenuModel(
const std::string& id, const std::string& id,
GetContextMenuModelCallback callback) { GetContextMenuModelCallback callback) {
if (!model_updater_) ui::MenuModel* menu =
return; GetViewDelegate()->model_updater_->GetContextMenuModel(id);
ui::MenuModel* menu = model_updater_->GetContextMenuModel(id);
std::move(callback).Run(ash::menu_utils::GetMojoMenuItemsFromModel(menu)); std::move(callback).Run(ash::menu_utils::GetMojoMenuItemsFromModel(menu));
} }
void AppListClientImpl::ContextMenuItemSelected(const std::string& id, void AppListClientImpl::ContextMenuItemSelected(const std::string& id,
int command_id, int command_id,
int event_flags) { int event_flags) {
if (!model_updater_) GetViewDelegate()->model_updater_->ContextMenuItemSelected(id, command_id,
return; event_flags);
model_updater_->ContextMenuItemSelected(id, command_id, event_flags);
} }
void AppListClientImpl::OnAppListTargetVisibilityChanged(bool visible) { void AppListClientImpl::OnAppListTargetVisibilityChanged(bool visible) {
...@@ -140,102 +106,22 @@ void AppListClientImpl::ToggleVoiceInteractionSession() { ...@@ -140,102 +106,22 @@ void AppListClientImpl::ToggleVoiceInteractionSession() {
void AppListClientImpl::OnFolderCreated( void AppListClientImpl::OnFolderCreated(
ash::mojom::AppListItemMetadataPtr item) { ash::mojom::AppListItemMetadataPtr item) {
if (!model_updater_)
return;
DCHECK(item->is_folder); DCHECK(item->is_folder);
model_updater_->OnFolderCreated(std::move(item)); GetViewDelegate()->model_updater_->OnFolderCreated(std::move(item));
} }
void AppListClientImpl::OnFolderDeleted( void AppListClientImpl::OnFolderDeleted(
ash::mojom::AppListItemMetadataPtr item) { ash::mojom::AppListItemMetadataPtr item) {
if (!model_updater_)
return;
DCHECK(item->is_folder); DCHECK(item->is_folder);
model_updater_->OnFolderDeleted(std::move(item)); GetViewDelegate()->model_updater_->OnFolderDeleted(std::move(item));
} }
void AppListClientImpl::OnItemUpdated(ash::mojom::AppListItemMetadataPtr item) { void AppListClientImpl::OnItemUpdated(ash::mojom::AppListItemMetadataPtr item) {
if (!model_updater_) GetViewDelegate()->model_updater_->OnItemUpdated(std::move(item));
return;
model_updater_->OnItemUpdated(std::move(item));
} }
void AppListClientImpl::UpdateProfile() { AppListViewDelegate* AppListClientImpl::GetViewDelegate() {
Profile* profile = ProfileManager::GetActiveUserProfile(); return AppListServiceImpl::GetInstance()->GetViewDelegate();
app_list::AppListSyncableService* syncable_service =
app_list::AppListSyncableServiceFactory::GetForProfile(profile);
DCHECK(syncable_service);
SetProfile(profile);
}
void AppListClientImpl::SetProfile(Profile* new_profile) {
if (profile_ == new_profile)
return;
if (profile_) {
DCHECK(model_updater_);
model_updater_->SetActive(false);
search_resource_manager_.reset();
search_controller_.reset();
app_sync_ui_state_watcher_.reset();
model_updater_ = nullptr;
}
template_url_service_observer_.RemoveAll();
profile_ = new_profile;
if (!profile_)
return;
// If we are in guest mode, the new profile should be an incognito profile.
// Otherwise, this may later hit a check (same condition as this one) in
// Browser::Browser when opening links in a browser window (see
// http://crbug.com/460437).
DCHECK(!profile_->IsGuestSession() || profile_->IsOffTheRecord())
<< "Guest mode must use incognito profile";
TemplateURLService* template_url_service =
TemplateURLServiceFactory::GetForProfile(profile_);
template_url_service_observer_.Add(template_url_service);
app_list::AppListSyncableService* syncable_service =
app_list::AppListSyncableServiceFactory::GetForProfile(profile_);
model_updater_ = syncable_service->GetModelUpdater();
model_updater_->SetActive(true);
app_sync_ui_state_watcher_ =
std::make_unique<AppSyncUIStateWatcher>(profile_, model_updater_);
SetUpSearchUI();
OnTemplateURLServiceChanged();
// Clear search query.
model_updater_->UpdateSearchBox(base::string16(),
false /* initiated_by_user */);
}
void AppListClientImpl::SetUpSearchUI() {
search_resource_manager_.reset(
new app_list::SearchResourceManager(profile_, model_updater_));
search_controller_ = app_list::CreateSearchController(
profile_, model_updater_, controller_delegate_);
}
void AppListClientImpl::OnTemplateURLServiceChanged() {
DCHECK(model_updater_);
TemplateURLService* template_url_service =
TemplateURLServiceFactory::GetForProfile(profile_);
const TemplateURL* default_provider =
template_url_service->GetDefaultSearchProvider();
const bool is_google =
default_provider &&
default_provider->GetEngineType(
template_url_service->search_terms_data()) == SEARCH_ENGINE_GOOGLE;
model_updater_->SetSearchEngineIsGoogle(is_google);
} }
void AppListClientImpl::FlushMojoForTesting() { void AppListClientImpl::FlushMojoForTesting() {
......
...@@ -5,33 +5,16 @@ ...@@ -5,33 +5,16 @@
#ifndef CHROME_BROWSER_UI_APP_LIST_APP_LIST_CLIENT_IMPL_H_ #ifndef CHROME_BROWSER_UI_APP_LIST_APP_LIST_CLIENT_IMPL_H_
#define CHROME_BROWSER_UI_APP_LIST_APP_LIST_CLIENT_IMPL_H_ #define CHROME_BROWSER_UI_APP_LIST_APP_LIST_CLIENT_IMPL_H_
#include <stdint.h>
#include <memory>
#include <string> #include <string>
#include "ash/public/interfaces/app_list.mojom.h" #include "ash/public/interfaces/app_list.mojom.h"
#include "base/compiler_specific.h" #include "ash/public/interfaces/shelf.mojom.h"
#include "base/macros.h" #include "chrome/browser/ui/app_list/chrome_app_list_model_updater.h"
#include "base/memory/weak_ptr.h"
#include "base/scoped_observer.h"
#include "components/search_engines/template_url_service.h"
#include "components/search_engines/template_url_service_observer.h"
#include "mojo/public/cpp/bindings/associated_binding.h"
#include "mojo/public/cpp/bindings/binding.h" #include "mojo/public/cpp/bindings/binding.h"
namespace app_list { class AppListViewDelegate;
class SearchController;
class SearchResourceManager;
} // namespace app_list
class AppListControllerDelegate;
class AppListModelUpdater;
class AppSyncUIStateWatcher;
class Profile;
class AppListClientImpl : public ash::mojom::AppListClient, class AppListClientImpl : public ash::mojom::AppListClient {
public TemplateURLServiceObserver {
public: public:
AppListClientImpl(); AppListClientImpl();
~AppListClientImpl() override; ~AppListClientImpl() override;
...@@ -60,48 +43,15 @@ class AppListClientImpl : public ash::mojom::AppListClient, ...@@ -60,48 +43,15 @@ class AppListClientImpl : public ash::mojom::AppListClient,
void OnFolderDeleted(ash::mojom::AppListItemMetadataPtr item) override; void OnFolderDeleted(ash::mojom::AppListItemMetadataPtr item) override;
void OnItemUpdated(ash::mojom::AppListItemMetadataPtr item) override; void OnItemUpdated(ash::mojom::AppListItemMetadataPtr item) override;
// Associates this client with the current active user, called when this
// client is accessed.
void UpdateProfile();
void set_controller_delegate(AppListControllerDelegate* controller_delegate) {
controller_delegate_ = controller_delegate;
}
// Flushes all pending mojo call to Ash for testing. // Flushes all pending mojo call to Ash for testing.
void FlushMojoForTesting(); void FlushMojoForTesting();
private: private:
// Overridden from TemplateURLServiceObserver: AppListViewDelegate* GetViewDelegate();
void OnTemplateURLServiceChanged() override;
// Configures the AppList for the given |profile|.
void SetProfile(Profile* profile);
// Updates the speech webview and start page for the current |profile_|.
void SetUpSearchUI();
// Unowned pointer to the controller delegate.
AppListControllerDelegate* controller_delegate_ = nullptr;
// Unowned pointer to the associated profile. May change if SetProfile is
// called.
Profile* profile_ = nullptr;
// Unowned pointer to the model updater owned by AppListSyncableService.
// Will change if |profile_| changes.
AppListModelUpdater* model_updater_ = nullptr;
std::unique_ptr<app_list::SearchResourceManager> search_resource_manager_;
std::unique_ptr<app_list::SearchController> search_controller_;
std::unique_ptr<AppSyncUIStateWatcher> app_sync_ui_state_watcher_;
ScopedObserver<TemplateURLService, AppListClientImpl>
template_url_service_observer_;
mojo::Binding<ash::mojom::AppListClient> binding_; mojo::Binding<ash::mojom::AppListClient> binding_;
ash::mojom::AppListControllerPtr app_list_controller_; ash::mojom::AppListControllerPtr app_list_controller_;
base::WeakPtrFactory<AppListClientImpl> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(AppListClientImpl); DISALLOW_COPY_AND_ASSIGN(AppListClientImpl);
}; };
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/app_list/app_list_controller_delegate.h" #include "chrome/browser/ui/app_list/app_list_controller_delegate.h"
#include "chrome/browser/ui/app_list/app_list_model_updater.h" #include "chrome/browser/ui/app_list/app_list_model_updater.h"
#include "chrome/browser/ui/app_list/app_list_service_impl.h" #include "chrome/browser/ui/app_list/app_list_service.h"
#include "chrome/browser/ui/app_list/test/chrome_app_list_test_support.h" #include "chrome/browser/ui/app_list/test/chrome_app_list_test_support.h"
#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/browser_finder.h"
...@@ -60,12 +60,10 @@ IN_PROC_BROWSER_TEST_F(AppListControllerSearchResultsBrowserTest, ...@@ -60,12 +60,10 @@ IN_PROC_BROWSER_TEST_F(AppListControllerSearchResultsBrowserTest,
.AppendASCII("platform_apps") .AppendASCII("platform_apps")
.AppendASCII("minimal"); .AppendASCII("minimal");
AppListServiceImpl* service = AppListServiceImpl::GetInstance(); AppListService* service = AppListService::Get();
ASSERT_TRUE(service); ASSERT_TRUE(service);
AppListModelUpdater* model_updater = test::GetModelUpdater(service); AppListModelUpdater* model_updater = test::GetModelUpdater(service);
ASSERT_TRUE(model_updater); ASSERT_TRUE(model_updater);
// Getting the AppListClient to associate it with the current profile.
ASSERT_TRUE(service->GetAppListClient());
// Install the extension. // Install the extension.
const extensions::Extension* extension = InstallExtension( const extensions::Extension* extension = InstallExtension(
......
...@@ -17,10 +17,8 @@ ...@@ -17,10 +17,8 @@
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/app_list/app_list_client_impl.h" #include "chrome/browser/ui/app_list/app_list_client_impl.h"
#include "chrome/browser/ui/app_list/app_list_syncable_service.h" #include "chrome/browser/ui/app_list/app_list_view_delegate.h"
#include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h"
#include "chrome/browser/ui/ash/ash_util.h" #include "chrome/browser/ui/ash/ash_util.h"
#include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
#include "chrome/browser/ui/ash/session_util.h" #include "chrome/browser/ui/ash/session_util.h"
...@@ -42,7 +40,6 @@ void AppListServiceImpl::SetAppListControllerAndClient( ...@@ -42,7 +40,6 @@ void AppListServiceImpl::SetAppListControllerAndClient(
app_list_controller_ = app_list_controller; app_list_controller_ = app_list_controller;
controller_delegate_.SetAppListController(app_list_controller); controller_delegate_.SetAppListController(app_list_controller);
app_list_client_ = app_list_client; app_list_client_ = app_list_client;
app_list_client_->set_controller_delegate(&controller_delegate_);
} }
ash::mojom::AppListController* AppListServiceImpl::GetAppListController() { ash::mojom::AppListController* AppListServiceImpl::GetAppListController() {
...@@ -56,9 +53,12 @@ app_list::SearchModel* AppListServiceImpl::GetSearchModelFromAsh() { ...@@ -56,9 +53,12 @@ app_list::SearchModel* AppListServiceImpl::GetSearchModelFromAsh() {
: nullptr; : nullptr;
} }
AppListClientImpl* AppListServiceImpl::GetAppListClient() { AppListViewDelegate* AppListServiceImpl::GetViewDelegate() {
app_list_client_->UpdateProfile(); if (!view_delegate_)
return app_list_client_; view_delegate_.reset(new AppListViewDelegate(GetControllerDelegate()));
Profile* profile = Profile::FromBrowserContext(GetActiveBrowserContext());
view_delegate_->SetProfile(profile);
return view_delegate_.get();
} }
AppListControllerDelegate* AppListServiceImpl::GetControllerDelegate() { AppListControllerDelegate* AppListServiceImpl::GetControllerDelegate() {
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
class AppListClientImpl; class AppListClientImpl;
class AppListControllerDelegateImpl; class AppListControllerDelegateImpl;
class AppListViewDelegate;
namespace app_list { namespace app_list {
class SearchModel; class SearchModel;
...@@ -34,6 +35,11 @@ class AppListServiceImpl : public AppListService { ...@@ -34,6 +35,11 @@ class AppListServiceImpl : public AppListService {
static AppListServiceImpl* GetInstance(); static AppListServiceImpl* GetInstance();
AppListViewDelegate* GetViewDelegate();
void RecordAppListLaunch();
static void RecordAppListAppLaunch();
// AppListService overrides: // AppListService overrides:
Profile* GetCurrentAppListProfile() override; Profile* GetCurrentAppListProfile() override;
void Show() override; void Show() override;
...@@ -61,7 +67,6 @@ class AppListServiceImpl : public AppListService { ...@@ -61,7 +67,6 @@ class AppListServiceImpl : public AppListService {
// Returns a pointer to control the app list views in ash. // Returns a pointer to control the app list views in ash.
ash::mojom::AppListController* GetAppListController(); ash::mojom::AppListController* GetAppListController();
AppListClientImpl* GetAppListClient();
// TODO(hejq): Search model migration is not done yet. Chrome still accesses // TODO(hejq): Search model migration is not done yet. Chrome still accesses
// it directly in non-mus+ash mode. // it directly in non-mus+ash mode.
...@@ -74,6 +79,7 @@ class AppListServiceImpl : public AppListService { ...@@ -74,6 +79,7 @@ class AppListServiceImpl : public AppListService {
std::string GetProfileName(); std::string GetProfileName();
PrefService* local_state_; PrefService* local_state_;
std::unique_ptr<AppListViewDelegate> view_delegate_;
AppListControllerDelegateImpl controller_delegate_; AppListControllerDelegateImpl controller_delegate_;
ash::mojom::AppListController* app_list_controller_ = nullptr; ash::mojom::AppListController* app_list_controller_ = nullptr;
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "chrome/browser/ui/app_list/app_list_service.h" #include "chrome/browser/ui/app_list/app_list_service.h"
#include "chrome/browser/ui/app_list/app_list_client_impl.h"
#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser.h"
#include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/in_process_browser_test.h"
...@@ -14,12 +15,13 @@ using AppListServiceInteractiveTest = InProcessBrowserTest; ...@@ -14,12 +15,13 @@ using AppListServiceInteractiveTest = InProcessBrowserTest;
// Show the app list, then dismiss it. // Show the app list, then dismiss it.
IN_PROC_BROWSER_TEST_F(AppListServiceInteractiveTest, ShowAndDismiss) { IN_PROC_BROWSER_TEST_F(AppListServiceInteractiveTest, ShowAndDismiss) {
AppListClientImpl app_list_client;
AppListService* service = AppListService::Get(); AppListService* service = AppListService::Get();
ASSERT_FALSE(service->IsAppListVisible()); ASSERT_FALSE(service->IsAppListVisible());
service->Show(); service->Show();
service->FlushForTesting(); app_list_client.FlushMojoForTesting();
ASSERT_TRUE(service->IsAppListVisible()); ASSERT_TRUE(service->IsAppListVisible());
service->DismissAppList(); service->DismissAppList();
service->FlushForTesting(); app_list_client.FlushMojoForTesting();
ASSERT_FALSE(service->IsAppListVisible()); ASSERT_FALSE(service->IsAppListVisible());
} }
...@@ -445,6 +445,7 @@ void AppListSyncableService::SetOemFolderName(const std::string& name) { ...@@ -445,6 +445,7 @@ void AppListSyncableService::SetOemFolderName(const std::string& name) {
} }
AppListModelUpdater* AppListSyncableService::GetModelUpdater() { AppListModelUpdater* AppListSyncableService::GetModelUpdater() {
DCHECK(IsInitialized());
return model_updater_.get(); return model_updater_.get();
} }
......
// Copyright (c) 2012 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_view_delegate.h"
#include <stddef.h>
#include <utility>
#include <vector>
#include "ash/app_list/model/app_list_model.h"
#include "ash/app_list/model/search/search_model.h"
#include "ash/public/cpp/menu_utils.h"
#include "base/command_line.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/user_metrics.h"
#include "build/build_config.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/browser/ui/app_list/app_list_controller_delegate.h"
#include "chrome/browser/ui/app_list/app_list_model_updater.h"
#include "chrome/browser/ui/app_list/app_list_syncable_service.h"
#include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h"
#include "chrome/browser/ui/app_list/app_sync_ui_state_watcher.h"
#include "chrome/browser/ui/app_list/search/search_controller.h"
#include "chrome/browser/ui/app_list/search/search_controller_factory.h"
#include "chrome/browser/ui/app_list/search/search_resource_manager.h"
#include "chrome/browser/ui/apps/chrome_app_delegate.h"
#include "chrome/browser/ui/ash/wallpaper_controller_client.h"
#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/common/pref_names.h"
#include "chrome/grit/theme_resources.h"
#include "components/prefs/pref_service.h"
#include "components/user_prefs/user_prefs.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/speech_recognition_session_preamble.h"
#include "content/public/browser/web_contents.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension_set.h"
#include "extensions/common/manifest_constants.h"
#include "ui/app_list/app_list_switches.h"
#include "ui/app_list/app_list_view_delegate_observer.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/display/types/display_constants.h"
#include "ui/keyboard/keyboard_util.h"
#include "ui/views/controls/webview/webview.h"
AppListViewDelegate::AppListViewDelegate(AppListControllerDelegate* controller)
: controller_(controller),
profile_(nullptr),
model_updater_(nullptr),
template_url_service_observer_(this),
observer_binding_(this),
weak_ptr_factory_(this) {
CHECK(controller_);
registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING,
content::NotificationService::AllSources());
ash::mojom::WallpaperObserverAssociatedPtrInfo ptr_info;
observer_binding_.Bind(mojo::MakeRequest(&ptr_info));
WallpaperControllerClient::Get()->AddObserver(std::move(ptr_info));
}
AppListViewDelegate::~AppListViewDelegate() {
// The destructor might not be called since the delegate is owned by a leaky
// singleton. This matches the shutdown work done in Observe() in response to
// chrome::NOTIFICATION_APP_TERMINATING, which may happen before this.
SetProfile(nullptr);
}
void AppListViewDelegate::SetProfile(Profile* new_profile) {
if (profile_ == new_profile)
return;
if (profile_) {
DCHECK(model_updater_);
model_updater_->SetActive(false);
search_resource_manager_.reset();
search_controller_.reset();
app_sync_ui_state_watcher_.reset();
model_updater_ = nullptr;
}
template_url_service_observer_.RemoveAll();
profile_ = new_profile;
if (!profile_)
return;
// If we are in guest mode, the new profile should be an incognito profile.
// Otherwise, this may later hit a check (same condition as this one) in
// Browser::Browser when opening links in a browser window (see
// http://crbug.com/460437).
DCHECK(!profile_->IsGuestSession() || profile_->IsOffTheRecord())
<< "Guest mode must use incognito profile";
TemplateURLService* template_url_service =
TemplateURLServiceFactory::GetForProfile(profile_);
template_url_service_observer_.Add(template_url_service);
app_list::AppListSyncableService* syncable_service =
app_list::AppListSyncableServiceFactory::GetForProfile(profile_);
model_updater_ = syncable_service->GetModelUpdater();
model_updater_->SetActive(true);
// After |model_updater_| is initialized, make a GetWallpaperColors mojo call
// to set wallpaper colors for |model_updater_|.
WallpaperControllerClient::Get()->GetWallpaperColors(
base::Bind(&AppListViewDelegate::OnGetWallpaperColorsCallback,
weak_ptr_factory_.GetWeakPtr()));
app_sync_ui_state_watcher_ =
std::make_unique<AppSyncUIStateWatcher>(profile_, model_updater_);
SetUpSearchUI();
OnTemplateURLServiceChanged();
// Clear search query.
model_updater_->UpdateSearchBox(base::string16(),
false /* initiated_by_user */);
}
void AppListViewDelegate::OnGetWallpaperColorsCallback(
const std::vector<SkColor>& colors) {
OnWallpaperColorsChanged(colors);
}
void AppListViewDelegate::SetUpSearchUI() {
search_resource_manager_.reset(
new app_list::SearchResourceManager(profile_, model_updater_));
search_controller_ =
app_list::CreateSearchController(profile_, model_updater_, controller_);
}
void AppListViewDelegate::OnWallpaperChanged(uint32_t image_id) {}
void AppListViewDelegate::OnWallpaperColorsChanged(
const std::vector<SkColor>& prominent_colors) {
if (wallpaper_prominent_colors_ == prominent_colors)
return;
wallpaper_prominent_colors_ = prominent_colors;
for (auto& observer : observers_)
observer.OnWallpaperColorsChanged();
}
AppListModelUpdater* AppListViewDelegate::GetModelUpdater() {
return model_updater_;
}
app_list::AppListModel* AppListViewDelegate::GetModel() {
NOTREACHED();
return nullptr;
}
app_list::SearchModel* AppListViewDelegate::GetSearchModel() {
NOTREACHED();
return nullptr;
}
void AppListViewDelegate::StartSearch(const base::string16& raw_query) {
if (search_controller_) {
search_controller_->Start(raw_query);
controller_->OnSearchStarted();
}
}
void AppListViewDelegate::OpenSearchResult(const std::string& result_id,
int event_flags) {
app_list::SearchResult* result = model_updater_->FindSearchResult(result_id);
if (result)
search_controller_->OpenResult(result, event_flags);
}
void AppListViewDelegate::InvokeSearchResultAction(const std::string& result_id,
int action_index,
int event_flags) {
app_list::SearchResult* result = model_updater_->FindSearchResult(result_id);
if (result)
search_controller_->InvokeResultAction(result, action_index, event_flags);
}
void AppListViewDelegate::ViewShown(int64_t display_id) {
base::RecordAction(base::UserMetricsAction("Launcher_Show"));
base::UmaHistogramSparse("Apps.AppListBadgedAppsCount",
model_updater_->BadgedItemCount());
controller_->SetAppListDisplayId(display_id);
}
void AppListViewDelegate::Dismiss() {
controller_->DismissView();
}
void AppListViewDelegate::ViewClosing() {
controller_->SetAppListDisplayId(display::kInvalidDisplayId);
}
void AppListViewDelegate::GetWallpaperProminentColors(
GetWallpaperProminentColorsCallback callback) {
std::move(callback).Run(wallpaper_prominent_colors_);
}
void AppListViewDelegate::ActivateItem(const std::string& id, int event_flags) {
model_updater_->ActivateChromeItem(id, event_flags);
}
void AppListViewDelegate::GetContextMenuModel(
const std::string& id,
GetContextMenuModelCallback callback) {
ui::MenuModel* menu = model_updater_->GetContextMenuModel(id);
std::move(callback).Run(ash::menu_utils::GetMojoMenuItemsFromModel(menu));
}
void AppListViewDelegate::ContextMenuItemSelected(const std::string& id,
int command_id,
int event_flags) {
model_updater_->ContextMenuItemSelected(id, command_id, event_flags);
}
void AppListViewDelegate::AddObserver(
app_list::AppListViewDelegateObserver* observer) {
observers_.AddObserver(observer);
}
void AppListViewDelegate::RemoveObserver(
app_list::AppListViewDelegateObserver* observer) {
observers_.RemoveObserver(observer);
}
void AppListViewDelegate::OnTemplateURLServiceChanged() {
TemplateURLService* template_url_service =
TemplateURLServiceFactory::GetForProfile(profile_);
const TemplateURL* default_provider =
template_url_service->GetDefaultSearchProvider();
const bool is_google =
default_provider->GetEngineType(
template_url_service->search_terms_data()) == SEARCH_ENGINE_GOOGLE;
model_updater_->SetSearchEngineIsGoogle(is_google);
}
void AppListViewDelegate::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
DCHECK_EQ(chrome::NOTIFICATION_APP_TERMINATING, type);
SetProfile(nullptr); // Ensures launcher page web contents are torn down.
}
// Copyright (c) 2012 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_VIEW_DELEGATE_H_
#define CHROME_BROWSER_UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_
#include <stdint.h>
#include <memory>
#include <string>
#include <vector>
#include "ash/public/interfaces/wallpaper.mojom.h"
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/scoped_observer.h"
#include "chrome/browser/ui/app_list/app_list_model_updater.h"
#include "components/search_engines/template_url_service.h"
#include "components/search_engines/template_url_service_observer.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "mojo/public/cpp/bindings/associated_binding.h"
#include "mojo/public/cpp/bindings/binding.h"
#include "ui/app_list/app_list_view_delegate.h"
#include "ui/app_list/app_list_view_delegate_observer.h"
class AppListClientImpl;
namespace app_list {
class SearchController;
class SearchResourceManager;
}
namespace content {
struct SpeechRecognitionSessionPreamble;
}
class AppListControllerDelegate;
class AppSyncUIStateWatcher;
class Profile;
class AppListViewDelegate : public app_list::AppListViewDelegate,
public ash::mojom::WallpaperObserver,
public content::NotificationObserver,
public TemplateURLServiceObserver {
public:
// Constructs Chrome's AppListViewDelegate with a NULL Profile.
// Does not take ownership of |controller|. TODO(tapted): It should.
explicit AppListViewDelegate(AppListControllerDelegate* controller);
~AppListViewDelegate() override;
// Configure the AppList for the given |profile|.
void SetProfile(Profile* profile);
Profile* profile() { return profile_; }
// Gets the model updater.
AppListModelUpdater* GetModelUpdater();
// Overridden from app_list::AppListViewDelegate:
app_list::AppListModel* GetModel() override;
app_list::SearchModel* GetSearchModel() override;
void StartSearch(const base::string16& raw_query) override;
void OpenSearchResult(const std::string& result_id, int event_flags) override;
void InvokeSearchResultAction(const std::string& result_id,
int action_index,
int event_flags) override;
void ViewShown(int64_t display_id) override;
void Dismiss() override;
void ViewClosing() override;
void GetWallpaperProminentColors(
GetWallpaperProminentColorsCallback callback) override;
void ActivateItem(const std::string& id, int event_flags) override;
void GetContextMenuModel(const std::string& id,
GetContextMenuModelCallback callback) override;
void ContextMenuItemSelected(const std::string& id,
int command_id,
int event_flags) override;
void AddObserver(app_list::AppListViewDelegateObserver* observer) override;
void RemoveObserver(app_list::AppListViewDelegateObserver* observer) override;
// Overridden from TemplateURLServiceObserver:
void OnTemplateURLServiceChanged() override;
private:
// TODO(hejq): We'll merge AppListClientImpl and AppListViewDelegate, but not
// now, since that'll change all interface calls.
friend AppListClientImpl;
// Callback for ash::mojom::GetWallpaperColors.
void OnGetWallpaperColorsCallback(const std::vector<SkColor>& colors);
// Updates the speech webview and start page for the current |profile_|.
void SetUpSearchUI();
// Overridden from ash::mojom::WallpaperObserver:
void OnWallpaperChanged(uint32_t image_id) override;
void OnWallpaperColorsChanged(
const std::vector<SkColor>& prominent_colors) override;
// Overridden from content::NotificationObserver:
void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) override;
// Unowned pointer to the controller.
AppListControllerDelegate* controller_;
// Unowned pointer to the associated profile. May change if SetProfileByPath
// is called.
Profile* profile_;
// Unowned pointer to the model updater owned by AppListSyncableService.
// Will change if |profile_| changes.
AppListModelUpdater* model_updater_;
std::unique_ptr<app_list::SearchResourceManager> search_resource_manager_;
std::unique_ptr<app_list::SearchController> search_controller_;
std::unique_ptr<AppSyncUIStateWatcher> app_sync_ui_state_watcher_;
ScopedObserver<TemplateURLService, AppListViewDelegate>
template_url_service_observer_;
// Registers for NOTIFICATION_APP_TERMINATING to unload custom launcher pages.
content::NotificationRegistrar registrar_;
// The binding this instance uses to implement mojom::WallpaperObserver.
mojo::AssociatedBinding<ash::mojom::WallpaperObserver> observer_binding_;
std::vector<SkColor> wallpaper_prominent_colors_;
base::ObserverList<app_list::AppListViewDelegateObserver> observers_;
base::WeakPtrFactory<AppListViewDelegate> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(AppListViewDelegate);
};
#endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/test/scoped_feature_list.h" #include "base/test/scoped_feature_list.h"
#include "chrome/browser/ui/app_list/app_list_client_impl.h"
#include "chrome/browser/ui/app_list/app_list_service_impl.h" #include "chrome/browser/ui/app_list/app_list_service_impl.h"
#include "chrome/browser/ui/app_list/app_list_view_delegate.h"
#include "chrome/browser/ui/app_list/crostini/crostini_app_model_builder.h" #include "chrome/browser/ui/app_list/crostini/crostini_app_model_builder.h"
#include "chrome/browser/ui/app_list/crostini/crostini_util.h" #include "chrome/browser/ui/app_list/crostini/crostini_util.h"
#include "chrome/browser/ui/app_list/test/chrome_app_list_test_support.h" #include "chrome/browser/ui/app_list/test/chrome_app_list_test_support.h"
...@@ -29,10 +29,10 @@ class CrostiniInstallerViewBrowserTest : public DialogBrowserTest { ...@@ -29,10 +29,10 @@ class CrostiniInstallerViewBrowserTest : public DialogBrowserTest {
// DialogBrowserTest: // DialogBrowserTest:
void ShowUi(const std::string& name) override { void ShowUi(const std::string& name) override {
AppListServiceImpl* service = test::GetAppListServiceImpl(); AppListServiceImpl* service = test::GetAppListServiceImpl();
AppListClientImpl* client = service->GetAppListClient(); AppListViewDelegate* view_delegate = service->GetViewDelegate();
const std::string kCrostiniTerminalId = const std::string kCrostiniTerminalId =
crx_file::id_util::GenerateId(kCrostiniTerminalAppName); crx_file::id_util::GenerateId(kCrostiniTerminalAppName);
client->ActivateItem(kCrostiniTerminalId, 0); view_delegate->ActivateItem(kCrostiniTerminalId, 0);
} }
void SetUp() override { void SetUp() override {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment