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 "chrome/browser/ui/views/download/download_item_view.h" | 5 #include "chrome/browser/ui/views/download/download_item_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 state->state = ui::AccessibilityTypes::STATE_UNAVAILABLE; | 498 state->state = ui::AccessibilityTypes::STATE_UNAVAILABLE; |
499 } else { | 499 } else { |
500 state->state = ui::AccessibilityTypes::STATE_HASPOPUP; | 500 state->state = ui::AccessibilityTypes::STATE_HASPOPUP; |
501 } | 501 } |
502 } | 502 } |
503 | 503 |
504 void DownloadItemView::OnThemeChanged() { | 504 void DownloadItemView::OnThemeChanged() { |
505 UpdateColorsFromTheme(); | 505 UpdateColorsFromTheme(); |
506 } | 506 } |
507 | 507 |
508 ui::EventResult DownloadItemView::OnGestureEvent(ui::GestureEvent* event) { | 508 void DownloadItemView::OnGestureEvent(ui::GestureEvent* event) { |
509 if (event->type() == ui::ET_GESTURE_TAP_DOWN) { | 509 if (event->type() == ui::ET_GESTURE_TAP_DOWN) { |
510 HandlePressEvent(*event, true); | 510 HandlePressEvent(*event, true); |
511 return ui::ER_CONSUMED; | 511 event->SetHandled(); |
| 512 return; |
512 } | 513 } |
513 | 514 |
514 if (event->type() == ui::ET_GESTURE_TAP) { | 515 if (event->type() == ui::ET_GESTURE_TAP) { |
515 HandleClickEvent(*event, true); | 516 HandleClickEvent(*event, true); |
516 return ui::ER_CONSUMED; | 517 event->SetHandled(); |
| 518 return; |
517 } | 519 } |
518 | 520 |
519 SetState(NORMAL, NORMAL); | 521 SetState(NORMAL, NORMAL); |
520 return views::View::OnGestureEvent(event); | 522 views::View::OnGestureEvent(event); |
521 } | 523 } |
522 | 524 |
523 void DownloadItemView::ShowContextMenuForView(View* source, | 525 void DownloadItemView::ShowContextMenuForView(View* source, |
524 const gfx::Point& point) { | 526 const gfx::Point& point) { |
525 // |point| is in screen coordinates. So convert it to local coordinates first. | 527 // |point| is in screen coordinates. So convert it to local coordinates first. |
526 gfx::Point local_point = point; | 528 gfx::Point local_point = point; |
527 ConvertPointFromScreen(this, &local_point); | 529 ConvertPointFromScreen(this, &local_point); |
528 ShowContextMenuImpl(local_point, true); | 530 ShowContextMenuImpl(local_point, true); |
529 } | 531 } |
530 | 532 |
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1223 void DownloadItemView::AnimateStateTransition(State from, State to, | 1225 void DownloadItemView::AnimateStateTransition(State from, State to, |
1224 ui::SlideAnimation* animation) { | 1226 ui::SlideAnimation* animation) { |
1225 if (from == NORMAL && to == HOT) { | 1227 if (from == NORMAL && to == HOT) { |
1226 animation->Show(); | 1228 animation->Show(); |
1227 } else if (from == HOT && to == NORMAL) { | 1229 } else if (from == HOT && to == NORMAL) { |
1228 animation->Hide(); | 1230 animation->Hide(); |
1229 } else if (from != to) { | 1231 } else if (from != to) { |
1230 animation->Reset((to == HOT) ? 1.0 : 0.0); | 1232 animation->Reset((to == HOT) ? 1.0 : 0.0); |
1231 } | 1233 } |
1232 } | 1234 } |
OLD | NEW |