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 "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" | 12 #include "skia/ext/image_operations.h" |
13 #include "ui/aura/event.h" | |
13 #include "ui/base/accessibility/accessible_view_state.h" | 14 #include "ui/base/accessibility/accessible_view_state.h" |
14 #include "ui/base/animation/animation_delegate.h" | 15 #include "ui/base/animation/animation_delegate.h" |
15 #include "ui/base/animation/throb_animation.h" | 16 #include "ui/base/animation/throb_animation.h" |
16 #include "ui/base/resource/resource_bundle.h" | 17 #include "ui/base/resource/resource_bundle.h" |
18 #include "ui/base/events.h" | |
flackr
2012/07/05 14:11:12
Sort
Kevin Greer
2012/07/05 18:35:04
Done.
| |
17 #include "ui/compositor/layer.h" | 19 #include "ui/compositor/layer.h" |
18 #include "ui/compositor/layer_animation_element.h" | 20 #include "ui/compositor/layer_animation_element.h" |
19 #include "ui/compositor/layer_animation_observer.h" | 21 #include "ui/compositor/layer_animation_observer.h" |
20 #include "ui/compositor/layer_animation_sequence.h" | 22 #include "ui/compositor/layer_animation_sequence.h" |
21 #include "ui/compositor/scoped_layer_animation_settings.h" | 23 #include "ui/compositor/scoped_layer_animation_settings.h" |
22 #include "ui/gfx/canvas.h" | 24 #include "ui/gfx/canvas.h" |
23 #include "ui/gfx/image/image.h" | 25 #include "ui/gfx/image/image.h" |
24 #include "ui/gfx/shadow_value.h" | 26 #include "ui/gfx/shadow_value.h" |
25 #include "ui/gfx/skbitmap_operations.h" | 27 #include "ui/gfx/skbitmap_operations.h" |
26 #include "ui/gfx/transform_util.h" | 28 #include "ui/gfx/transform_util.h" |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
318 bar_->ShowAttention(false); | 320 bar_->ShowAttention(false); |
319 if (state & STATE_PENDING) | 321 if (state & STATE_PENDING) |
320 icon_pulse_animation_.reset(); | 322 icon_pulse_animation_.reset(); |
321 } | 323 } |
322 } | 324 } |
323 | 325 |
324 gfx::Rect LauncherButton::GetIconBounds() const { | 326 gfx::Rect LauncherButton::GetIconBounds() const { |
325 return icon_view_->bounds(); | 327 return icon_view_->bounds(); |
326 } | 328 } |
327 | 329 |
330 ui::GestureStatus LauncherButton::OnGestureEvent( | |
331 const views::GestureEvent& event) { | |
332 ui::GestureStatus status = CustomButton::OnGestureEvent(event); | |
333 | |
334 if (event.type() == ui::ET_GESTURE_TAP_DOWN) | |
335 AddState(STATE_HOVERED); | |
flackr
2012/07/05 14:11:12
Since this class derives from CustomButton, I thin
Kevin Greer
2012/07/05 21:06:05
LauncherButton creates its own new set of states t
flackr
2012/07/06 03:12:59
What I have in mind is to use CustomButton's track
| |
336 else if (event.type() == ui::ET_GESTURE_END) | |
337 ClearState(STATE_HOVERED); | |
338 | |
339 return status; | |
340 } | |
341 | |
328 bool LauncherButton::OnMousePressed(const views::MouseEvent& event) { | 342 bool LauncherButton::OnMousePressed(const views::MouseEvent& event) { |
329 CustomButton::OnMousePressed(event); | 343 CustomButton::OnMousePressed(event); |
330 host_->MousePressedOnButton(this, event); | 344 host_->MousePressedOnButton(this, event); |
331 return true; | 345 return true; |
332 } | 346 } |
333 | 347 |
334 void LauncherButton::OnMouseReleased(const views::MouseEvent& event) { | 348 void LauncherButton::OnMouseReleased(const views::MouseEvent& event) { |
335 CustomButton::OnMouseReleased(event); | 349 CustomButton::OnMouseReleased(event); |
336 host_->MouseReleasedOnButton(this, false); | 350 host_->MouseReleasedOnButton(this, false); |
337 } | 351 } |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
463 bar_->SetVerticalAlignment(views::ImageView::CENTER); | 477 bar_->SetVerticalAlignment(views::ImageView::CENTER); |
464 break; | 478 break; |
465 } | 479 } |
466 | 480 |
467 Layout(); | 481 Layout(); |
468 SchedulePaint(); | 482 SchedulePaint(); |
469 } | 483 } |
470 | 484 |
471 } // namespace internal | 485 } // namespace internal |
472 } // namespace ash | 486 } // namespace ash |
OLD | NEW |