OLD | NEW |
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 "grit/ui_resources.h" | 9 #include "grit/ui_resources.h" |
10 #include "ui/app_list/app_list_model.h" | 10 #include "ui/app_list/app_list_model.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 const ui::KeyEvent& key_event) { | 155 const ui::KeyEvent& key_event) { |
156 bool handled = false; | 156 bool handled = false; |
157 if (contents_view_ && contents_view_->visible()) | 157 if (contents_view_ && contents_view_->visible()) |
158 handled = contents_view_->OnKeyPressed(key_event); | 158 handled = contents_view_->OnKeyPressed(key_event); |
159 | 159 |
160 return handled; | 160 return handled; |
161 } | 161 } |
162 | 162 |
163 void SearchBoxView::OnMenuButtonClicked(View* source, const gfx::Point& point) { | 163 void SearchBoxView::OnMenuButtonClicked(View* source, const gfx::Point& point) { |
164 if (!menu_) | 164 if (!menu_) |
165 menu_.reset(new AppListMenuViews(view_delegate_, model_)); | 165 menu_.reset(new AppListMenuViews(view_delegate_)); |
166 | 166 |
167 const gfx::Point menu_location = | 167 const gfx::Point menu_location = |
168 menu_button_->GetBoundsInScreen().bottom_right() + | 168 menu_button_->GetBoundsInScreen().bottom_right() + |
169 gfx::Vector2d(kMenuXOffsetFromButton, kMenuYOffsetFromButton); | 169 gfx::Vector2d(kMenuXOffsetFromButton, kMenuYOffsetFromButton); |
170 menu_->RunMenuAt(menu_button_, menu_location); | 170 menu_->RunMenuAt(menu_button_, menu_location); |
171 } | 171 } |
172 | 172 |
173 void SearchBoxView::IconChanged() { | 173 void SearchBoxView::IconChanged() { |
174 icon_view_->SetImage(model_->search_box()->icon()); | 174 icon_view_->SetImage(model_->search_box()->icon()); |
175 } | 175 } |
176 | 176 |
177 void SearchBoxView::HintTextChanged() { | 177 void SearchBoxView::HintTextChanged() { |
178 search_box_->set_placeholder_text(model_->search_box()->hint_text()); | 178 search_box_->set_placeholder_text(model_->search_box()->hint_text()); |
179 } | 179 } |
180 | 180 |
181 void SearchBoxView::SelectionModelChanged() { | 181 void SearchBoxView::SelectionModelChanged() { |
182 search_box_->SelectSelectionModel(model_->search_box()->selection_model()); | 182 search_box_->SelectSelectionModel(model_->search_box()->selection_model()); |
183 } | 183 } |
184 | 184 |
185 void SearchBoxView::TextChanged() { | 185 void SearchBoxView::TextChanged() { |
186 search_box_->SetText(model_->search_box()->text()); | 186 search_box_->SetText(model_->search_box()->text()); |
187 NotifyQueryChanged(); | 187 NotifyQueryChanged(); |
188 } | 188 } |
189 | 189 |
190 } // namespace app_list | 190 } // namespace app_list |
OLD | NEW |