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

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

Issue 2951903004: Added back button when in folder view. (Closed)
Patch Set: Added back button when in folder view. Created 3 years, 6 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
« ui/app_list/views/contents_view.cc ('K') | « ui/app_list/views/search_box_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/app_list/views/search_box_view.cc
diff --git a/ui/app_list/views/search_box_view.cc b/ui/app_list/views/search_box_view.cc
index 7841388bd63fffa5cdfefc49a25236866a59fb02..7ede992bacce4e176ca31e4d6eaf5b4544ef5e9a 100644
--- a/ui/app_list/views/search_box_view.cc
+++ b/ui/app_list/views/search_box_view.cc
@@ -182,17 +182,19 @@ SearchBoxView::SearchBoxView(SearchBoxViewDelegate* delegate,
search_box_->set_placeholder_text_draw_flags(
gfx::Canvas::TEXT_ALIGN_CENTER);
search_box_->SetFontList(search_box_->GetFontList().DeriveWithSizeDelta(2));
+ }
+ back_button_ = new SearchBoxImageButton(this);
+ ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
+ back_button_->SetImage(views::ImageButton::STATE_NORMAL,
+ rb.GetImageSkiaNamed(IDR_APP_LIST_FOLDER_BACK_NORMAL));
+ back_button_->SetImageAlignment(views::ImageButton::ALIGN_CENTER,
+ views::ImageButton::ALIGN_MIDDLE);
+ SetBackButtonLabel(false);
+
+ if (is_fullscreen_app_list_enabled_) {
+ content_container_->AddChildView(google_icon_);
vadimt 2017/06/22 18:28:08 Google icon is supposed to be owned by view hierar
newcomer 2017/06/23 23:28:08 I took xiyuan@'s suggestion of setting the visibil
} else {
- back_button_ = new SearchBoxImageButton(this);
- ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
- back_button_->SetImage(
- views::ImageButton::STATE_NORMAL,
- rb.GetImageSkiaNamed(IDR_APP_LIST_FOLDER_BACK_NORMAL));
- back_button_->SetImageAlignment(views::ImageButton::ALIGN_CENTER,
- views::ImageButton::ALIGN_MIDDLE);
- SetBackButtonLabel(false);
content_container_->AddChildView(back_button_);
-
search_box_->set_placeholder_text_color(kHintTextColor);
}
content_container_->AddChildView(search_box_);
@@ -332,6 +334,22 @@ void SearchBoxView::SetBackButtonLabel(bool folder) {
back_button_->SetTooltipText(back_button_label);
}
+void SearchBoxView::ShowBackOrGoogleIcon(bool show_back_button) {
+ if (!is_fullscreen_app_list_enabled_)
+ return;
+
+ if (show_back_button) {
+ content_container_->AddChildViewAt(
+ back_button_, content_container_->GetIndexOf(google_icon_));
+ content_container_->RemoveChildView(google_icon_);
+ } else {
+ content_container_->AddChildViewAt(
+ google_icon_, content_container_->GetIndexOf(back_button_));
+ content_container_->RemoveChildView(back_button_);
xiyuan 2017/06/22 17:33:24 The current code assumes |google_icon_| and |back_
newcomer 2017/06/23 23:28:08 I set the visibility as that makes more sense to m
+ }
+ content_container_->Layout();
+}
+
bool SearchBoxView::OnMouseWheel(const ui::MouseWheelEvent& event) {
if (contents_view_)
return contents_view_->OnMouseWheel(event);
« ui/app_list/views/contents_view.cc ('K') | « ui/app_list/views/search_box_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698