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/contents_view.h" | 5 #include "ui/app_list/contents_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ui/app_list/app_list_view.h" | 9 #include "ui/app_list/app_list_view.h" |
10 #include "ui/app_list/apps_grid_view.h" | 10 #include "ui/app_list/apps_grid_view.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 results_size.height()); | 180 results_size.height()); |
181 return gfx::Size(width, height); | 181 return gfx::Size(width, height); |
182 } | 182 } |
183 | 183 |
184 void ContentsView::Layout() { | 184 void ContentsView::Layout() { |
185 CalculateIdealBounds(); | 185 CalculateIdealBounds(); |
186 views::ViewModelUtils::SetViewBoundsToIdealBounds(*view_model_); | 186 views::ViewModelUtils::SetViewBoundsToIdealBounds(*view_model_); |
187 } | 187 } |
188 | 188 |
189 ui::GestureStatus ContentsView::OnGestureEvent( | 189 ui::GestureStatus ContentsView::OnGestureEvent( |
190 const views::GestureEvent& event) { | 190 const ui::GestureEvent& event) { |
191 if (show_state_ != SHOW_APPS) | 191 if (show_state_ != SHOW_APPS) |
192 return ui::GESTURE_STATUS_UNKNOWN; | 192 return ui::GESTURE_STATUS_UNKNOWN; |
193 | 193 |
194 switch (event.type()) { | 194 switch (event.type()) { |
195 case ui::ET_GESTURE_SCROLL_BEGIN: | 195 case ui::ET_GESTURE_SCROLL_BEGIN: |
196 pagination_model_->StartScroll(); | 196 pagination_model_->StartScroll(); |
197 return ui::GESTURE_STATUS_CONSUMED; | 197 return ui::GESTURE_STATUS_CONSUMED; |
198 case ui::ET_GESTURE_SCROLL_UPDATE: | 198 case ui::ET_GESTURE_SCROLL_UPDATE: |
199 // event.details.scroll_x() > 0 means moving contents to right. That is, | 199 // event.details.scroll_x() > 0 means moving contents to right. That is, |
200 // transitioning to previous page. | 200 // transitioning to previous page. |
(...skipping 25 matching lines...) Expand all Loading... |
226 case SHOW_APPS: | 226 case SHOW_APPS: |
227 return GetAppsGridView(view_model_.get())->OnKeyPressed(event); | 227 return GetAppsGridView(view_model_.get())->OnKeyPressed(event); |
228 case SHOW_SEARCH_RESULTS: | 228 case SHOW_SEARCH_RESULTS: |
229 return GetSearchResultListView(view_model_.get())->OnKeyPressed(event); | 229 return GetSearchResultListView(view_model_.get())->OnKeyPressed(event); |
230 default: | 230 default: |
231 NOTREACHED() << "Unknown show state " << show_state_; | 231 NOTREACHED() << "Unknown show state " << show_state_; |
232 } | 232 } |
233 return false; | 233 return false; |
234 } | 234 } |
235 | 235 |
236 bool ContentsView::OnMouseWheel(const views::MouseWheelEvent& event) { | 236 bool ContentsView::OnMouseWheel(const ui::MouseWheelEvent& event) { |
237 if (show_state_ != SHOW_APPS) | 237 if (show_state_ != SHOW_APPS) |
238 return false; | 238 return false; |
239 | 239 |
240 if (abs(event.offset()) > kMinMouseWheelToSwitchPage) { | 240 if (abs(event.offset()) > kMinMouseWheelToSwitchPage) { |
241 if (!pagination_model_->has_transition()) | 241 if (!pagination_model_->has_transition()) |
242 pagination_model_->SelectPageRelative(event.offset() > 0 ? -1 : 1, true); | 242 pagination_model_->SelectPageRelative(event.offset() > 0 ? -1 : 1, true); |
243 return true; | 243 return true; |
244 } | 244 } |
245 | 245 |
246 return false; | 246 return false; |
247 } | 247 } |
248 | 248 |
249 bool ContentsView::OnScrollEvent(const views::ScrollEvent & event) { | 249 bool ContentsView::OnScrollEvent(const ui::ScrollEvent& event) { |
250 if (show_state_ != SHOW_APPS) | 250 if (show_state_ != SHOW_APPS) |
251 return false; | 251 return false; |
252 | 252 |
253 if (abs(event.x_offset()) > kMinScrollToSwitchPage) { | 253 if (abs(event.x_offset()) > kMinScrollToSwitchPage) { |
254 if (!pagination_model_->has_transition()) { | 254 if (!pagination_model_->has_transition()) { |
255 pagination_model_->SelectPageRelative(event.x_offset() > 0 ? 1 : -1, | 255 pagination_model_->SelectPageRelative(event.x_offset() > 0 ? 1 : -1, |
256 true); | 256 true); |
257 } | 257 } |
258 return true; | 258 return true; |
259 } | 259 } |
260 | 260 |
261 return false; | 261 return false; |
262 } | 262 } |
263 | 263 |
264 } // namespace app_list | 264 } // namespace app_list |
OLD | NEW |