| 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" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 : host_(host), | 117 : host_(host), |
| 118 show_attention_(false) { | 118 show_attention_(false) { |
| 119 } | 119 } |
| 120 | 120 |
| 121 virtual ~BarView() { | 121 virtual ~BarView() { |
| 122 if (show_attention_) | 122 if (show_attention_) |
| 123 ShelfButtonAnimation::GetInstance()->RemoveObserver(this); | 123 ShelfButtonAnimation::GetInstance()->RemoveObserver(this); |
| 124 } | 124 } |
| 125 | 125 |
| 126 // View | 126 // View |
| 127 virtual bool HitTestRect(const gfx::Rect& rect) const OVERRIDE { | |
| 128 // Allow Mouse...() messages to go to the parent view. | |
| 129 return false; | |
| 130 } | |
| 131 | |
| 132 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { | 127 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { |
| 133 if (show_attention_) { | 128 if (show_attention_) { |
| 134 int alpha = ShelfButtonAnimation::GetInstance()->GetAlpha(); | 129 int alpha = ShelfButtonAnimation::GetInstance()->GetAlpha(); |
| 135 canvas->SaveLayerAlpha(alpha); | 130 canvas->SaveLayerAlpha(alpha); |
| 136 views::ImageView::OnPaint(canvas); | 131 views::ImageView::OnPaint(canvas); |
| 137 canvas->Restore(); | 132 canvas->Restore(); |
| 138 } else { | 133 } else { |
| 139 views::ImageView::OnPaint(canvas); | 134 views::ImageView::OnPaint(canvas); |
| 140 } | 135 } |
| 141 } | 136 } |
| 142 | 137 |
| 138 // ui::EventTarget: |
| 139 virtual bool CanAcceptEvent(const ui::Event& event) OVERRIDE { |
| 140 return false; |
| 141 } |
| 142 |
| 143 // ShelfButtonAnimation::Observer | 143 // ShelfButtonAnimation::Observer |
| 144 virtual void AnimationProgressed() OVERRIDE { | 144 virtual void AnimationProgressed() OVERRIDE { |
| 145 UpdateBounds(); | 145 UpdateBounds(); |
| 146 SchedulePaint(); | 146 SchedulePaint(); |
| 147 } | 147 } |
| 148 | 148 |
| 149 void SetBarBoundsRect(const gfx::Rect& bounds) { | 149 void SetBarBoundsRect(const gfx::Rect& bounds) { |
| 150 base_bounds_ = bounds; | 150 base_bounds_ = bounds; |
| 151 UpdateBounds(); | 151 UpdateBounds(); |
| 152 } | 152 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 | 194 |
| 195 //////////////////////////////////////////////////////////////////////////////// | 195 //////////////////////////////////////////////////////////////////////////////// |
| 196 // ShelfButton::IconView | 196 // ShelfButton::IconView |
| 197 | 197 |
| 198 ShelfButton::IconView::IconView() : icon_size_(kIconSize) { | 198 ShelfButton::IconView::IconView() : icon_size_(kIconSize) { |
| 199 } | 199 } |
| 200 | 200 |
| 201 ShelfButton::IconView::~IconView() { | 201 ShelfButton::IconView::~IconView() { |
| 202 } | 202 } |
| 203 | 203 |
| 204 bool ShelfButton::IconView::HitTestRect(const gfx::Rect& rect) const { | 204 bool ShelfButton::IconView::CanAcceptEvent(const ui::Event& event) { |
| 205 // Return false so that ShelfButton gets all the mouse events. | |
| 206 return false; | 205 return false; |
| 207 } | 206 } |
| 208 | 207 |
| 209 //////////////////////////////////////////////////////////////////////////////// | 208 //////////////////////////////////////////////////////////////////////////////// |
| 210 // ShelfButton | 209 // ShelfButton |
| 211 | 210 |
| 212 ShelfButton* ShelfButton::Create(views::ButtonListener* listener, | 211 ShelfButton* ShelfButton::Create(views::ButtonListener* listener, |
| 213 ShelfButtonHost* host, | 212 ShelfButtonHost* host, |
| 214 ShelfLayoutManager* shelf_layout_manager) { | 213 ShelfLayoutManager* shelf_layout_manager) { |
| 215 ShelfButton* button = new ShelfButton(listener, host, shelf_layout_manager); | 214 ShelfButton* button = new ShelfButton(listener, host, shelf_layout_manager); |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 views::ImageView::CENTER, | 538 views::ImageView::CENTER, |
| 540 views::ImageView::CENTER, | 539 views::ImageView::CENTER, |
| 541 views::ImageView::LEADING)); | 540 views::ImageView::LEADING)); |
| 542 bar_->SchedulePaint(); | 541 bar_->SchedulePaint(); |
| 543 } | 542 } |
| 544 | 543 |
| 545 bar_->SetVisible(bar_id != 0 && state_ != STATE_NORMAL); | 544 bar_->SetVisible(bar_id != 0 && state_ != STATE_NORMAL); |
| 546 } | 545 } |
| 547 | 546 |
| 548 } // namespace ash | 547 } // namespace ash |
| OLD | NEW |