| 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_switches.h" | 9 #include "ash/ash_switches.h" |
| 10 #include "ash/common/ash_constants.h" | 10 #include "ash/common/ash_constants.h" |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 Layout(); | 338 Layout(); |
| 339 if (state & STATE_ATTENTION) | 339 if (state & STATE_ATTENTION) |
| 340 bar_->ShowAttention(false); | 340 bar_->ShowAttention(false); |
| 341 } | 341 } |
| 342 } | 342 } |
| 343 | 343 |
| 344 gfx::Rect ShelfButton::GetIconBounds() const { | 344 gfx::Rect ShelfButton::GetIconBounds() const { |
| 345 return icon_view_->bounds(); | 345 return icon_view_->bounds(); |
| 346 } | 346 } |
| 347 | 347 |
| 348 void ShelfButton::OnDragStarted() { | 348 void ShelfButton::OnDragStarted(const ui::LocatedEvent* event) { |
| 349 AnimateInkDrop(views::InkDropState::HIDDEN); | 349 AnimateInkDrop(views::InkDropState::HIDDEN, event); |
| 350 } | 350 } |
| 351 | 351 |
| 352 void ShelfButton::ShowContextMenu(const gfx::Point& p, | 352 void ShelfButton::ShowContextMenu(const gfx::Point& p, |
| 353 ui::MenuSourceType source_type) { | 353 ui::MenuSourceType source_type) { |
| 354 if (!context_menu_controller()) | 354 if (!context_menu_controller()) |
| 355 return; | 355 return; |
| 356 | 356 |
| 357 bool destroyed = false; | 357 bool destroyed = false; |
| 358 destroyed_flag_ = &destroyed; | 358 destroyed_flag_ = &destroyed; |
| 359 | 359 |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 default: | 496 default: |
| 497 return CustomButton::OnGestureEvent(event); | 497 return CustomButton::OnGestureEvent(event); |
| 498 } | 498 } |
| 499 } | 499 } |
| 500 | 500 |
| 501 std::unique_ptr<views::InkDropRipple> ShelfButton::CreateInkDropRipple() const { | 501 std::unique_ptr<views::InkDropRipple> ShelfButton::CreateInkDropRipple() const { |
| 502 return base::WrapUnique(new views::SquareInkDropRipple( | 502 return base::WrapUnique(new views::SquareInkDropRipple( |
| 503 gfx::Size(kInkDropLargeSize, kInkDropLargeSize), | 503 gfx::Size(kInkDropLargeSize, kInkDropLargeSize), |
| 504 kInkDropLargeCornerRadius, | 504 kInkDropLargeCornerRadius, |
| 505 gfx::Size(kInkDropSmallSize, kInkDropSmallSize), | 505 gfx::Size(kInkDropSmallSize, kInkDropSmallSize), |
| 506 kInkDropSmallCornerRadius, GetInkDropCenter(), GetInkDropBaseColor())); | 506 kInkDropSmallCornerRadius, GetLocalBounds().CenterPoint(), |
| 507 GetInkDropBaseColor())); |
| 507 } | 508 } |
| 508 | 509 |
| 509 bool ShelfButton::ShouldEnterPushedState(const ui::Event& event) { | 510 bool ShelfButton::ShouldEnterPushedState(const ui::Event& event) { |
| 510 if (!shelf_view_->ShouldEventActivateButton(this, event)) | 511 if (!shelf_view_->ShouldEventActivateButton(this, event)) |
| 511 return false; | 512 return false; |
| 512 | 513 |
| 513 return CustomButton::ShouldEnterPushedState(event); | 514 return CustomButton::ShouldEnterPushedState(event); |
| 514 } | 515 } |
| 515 | 516 |
| 516 bool ShelfButton::ShouldShowInkDropHighlight() const { | 517 bool ShelfButton::ShouldShowInkDropHighlight() const { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 views::ImageView::TRAILING)); | 573 views::ImageView::TRAILING)); |
| 573 bar_->SetVerticalAlignment(shelf->SelectValueForShelfAlignment( | 574 bar_->SetVerticalAlignment(shelf->SelectValueForShelfAlignment( |
| 574 views::ImageView::TRAILING, views::ImageView::CENTER, | 575 views::ImageView::TRAILING, views::ImageView::CENTER, |
| 575 views::ImageView::CENTER)); | 576 views::ImageView::CENTER)); |
| 576 bar_->SchedulePaint(); | 577 bar_->SchedulePaint(); |
| 577 } | 578 } |
| 578 bar_->SetVisible(bar_id != 0 && state_ != STATE_NORMAL); | 579 bar_->SetVisible(bar_id != 0 && state_ != STATE_NORMAL); |
| 579 } | 580 } |
| 580 | 581 |
| 581 } // namespace ash | 582 } // namespace ash |
| OLD | NEW |