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

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

Issue 10825254: Remove views::KeyEvent, replacing uses of it with ui::KeyEvent. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 | « ui/app_list/search_box_view.h ('k') | ui/app_list/search_result_list_view.h » ('j') | 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/search_box_view.h" 5 #include "ui/app_list/search_box_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ui/app_list/search_box_model.h" 9 #include "ui/app_list/search_box_model.h"
10 #include "ui/app_list/search_box_view_delegate.h" 10 #include "ui/app_list/search_box_view_delegate.h"
11 #include "ui/base/event.h"
11 #include "ui/base/resource/resource_bundle.h" 12 #include "ui/base/resource/resource_bundle.h"
12 #include "ui/views/controls/image_view.h" 13 #include "ui/views/controls/image_view.h"
13 #include "ui/views/controls/textfield/textfield.h" 14 #include "ui/views/controls/textfield/textfield.h"
14 15
15 namespace app_list { 16 namespace app_list {
16 17
17 namespace { 18 namespace {
18 19
19 const int kPadding = 14; 20 const int kPadding = 14;
20 const int kIconDimension = 32; 21 const int kIconDimension = 32;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 delegate_->QueryChanged(this); 108 delegate_->QueryChanged(this);
108 } 109 }
109 110
110 void SearchBoxView::ContentsChanged(views::Textfield* sender, 111 void SearchBoxView::ContentsChanged(views::Textfield* sender,
111 const string16& new_contents) { 112 const string16& new_contents) {
112 UpdateModel(); 113 UpdateModel();
113 NotifyQueryChanged(); 114 NotifyQueryChanged();
114 } 115 }
115 116
116 bool SearchBoxView::HandleKeyEvent(views::Textfield* sender, 117 bool SearchBoxView::HandleKeyEvent(views::Textfield* sender,
117 const views::KeyEvent& key_event) { 118 const ui::KeyEvent& key_event) {
118 bool has_query = !search_box_->text().empty(); 119 bool has_query = !search_box_->text().empty();
119 120
120 // Escape with non-empty query text clears the search box. 121 // Escape with non-empty query text clears the search box.
121 if (has_query && key_event.key_code() == ui::VKEY_ESCAPE) { 122 if (has_query && key_event.key_code() == ui::VKEY_ESCAPE) {
122 search_box_->SetText(string16()); 123 search_box_->SetText(string16());
123 // Updates model and fires query changed manually because SetText above 124 // Updates model and fires query changed manually because SetText above
124 // does not generate ContentsChanged notification. 125 // does not generate ContentsChanged notification.
125 UpdateModel(); 126 UpdateModel();
126 NotifyQueryChanged(); 127 NotifyQueryChanged();
127 return true; 128 return true;
(...skipping 17 matching lines...) Expand all
145 void SearchBoxView::SelectionModelChanged() { 146 void SearchBoxView::SelectionModelChanged() {
146 search_box_->SelectSelectionModel(model_->selection_model()); 147 search_box_->SelectSelectionModel(model_->selection_model());
147 } 148 }
148 149
149 void SearchBoxView::TextChanged() { 150 void SearchBoxView::TextChanged() {
150 search_box_->SetText(model_->text()); 151 search_box_->SetText(model_->text());
151 } 152 }
152 153
153 } // namespace app_list 154 } // namespace app_list
154 155
OLDNEW
« no previous file with comments | « ui/app_list/search_box_view.h ('k') | ui/app_list/search_result_list_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698