| 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/app_list_item_view.h" | 5 #include "ui/app_list/views/app_list_item_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "grit/ui_resources.h" | 10 #include "grit/ui_resources.h" |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 canvas->DrawImageInt(right, x, bar_y); | 263 canvas->DrawImageInt(right, x, bar_y); |
| 264 } | 264 } |
| 265 } | 265 } |
| 266 } | 266 } |
| 267 | 267 |
| 268 void AppListItemView::GetAccessibleState(ui::AccessibleViewState* state) { | 268 void AppListItemView::GetAccessibleState(ui::AccessibleViewState* state) { |
| 269 state->role = ui::AccessibilityTypes::ROLE_PUSHBUTTON; | 269 state->role = ui::AccessibilityTypes::ROLE_PUSHBUTTON; |
| 270 state->name = UTF8ToUTF16(model_->title()); | 270 state->name = UTF8ToUTF16(model_->title()); |
| 271 } | 271 } |
| 272 | 272 |
| 273 void AppListItemView::ShowContextMenuForView(views::View* source, | 273 void AppListItemView::ShowContextMenuForView( |
| 274 const gfx::Point& point) { | 274 views::View* source, |
| 275 const gfx::Point& point, |
| 276 ui::ContextMenuSourceType source_type) { |
| 275 ui::MenuModel* menu_model = model_->GetContextMenuModel(); | 277 ui::MenuModel* menu_model = model_->GetContextMenuModel(); |
| 276 if (!menu_model) | 278 if (!menu_model) |
| 277 return; | 279 return; |
| 278 | 280 |
| 279 context_menu_runner_.reset(new views::MenuRunner(menu_model)); | 281 context_menu_runner_.reset(new views::MenuRunner(menu_model)); |
| 280 if (context_menu_runner_->RunMenuAt( | 282 if (context_menu_runner_->RunContextMenuAt( |
| 281 GetWidget(), NULL, gfx::Rect(point, gfx::Size()), | 283 GetWidget(), NULL, gfx::Rect(point, gfx::Size()), |
| 282 views::MenuItemView::TOPLEFT, views::MenuRunner::HAS_MNEMONICS) == | 284 source_type, views::MenuRunner::HAS_MNEMONICS) == |
| 283 views::MenuRunner::MENU_DELETED) | 285 views::MenuRunner::MENU_DELETED) |
| 284 return; | 286 return; |
| 285 } | 287 } |
| 286 | 288 |
| 287 void AppListItemView::StateChanged() { | 289 void AppListItemView::StateChanged() { |
| 288 if (state() == STATE_HOVERED || state() == STATE_PRESSED) { | 290 if (state() == STATE_HOVERED || state() == STATE_PRESSED) { |
| 289 apps_grid_view_->SetSelectedView(this); | 291 apps_grid_view_->SetSelectedView(this); |
| 290 title_->SetEnabledColor(kTitleHoverColor); | 292 title_->SetEnabledColor(kTitleHoverColor); |
| 291 } else { | 293 } else { |
| 292 apps_grid_view_->ClearSelectedView(this); | 294 apps_grid_view_->ClearSelectedView(this); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 SetTouchDragging(false); | 395 SetTouchDragging(false); |
| 394 break; | 396 break; |
| 395 default: | 397 default: |
| 396 break; | 398 break; |
| 397 } | 399 } |
| 398 if (!event->handled()) | 400 if (!event->handled()) |
| 399 CustomButton::OnGestureEvent(event); | 401 CustomButton::OnGestureEvent(event); |
| 400 } | 402 } |
| 401 | 403 |
| 402 } // namespace app_list | 404 } // namespace app_list |
| OLD | NEW |