| 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 { | 127 virtual bool HitTestRect(const gfx::RectF& rect) const OVERRIDE { |
| 128 // Allow Mouse...() messages to go to the parent view. | 128 // Allow Mouse...() messages to go to the parent view. |
| 129 return false; | 129 return false; |
| 130 } | 130 } |
| 131 | 131 |
| 132 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { | 132 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { |
| 133 if (show_attention_) { | 133 if (show_attention_) { |
| 134 int alpha = ShelfButtonAnimation::GetInstance()->GetAlpha(); | 134 int alpha = ShelfButtonAnimation::GetInstance()->GetAlpha(); |
| 135 canvas->SaveLayerAlpha(alpha); | 135 canvas->SaveLayerAlpha(alpha); |
| 136 views::ImageView::OnPaint(canvas); | 136 views::ImageView::OnPaint(canvas); |
| 137 canvas->Restore(); | 137 canvas->Restore(); |
| (...skipping 56 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::HitTestRect(const gfx::RectF& rect) const { |
| 205 // Return false so that ShelfButton gets all the mouse events. | 205 // Return false so that ShelfButton gets all the mouse events. |
| 206 return false; | 206 return false; |
| 207 } | 207 } |
| 208 | 208 |
| 209 //////////////////////////////////////////////////////////////////////////////// | 209 //////////////////////////////////////////////////////////////////////////////// |
| 210 // ShelfButton | 210 // ShelfButton |
| 211 | 211 |
| 212 ShelfButton* ShelfButton::Create(views::ButtonListener* listener, | 212 ShelfButton* ShelfButton::Create(views::ButtonListener* listener, |
| 213 ShelfButtonHost* host, | 213 ShelfButtonHost* host, |
| 214 ShelfLayoutManager* shelf_layout_manager) { | 214 ShelfLayoutManager* shelf_layout_manager) { |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 views::ImageView::CENTER, | 539 views::ImageView::CENTER, |
| 540 views::ImageView::CENTER, | 540 views::ImageView::CENTER, |
| 541 views::ImageView::LEADING)); | 541 views::ImageView::LEADING)); |
| 542 bar_->SchedulePaint(); | 542 bar_->SchedulePaint(); |
| 543 } | 543 } |
| 544 | 544 |
| 545 bar_->SetVisible(bar_id != 0 && state_ != STATE_NORMAL); | 545 bar_->SetVisible(bar_id != 0 && state_ != STATE_NORMAL); |
| 546 } | 546 } |
| 547 | 547 |
| 548 } // namespace ash | 548 } // namespace ash |
| OLD | NEW |