| 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/gestures/long_press_affordance_handler.h" | 5 #include "ash/wm/gestures/long_press_affordance_handler.h" |
| 6 | 6 |
| 7 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
| 8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 current_scale_ = animation->CurrentValueBetween(kAffordanceScaleEndValue, | 180 current_scale_ = animation->CurrentValueBetween(kAffordanceScaleEndValue, |
| 181 kAffordanceShrinkScaleEndValue); | 181 kAffordanceShrinkScaleEndValue); |
| 182 widget_->GetNativeView()->layer()->SetOpacity( | 182 widget_->GetNativeView()->layer()->SetOpacity( |
| 183 animation->CurrentValueBetween(kAffordanceOpacityEndValue, | 183 animation->CurrentValueBetween(kAffordanceOpacityEndValue, |
| 184 kAffordanceOpacityStartValue)); | 184 kAffordanceOpacityStartValue)); |
| 185 SchedulePaint(); | 185 SchedulePaint(); |
| 186 } | 186 } |
| 187 | 187 |
| 188 private: | 188 private: |
| 189 // Overridden from views::View. | 189 // Overridden from views::View. |
| 190 virtual gfx::Size GetPreferredSize() const OVERRIDE { | 190 virtual gfx::Size GetPreferredSize() const override { |
| 191 return gfx::Size(2 * (kAffordanceOuterRadius + kAffordanceGlowWidth), | 191 return gfx::Size(2 * (kAffordanceOuterRadius + kAffordanceGlowWidth), |
| 192 2 * (kAffordanceOuterRadius + kAffordanceGlowWidth)); | 192 2 * (kAffordanceOuterRadius + kAffordanceGlowWidth)); |
| 193 } | 193 } |
| 194 | 194 |
| 195 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { | 195 virtual void OnPaint(gfx::Canvas* canvas) override { |
| 196 gfx::Point center(GetPreferredSize().width() / 2, | 196 gfx::Point center(GetPreferredSize().width() / 2, |
| 197 GetPreferredSize().height() / 2); | 197 GetPreferredSize().height() / 2); |
| 198 canvas->Save(); | 198 canvas->Save(); |
| 199 | 199 |
| 200 gfx::Transform scale; | 200 gfx::Transform scale; |
| 201 scale.Scale(current_scale_, current_scale_); | 201 scale.Scale(current_scale_, current_scale_); |
| 202 // We want to scale from the center. | 202 // We want to scale from the center. |
| 203 canvas->Translate(center.OffsetFromOrigin()); | 203 canvas->Translate(center.OffsetFromOrigin()); |
| 204 canvas->Transform(scale); | 204 canvas->Transform(scale); |
| 205 canvas->Translate(-center.OffsetFromOrigin()); | 205 canvas->Translate(-center.OffsetFromOrigin()); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 break; | 358 break; |
| 359 } | 359 } |
| 360 } | 360 } |
| 361 | 361 |
| 362 void LongPressAffordanceHandler::OnWindowDestroying(aura::Window* window) { | 362 void LongPressAffordanceHandler::OnWindowDestroying(aura::Window* window) { |
| 363 DCHECK_EQ(tap_down_target_, window); | 363 DCHECK_EQ(tap_down_target_, window); |
| 364 StopAffordance(); | 364 StopAffordance(); |
| 365 } | 365 } |
| 366 | 366 |
| 367 } // namespace ash | 367 } // namespace ash |
| OLD | NEW |