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 436641c7c2550e46c81869dff42d3e6d3f1c743b..dc8d18065f8d62f7ffb072b2bc1bde63c26d08d5 100644 |
--- a/ui/app_list/views/app_list_main_view.cc |
+++ b/ui/app_list/views/app_list_main_view.cc |
@@ -106,6 +106,8 @@ void AppListMainView::Init(gfx::NativeView parent, |
// Starts icon loading early. |
PreloadIcons(parent); |
+ |
+ OnSearchEngineIsGoogleChanged(model_->search_engine_is_google()); |
} |
void AppListMainView::AddContentsViews() { |
@@ -241,6 +243,28 @@ void AppListMainView::NotifySearchBoxVisibilityChanged() { |
parent()->SchedulePaint(); |
} |
+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. |
@@ -257,6 +281,16 @@ void AppListMainView::OnCustomLauncherPageEnabledStateChanged(bool enabled) { |
} |
} |
+void AppListMainView::OnSearchEngineIsGoogleChanged(bool is_google) { |
+ if (contents_view_->custom_page_view()) |
+ OnCustomLauncherPageEnabledStateChanged(is_google); |
+ |
+ if (contents_view_->start_page_view()) { |
+ contents_view_->start_page_view()->instant_container()->SetVisible( |
+ is_google); |
+ } |
+} |
+ |
void AppListMainView::ActivateApp(AppListItem* item, int event_flags) { |
// TODO(jennyz): Activate the folder via AppListModel notification. |
if (item->GetItemType() == AppListFolderItem::kItemType) |