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

Unified Diff: ui/app_list/views/app_list_main_view.cc

Issue 907833002: Hide experimental app list Google logo and custom launcher page when search engine is not Google. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@update_app_list_bg_color
Patch Set: address comment, add service dependency Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/app_list/views/app_list_main_view.h ('k') | ui/app_list/views/contents_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « ui/app_list/views/app_list_main_view.h ('k') | ui/app_list/views/contents_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698