| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/shelf/shelf_button.h" | 5 #include "ash/shelf/shelf_button.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/ash_constants.h" | 9 #include "ash/ash_constants.h" |
| 10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
| 11 #include "ash/shelf/shelf_button_host.h" | 11 #include "ash/shelf/shelf_button_host.h" |
| 12 #include "ash/shelf/shelf_layout_manager.h" | 12 #include "ash/shelf/shelf_layout_manager.h" |
| 13 #include "grit/ash_resources.h" | 13 #include "grit/ash_resources.h" |
| 14 #include "skia/ext/image_operations.h" | 14 #include "skia/ext/image_operations.h" |
| 15 #include "ui/accessibility/ax_view_state.h" | 15 #include "ui/accessibility/ax_view_state.h" |
| 16 #include "ui/base/resource/resource_bundle.h" | 16 #include "ui/base/resource/resource_bundle.h" |
| 17 #include "ui/compositor/layer.h" | 17 #include "ui/compositor/layer.h" |
| 18 #include "ui/compositor/scoped_layer_animation_settings.h" | 18 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 19 #include "ui/events/event_constants.h" | 19 #include "ui/events/event_constants.h" |
| 20 #include "ui/gfx/animation/animation_delegate.h" | 20 #include "ui/gfx/animation/animation_delegate.h" |
| 21 #include "ui/gfx/animation/throb_animation.h" | 21 #include "ui/gfx/animation/throb_animation.h" |
| 22 #include "ui/gfx/canvas.h" | 22 #include "ui/gfx/canvas.h" |
| 23 #include "ui/gfx/geometry/vector2d.h" |
| 23 #include "ui/gfx/image/image.h" | 24 #include "ui/gfx/image/image.h" |
| 24 #include "ui/gfx/image/image_skia_operations.h" | 25 #include "ui/gfx/image/image_skia_operations.h" |
| 25 #include "ui/gfx/skbitmap_operations.h" | 26 #include "ui/gfx/skbitmap_operations.h" |
| 26 #include "ui/views/controls/image_view.h" | 27 #include "ui/views/controls/image_view.h" |
| 27 | 28 |
| 28 namespace { | 29 namespace { |
| 29 | 30 |
| 30 // Size of the bar. This is along the opposite axis of the shelf. For example, | 31 // Size of the bar. This is along the opposite axis of the shelf. For example, |
| 31 // if the shelf is aligned horizontally then this is the height of the bar. | 32 // if the shelf is aligned horizontally then this is the height of the bar. |
| 32 const int kBarSize = 3; | 33 const int kBarSize = 3; |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 : CustomButton(listener), | 221 : CustomButton(listener), |
| 221 host_(host), | 222 host_(host), |
| 222 icon_view_(NULL), | 223 icon_view_(NULL), |
| 223 bar_(new BarView(this)), | 224 bar_(new BarView(this)), |
| 224 state_(STATE_NORMAL), | 225 state_(STATE_NORMAL), |
| 225 shelf_layout_manager_(shelf_layout_manager), | 226 shelf_layout_manager_(shelf_layout_manager), |
| 226 destroyed_flag_(NULL) { | 227 destroyed_flag_(NULL) { |
| 227 SetAccessibilityFocusable(true); | 228 SetAccessibilityFocusable(true); |
| 228 | 229 |
| 229 const gfx::ShadowValue kShadows[] = { | 230 const gfx::ShadowValue kShadows[] = { |
| 230 gfx::ShadowValue(gfx::Point(0, 2), 0, SkColorSetARGB(0x1A, 0, 0, 0)), | 231 gfx::ShadowValue(gfx::Vector2d(0, 2), 0, SkColorSetARGB(0x1A, 0, 0, 0)), |
| 231 gfx::ShadowValue(gfx::Point(0, 3), 1, SkColorSetARGB(0x1A, 0, 0, 0)), | 232 gfx::ShadowValue(gfx::Vector2d(0, 3), 1, SkColorSetARGB(0x1A, 0, 0, 0)), |
| 232 gfx::ShadowValue(gfx::Point(0, 0), 1, SkColorSetARGB(0x54, 0, 0, 0)), | 233 gfx::ShadowValue(gfx::Vector2d(0, 0), 1, SkColorSetARGB(0x54, 0, 0, 0)), |
| 233 }; | 234 }; |
| 234 icon_shadows_.assign(kShadows, kShadows + arraysize(kShadows)); | 235 icon_shadows_.assign(kShadows, kShadows + arraysize(kShadows)); |
| 235 | 236 |
| 236 AddChildView(bar_); | 237 AddChildView(bar_); |
| 237 } | 238 } |
| 238 | 239 |
| 239 ShelfButton::~ShelfButton() { | 240 ShelfButton::~ShelfButton() { |
| 240 if (destroyed_flag_) | 241 if (destroyed_flag_) |
| 241 *destroyed_flag_ = true; | 242 *destroyed_flag_ = true; |
| 242 } | 243 } |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 views::ImageView::CENTER, | 546 views::ImageView::CENTER, |
| 546 views::ImageView::CENTER, | 547 views::ImageView::CENTER, |
| 547 views::ImageView::LEADING)); | 548 views::ImageView::LEADING)); |
| 548 bar_->SchedulePaint(); | 549 bar_->SchedulePaint(); |
| 549 } | 550 } |
| 550 | 551 |
| 551 bar_->SetVisible(bar_id != 0 && state_ != STATE_NORMAL); | 552 bar_->SetVisible(bar_id != 0 && state_ != STATE_NORMAL); |
| 552 } | 553 } |
| 553 | 554 |
| 554 } // namespace ash | 555 } // namespace ash |
| OLD | NEW |