| Index: ui/app_list/views/app_list_main_view.cc
|
| diff --git a/ui/app_list/views/app_list_main_view.cc b/ui/app_list/views/app_list_main_view.cc
|
| index 312eacca3cf62eb39fdb3678708814e7b96dcf9e..780aa1d05bcf1bd1a84256b921a20c35c8530a07 100644
|
| --- a/ui/app_list/views/app_list_main_view.cc
|
| +++ b/ui/app_list/views/app_list_main_view.cc
|
| @@ -136,6 +136,8 @@ void AppListMainView::Init(gfx::NativeView parent,
|
|
|
| // Starts icon loading early.
|
| PreloadIcons(parent);
|
| +
|
| + OnSearchEngineIsGoogleChanged(model_->search_engine_is_google());
|
| }
|
|
|
| void AppListMainView::AddContentsViews() {
|
| @@ -308,10 +310,33 @@ void AppListMainView::InitWidgets() {
|
| custom_page_clickzone_->SetContentsView(new CustomPageButton(this));
|
| // The widget is shown by default. If the ContentsView determines that we do
|
| // not need a clickzone upon startup, hide it.
|
| - if (!contents_view_->ShouldShowCustomPageClickzone())
|
| + if (!ShouldShowCustomLauncherPage() ||
|
| + !contents_view_->IsStateActive(AppListModel::STATE_START))
|
| custom_page_clickzone_->Hide();
|
| }
|
|
|
| +bool AppListMainView::ShouldShowCustomLauncherPage() const {
|
| + return contents_view_->custom_page_view() &&
|
| + model_->custom_launcher_page_enabled() &&
|
| + model_->search_engine_is_google();
|
| +}
|
| +
|
| +void AppListMainView::UpdateCustomLauncherPageVisibility() {
|
| + if (ShouldShowCustomLauncherPage()) {
|
| + // Make the custom page view visible again.
|
| + contents_view_->custom_page_view()->SetVisible(true);
|
| + } else if (contents_view_->IsStateActive(
|
| + AppListModel::STATE_CUSTOM_LAUNCHER_PAGE)) {
|
| + // Animate to the start page if currently on the custom page view. The view
|
| + // will hide on animation completion.
|
| + contents_view_->SetActivePage(
|
| + contents_view_->GetPageIndexForState(AppListModel::STATE_START));
|
| + } else {
|
| + // Hide the view immediately otherwise.
|
| + contents_view_->custom_page_view()->SetVisible(false);
|
| + }
|
| +}
|
| +
|
| void AppListMainView::OnCustomLauncherPageEnabledStateChanged(bool enabled) {
|
| if (enabled) {
|
| // Make the custom page view visible again.
|
| @@ -330,6 +355,17 @@ void AppListMainView::OnCustomLauncherPageEnabledStateChanged(bool enabled) {
|
| contents_view_->start_page_view()->UpdateCustomPageClickzoneVisibility();
|
| }
|
|
|
| +void AppListMainView::OnSearchEngineIsGoogleChanged(bool is_google) {
|
| + if (contents_view_->custom_page_view())
|
| + contents_view_->custom_page_view()->SetVisible(is_google);
|
| +
|
| + if (contents_view_->start_page_view()) {
|
| + contents_view_->start_page_view()->instant_container()->SetVisible(
|
| + is_google);
|
| + contents_view_->start_page_view()->UpdateCustomPageClickzoneVisibility();
|
| + }
|
| +}
|
| +
|
| void AppListMainView::ActivateApp(AppListItem* item, int event_flags) {
|
| // TODO(jennyz): Activate the folder via AppListModel notification.
|
| if (item->GetItemType() == AppListFolderItem::kItemType)
|
|
|