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

Side by Side Diff: ui/app_list/views/search_box_view.cc

Issue 503693002: Remove the search icon from the search box in the experimental app list. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/app_list/views/search_box_view.h" 5 #include "ui/app_list/views/search_box_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ui/app_list/app_list_model.h" 9 #include "ui/app_list/app_list_model.h"
10 #include "ui/app_list/app_list_switches.h" 10 #include "ui/app_list/app_list_switches.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 DISALLOW_COPY_AND_ASSIGN(SearchBoxBackground); 76 DISALLOW_COPY_AND_ASSIGN(SearchBoxBackground);
77 }; 77 };
78 78
79 } // namespace 79 } // namespace
80 80
81 SearchBoxView::SearchBoxView(SearchBoxViewDelegate* delegate, 81 SearchBoxView::SearchBoxView(SearchBoxViewDelegate* delegate,
82 AppListViewDelegate* view_delegate) 82 AppListViewDelegate* view_delegate)
83 : delegate_(delegate), 83 : delegate_(delegate),
84 view_delegate_(view_delegate), 84 view_delegate_(view_delegate),
85 model_(NULL), 85 model_(NULL),
86 icon_view_(new views::ImageView), 86 icon_view_(NULL),
87 speech_button_(NULL), 87 speech_button_(NULL),
88 search_box_(new views::Textfield), 88 search_box_(new views::Textfield),
89 contents_view_(NULL) { 89 contents_view_(NULL) {
90 AddChildView(icon_view_); 90 if (switches::IsExperimentalAppListEnabled()) {
91 if (switches::IsExperimentalAppListEnabled())
92 set_background(new SearchBoxBackground()); 91 set_background(new SearchBoxBackground());
92 } else {
93 icon_view_ = new views::ImageView;
94 AddChildView(icon_view_);
95 }
93 96
94 views::BoxLayout* layout = new views::BoxLayout( 97 views::BoxLayout* layout = new views::BoxLayout(
95 views::BoxLayout::kHorizontal, kPadding, 0, kPadding); 98 views::BoxLayout::kHorizontal, kPadding, 0, kPadding);
96 SetLayoutManager(layout); 99 SetLayoutManager(layout);
97 layout->set_cross_axis_alignment( 100 layout->set_cross_axis_alignment(
98 views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER); 101 views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER);
99 layout->set_minimum_cross_axis_size(switches::IsExperimentalAppListEnabled() 102 layout->set_minimum_cross_axis_size(switches::IsExperimentalAppListEnabled()
100 ? kExperimentalSearchBoxHeight 103 ? kExperimentalSearchBoxHeight
101 : kPreferredHeight); 104 : kPreferredHeight);
102 105
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 if (!menu_) 215 if (!menu_)
213 menu_.reset(new AppListMenuViews(view_delegate_)); 216 menu_.reset(new AppListMenuViews(view_delegate_));
214 217
215 const gfx::Point menu_location = 218 const gfx::Point menu_location =
216 menu_button_->GetBoundsInScreen().bottom_right() + 219 menu_button_->GetBoundsInScreen().bottom_right() +
217 gfx::Vector2d(kMenuXOffsetFromButton, kMenuYOffsetFromButton); 220 gfx::Vector2d(kMenuXOffsetFromButton, kMenuYOffsetFromButton);
218 menu_->RunMenuAt(menu_button_, menu_location); 221 menu_->RunMenuAt(menu_button_, menu_location);
219 } 222 }
220 223
221 void SearchBoxView::IconChanged() { 224 void SearchBoxView::IconChanged() {
222 icon_view_->SetImage(model_->search_box()->icon()); 225 if (icon_view_)
226 icon_view_->SetImage(model_->search_box()->icon());
223 } 227 }
224 228
225 void SearchBoxView::SpeechRecognitionButtonPropChanged() { 229 void SearchBoxView::SpeechRecognitionButtonPropChanged() {
226 const SearchBoxModel::SpeechButtonProperty* speech_button_prop = 230 const SearchBoxModel::SpeechButtonProperty* speech_button_prop =
227 model_->search_box()->speech_button(); 231 model_->search_box()->speech_button();
228 if (speech_button_prop) { 232 if (speech_button_prop) {
229 if (!speech_button_) { 233 if (!speech_button_) {
230 speech_button_ = new views::ImageButton(this); 234 speech_button_ = new views::ImageButton(this);
231 AddChildView(speech_button_); 235 AddChildView(speech_button_);
232 } 236 }
(...skipping 30 matching lines...) Expand all
263 NotifyQueryChanged(); 267 NotifyQueryChanged();
264 } 268 }
265 269
266 void SearchBoxView::OnSpeechRecognitionStateChanged( 270 void SearchBoxView::OnSpeechRecognitionStateChanged(
267 SpeechRecognitionState new_state) { 271 SpeechRecognitionState new_state) {
268 SpeechRecognitionButtonPropChanged(); 272 SpeechRecognitionButtonPropChanged();
269 SchedulePaint(); 273 SchedulePaint();
270 } 274 }
271 275
272 } // namespace app_list 276 } // namespace app_list
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698