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

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

Issue 2951903004: Added back button when in folder view. (Closed)
Patch Set: Addressed comments and cached the feature flag. 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
« no previous file with comments | « 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..8c5919e149e54c63d1f9b178f5693389f73aba2e 100644
--- a/ui/app_list/views/search_box_view.cc
+++ b/ui/app_list/views/search_box_view.cc
@@ -172,6 +172,15 @@ SearchBoxView::SearchBoxView(SearchBoxViewDelegate* delegate,
search_box_->set_controller(this);
search_box_->SetTextInputType(ui::TEXT_INPUT_TYPE_SEARCH);
search_box_->SetTextInputFlags(ui::TEXT_INPUT_FLAG_AUTOCORRECT_OFF);
+ 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_);
+
if (is_fullscreen_app_list_enabled_) {
google_icon_ = new views::ImageView();
google_icon_->SetImage(gfx::CreateVectorIcon(
@@ -182,17 +191,8 @@ 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_->SetVisible(false);
} 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 +332,15 @@ 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;
+
+ google_icon_->SetVisible(!show_back_button);
+ back_button_->SetVisible(show_back_button);
+ content_container_->Layout();
+}
+
bool SearchBoxView::OnMouseWheel(const ui::MouseWheelEvent& event) {
if (contents_view_)
return contents_view_->OnMouseWheel(event);
« no previous file with comments | « 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