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

Side by Side Diff: ash/launcher/launcher_button.cc

Issue 10702102: Added hover feedback on touch to launcher buttons. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Merge with trunk Created 8 years, 5 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 | « ash/launcher/launcher_button.h ('k') | no next file » | 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 "ash/launcher/launcher_button.h" 5 #include "ash/launcher/launcher_button.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/launcher/launcher_button_host.h" 10 #include "ash/launcher/launcher_button_host.h"
11 #include "grit/ui_resources.h" 11 #include "grit/ui_resources.h"
12 #include "skia/ext/image_operations.h"
13 #include "ui/aura/event.h"
12 #include "ui/base/accessibility/accessible_view_state.h" 14 #include "ui/base/accessibility/accessible_view_state.h"
13 #include "ui/base/animation/animation_delegate.h" 15 #include "ui/base/animation/animation_delegate.h"
14 #include "ui/base/animation/throb_animation.h" 16 #include "ui/base/animation/throb_animation.h"
17 #include "ui/base/events.h"
15 #include "ui/base/resource/resource_bundle.h" 18 #include "ui/base/resource/resource_bundle.h"
16 #include "ui/compositor/layer.h" 19 #include "ui/compositor/layer.h"
17 #include "ui/compositor/layer_animation_element.h" 20 #include "ui/compositor/layer_animation_element.h"
18 #include "ui/compositor/layer_animation_observer.h" 21 #include "ui/compositor/layer_animation_observer.h"
19 #include "ui/compositor/layer_animation_sequence.h" 22 #include "ui/compositor/layer_animation_sequence.h"
20 #include "ui/compositor/scoped_layer_animation_settings.h" 23 #include "ui/compositor/scoped_layer_animation_settings.h"
21 #include "ui/gfx/canvas.h" 24 #include "ui/gfx/canvas.h"
22 #include "ui/gfx/image/image.h" 25 #include "ui/gfx/image/image.h"
23 #include "ui/gfx/image/image_skia_operations.h" 26 #include "ui/gfx/image/image_skia_operations.h"
24 #include "ui/gfx/transform_util.h" 27 #include "ui/gfx/transform_util.h"
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 362
360 void LauncherButton::OnMouseExited(const views::MouseEvent& event) { 363 void LauncherButton::OnMouseExited(const views::MouseEvent& event) {
361 ClearState(STATE_HOVERED); 364 ClearState(STATE_HOVERED);
362 CustomButton::OnMouseExited(event); 365 CustomButton::OnMouseExited(event);
363 host_->MouseExitedButton(this); 366 host_->MouseExitedButton(this);
364 } 367 }
365 368
366 ui::GestureStatus LauncherButton::OnGestureEvent( 369 ui::GestureStatus LauncherButton::OnGestureEvent(
367 const views::GestureEvent& event) { 370 const views::GestureEvent& event) {
368 switch (event.type()) { 371 switch (event.type()) {
372 case ui::ET_GESTURE_TAP_DOWN:
373 AddState(STATE_HOVERED);
374 return CustomButton::OnGestureEvent(event);
375 case ui::ET_GESTURE_END:
376 ClearState(STATE_HOVERED);
377 return CustomButton::OnGestureEvent(event);
369 case ui::ET_GESTURE_SCROLL_BEGIN: 378 case ui::ET_GESTURE_SCROLL_BEGIN:
370 host_->PointerPressedOnButton(this, LauncherButtonHost::TOUCH, event); 379 host_->PointerPressedOnButton(this, LauncherButtonHost::TOUCH, event);
371 return ui::GESTURE_STATUS_CONSUMED; 380 return ui::GESTURE_STATUS_CONSUMED;
372 case ui::ET_GESTURE_SCROLL_UPDATE: 381 case ui::ET_GESTURE_SCROLL_UPDATE:
373 host_->PointerDraggedOnButton(this, LauncherButtonHost::TOUCH, event); 382 host_->PointerDraggedOnButton(this, LauncherButtonHost::TOUCH, event);
374 return ui::GESTURE_STATUS_CONSUMED; 383 return ui::GESTURE_STATUS_CONSUMED;
375 case ui::ET_GESTURE_SCROLL_END: 384 case ui::ET_GESTURE_SCROLL_END:
376 host_->PointerReleasedOnButton(this, LauncherButtonHost::TOUCH, false); 385 host_->PointerReleasedOnButton(this, LauncherButtonHost::TOUCH, false);
377 return ui::GESTURE_STATUS_CONSUMED; 386 return ui::GESTURE_STATUS_CONSUMED;
378 default: 387 default:
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 bar_->SetVerticalAlignment(views::ImageView::CENTER); 503 bar_->SetVerticalAlignment(views::ImageView::CENTER);
495 break; 504 break;
496 } 505 }
497 506
498 Layout(); 507 Layout();
499 SchedulePaint(); 508 SchedulePaint();
500 } 509 }
501 510
502 } // namespace internal 511 } // namespace internal
503 } // namespace ash 512 } // namespace ash
OLDNEW
« no previous file with comments | « ash/launcher/launcher_button.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698