| 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/wm/maximize_bubble_controller.h" | 5 #include "ash/wm/maximize_bubble_controller.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/shell_delegate.h" | 8 #include "ash/shell_delegate.h" |
| 9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
| 10 #include "ash/wm/window_animations.h" | 10 #include "ash/wm/window_animations.h" |
| 11 #include "ash/wm/workspace/frame_maximize_button.h" | 11 #include "ash/wm/workspace/frame_maximize_button.h" |
| 12 #include "base/timer/timer.h" | 12 #include "base/timer/timer.h" |
| 13 #include "grit/ash_resources.h" | 13 #include "grit/ash_resources.h" |
| 14 #include "grit/ash_strings.h" | 14 #include "grit/ash_strings.h" |
| 15 #include "third_party/skia/include/core/SkPath.h" | 15 #include "third_party/skia/include/core/SkPath.h" |
| 16 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
| 17 #include "ui/base/animation/animation.h" | |
| 18 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
| 19 #include "ui/base/resource/resource_bundle.h" | 18 #include "ui/base/resource/resource_bundle.h" |
| 19 #include "ui/gfx/animation/animation.h" |
| 20 #include "ui/gfx/canvas.h" | 20 #include "ui/gfx/canvas.h" |
| 21 #include "ui/gfx/path.h" | 21 #include "ui/gfx/path.h" |
| 22 #include "ui/gfx/screen.h" | 22 #include "ui/gfx/screen.h" |
| 23 #include "ui/views/bubble/bubble_delegate.h" | 23 #include "ui/views/bubble/bubble_delegate.h" |
| 24 #include "ui/views/bubble/bubble_frame_view.h" | 24 #include "ui/views/bubble/bubble_frame_view.h" |
| 25 #include "ui/views/controls/button/button.h" | 25 #include "ui/views/controls/button/button.h" |
| 26 #include "ui/views/controls/button/image_button.h" | 26 #include "ui/views/controls/button/image_button.h" |
| 27 #include "ui/views/controls/label.h" | 27 #include "ui/views/controls/label.h" |
| 28 #include "ui/views/layout/box_layout.h" | 28 #include "ui/views/layout/box_layout.h" |
| 29 #include "ui/views/mouse_watcher.h" | 29 #include "ui/views/mouse_watcher.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 public views::MouseWatcherListener { | 211 public views::MouseWatcherListener { |
| 212 public: | 212 public: |
| 213 explicit Bubble(MaximizeBubbleController* owner, int appearance_delay_ms_); | 213 explicit Bubble(MaximizeBubbleController* owner, int appearance_delay_ms_); |
| 214 virtual ~Bubble() {} | 214 virtual ~Bubble() {} |
| 215 | 215 |
| 216 // The window of the menu under which the SnapSizer will get created. | 216 // The window of the menu under which the SnapSizer will get created. |
| 217 aura::Window* GetBubbleWindow(); | 217 aura::Window* GetBubbleWindow(); |
| 218 | 218 |
| 219 // Overridden from views::BubbleDelegateView. | 219 // Overridden from views::BubbleDelegateView. |
| 220 virtual gfx::Rect GetAnchorRect() OVERRIDE; | 220 virtual gfx::Rect GetAnchorRect() OVERRIDE; |
| 221 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; | 221 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; |
| 222 virtual bool CanActivate() const OVERRIDE { return false; } | 222 virtual bool CanActivate() const OVERRIDE { return false; } |
| 223 | 223 |
| 224 // Overridden from views::WidgetDelegateView. | 224 // Overridden from views::WidgetDelegateView. |
| 225 virtual bool WidgetHasHitTestMask() const OVERRIDE; | 225 virtual bool WidgetHasHitTestMask() const OVERRIDE; |
| 226 virtual void GetWidgetHitTestMask(gfx::Path* mask) const OVERRIDE; | 226 virtual void GetWidgetHitTestMask(gfx::Path* mask) const OVERRIDE; |
| 227 | 227 |
| 228 // Implementation of MouseWatcherListener. | 228 // Implementation of MouseWatcherListener. |
| 229 virtual void MouseMovedOutOfHost() OVERRIDE; | 229 virtual void MouseMovedOutOfHost() OVERRIDE; |
| 230 | 230 |
| 231 // Implementation of MouseWatcherHost. | 231 // Implementation of MouseWatcherHost. |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 gfx::Rect MaximizeBubbleController::Bubble::GetAnchorRect() { | 450 gfx::Rect MaximizeBubbleController::Bubble::GetAnchorRect() { |
| 451 if (!owner_) | 451 if (!owner_) |
| 452 return gfx::Rect(); | 452 return gfx::Rect(); |
| 453 | 453 |
| 454 gfx::Rect anchor_rect = | 454 gfx::Rect anchor_rect = |
| 455 owner_->frame_maximize_button()->GetBoundsInScreen(); | 455 owner_->frame_maximize_button()->GetBoundsInScreen(); |
| 456 return anchor_rect; | 456 return anchor_rect; |
| 457 } | 457 } |
| 458 | 458 |
| 459 void MaximizeBubbleController::Bubble::AnimationProgressed( | 459 void MaximizeBubbleController::Bubble::AnimationProgressed( |
| 460 const ui::Animation* animation) { | 460 const gfx::Animation* animation) { |
| 461 // First do everything needed for the fade by calling the base function. | 461 // First do everything needed for the fade by calling the base function. |
| 462 BubbleDelegateView::AnimationProgressed(animation); | 462 BubbleDelegateView::AnimationProgressed(animation); |
| 463 // When fading in we are done. | 463 // When fading in we are done. |
| 464 if (!shutting_down_) | 464 if (!shutting_down_) |
| 465 return; | 465 return; |
| 466 // Upon fade out an additional shift is required. | 466 // Upon fade out an additional shift is required. |
| 467 int shift = animation->CurrentValueBetween(kBubbleAnimationOffsetY, 0); | 467 int shift = animation->CurrentValueBetween(kBubbleAnimationOffsetY, 0); |
| 468 gfx::Rect rect = initial_position_; | 468 gfx::Rect rect = initial_position_; |
| 469 | 469 |
| 470 rect.set_y(rect.y() + shift); | 470 rect.set_y(rect.y() + shift); |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 if (!GetBoundsInScreen().Contains(screen_location)) | 855 if (!GetBoundsInScreen().Contains(screen_location)) |
| 856 button_row_->ButtonHovered(NULL); | 856 button_row_->ButtonHovered(NULL); |
| 857 else | 857 else |
| 858 button_row_->ButtonHovered(this); | 858 button_row_->ButtonHovered(this); |
| 859 | 859 |
| 860 // Pass the event on to the normal handler. | 860 // Pass the event on to the normal handler. |
| 861 return views::ImageButton::OnMouseDragged(event); | 861 return views::ImageButton::OnMouseDragged(event); |
| 862 } | 862 } |
| 863 | 863 |
| 864 } // namespace ash | 864 } // namespace ash |
| OLD | NEW |