Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: ash/magnifier/magnification_controller.cc

Issue 10915140: Add the partial screen magnifier to Chrome OS. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Code review fixes Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/magnifier/magnification_controller.h" 5 #include "ash/magnifier/magnification_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/system/tray/system_tray_delegate.h" 9 #include "ash/system/tray/system_tray_delegate.h"
10 #include "ui/aura/client/cursor_client.h" 10 #include "ui/aura/client/cursor_client.h"
(...skipping 15 matching lines...) Expand all
26 const float kMaxMagnifiedScaleThreshold = 4.0f; 26 const float kMaxMagnifiedScaleThreshold = 4.0f;
27 const float kMinMagnifiedScaleThreshold = 1.1f; 27 const float kMinMagnifiedScaleThreshold = 1.1f;
28 const float kNonMagnifiedScale = 1.0f; 28 const float kNonMagnifiedScale = 1.0f;
29 29
30 const float kInitialMagnifiedScale = 2.0f; 30 const float kInitialMagnifiedScale = 2.0f;
31 const float kScrollScaleChangeFactor = 0.05f; 31 const float kScrollScaleChangeFactor = 0.05f;
32 32
33 } // namespace 33 } // namespace
34 34
35 namespace ash { 35 namespace ash {
36 namespace internal {
37 36
38 //////////////////////////////////////////////////////////////////////////////// 37 ////////////////////////////////////////////////////////////////////////////////
39 // MagnificationControllerImpl: 38 // MagnificationControllerImpl:
40 39
41 class MagnificationControllerImpl : virtual public MagnificationController, 40 class MagnificationControllerImpl : virtual public MagnificationController,
42 public aura::EventFilter, 41 public aura::EventFilter,
43 public ui::ImplicitAnimationObserver { 42 public ui::ImplicitAnimationObserver {
44 public: 43 public:
45 MagnificationControllerImpl(); 44 MagnificationControllerImpl();
46 virtual ~MagnificationControllerImpl(); 45 virtual ~MagnificationControllerImpl();
47 46
48 // MagnificationController overrides: 47 // MagnificationController overrides:
49 virtual void SetEnabled(bool enabled) OVERRIDE; 48 virtual void SetEnabled(bool enabled) OVERRIDE;
49 virtual bool IsEnabled() const OVERRIDE;
50 virtual void SetScale(float scale, bool animate) OVERRIDE; 50 virtual void SetScale(float scale, bool animate) OVERRIDE;
51 virtual float GetScale() const OVERRIDE { return scale_; } 51 virtual float GetScale() const OVERRIDE { return scale_; }
52 virtual void MoveWindow(int x, int y, bool animate) OVERRIDE; 52 virtual void MoveWindow(int x, int y, bool animate) OVERRIDE;
53 virtual void MoveWindow(const gfx::Point& point, bool animate) OVERRIDE; 53 virtual void MoveWindow(const gfx::Point& point, bool animate) OVERRIDE;
54 virtual gfx::Point GetWindowPosition() const OVERRIDE { return origin_; } 54 virtual gfx::Point GetWindowPosition() const OVERRIDE { return origin_; }
55 virtual void EnsureRectIsVisible(const gfx::Rect& rect, 55 virtual void EnsureRectIsVisible(const gfx::Rect& rect,
56 bool animate) OVERRIDE; 56 bool animate) OVERRIDE;
57 virtual void EnsurePointIsVisible(const gfx::Point& point, 57 virtual void EnsurePointIsVisible(const gfx::Point& point,
58 bool animate) OVERRIDE; 58 bool animate) OVERRIDE;
59 59
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 scale = GetDefaultZoomScale(); 441 scale = GetDefaultZoomScale();
442 ValidateScale(&scale); 442 ValidateScale(&scale);
443 RedrawKeepingMousePosition(scale, true); 443 RedrawKeepingMousePosition(scale, true);
444 is_enabled_ = enabled; 444 is_enabled_ = enabled;
445 } else { 445 } else {
446 RedrawKeepingMousePosition(kNonMagnifiedScale, true); 446 RedrawKeepingMousePosition(kNonMagnifiedScale, true);
447 is_enabled_ = enabled; 447 is_enabled_ = enabled;
448 } 448 }
449 } 449 }
450 450
451 bool MagnificationControllerImpl::IsEnabled() const {
452 return is_enabled_;
453 }
454
451 //////////////////////////////////////////////////////////////////////////////// 455 ////////////////////////////////////////////////////////////////////////////////
452 // MagnificationControllerImpl: aura::EventFilter implementation 456 // MagnificationControllerImpl: aura::EventFilter implementation
453 457
454 bool MagnificationControllerImpl::PreHandleKeyEvent(aura::Window* target, 458 bool MagnificationControllerImpl::PreHandleKeyEvent(aura::Window* target,
455 ui::KeyEvent* event) { 459 ui::KeyEvent* event) {
456 return false; 460 return false;
457 } 461 }
458 462
459 bool MagnificationControllerImpl::PreHandleMouseEvent(aura::Window* target, 463 bool MagnificationControllerImpl::PreHandleMouseEvent(aura::Window* target,
460 ui::MouseEvent* event) { 464 ui::MouseEvent* event) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 } 505 }
502 506
503 //////////////////////////////////////////////////////////////////////////////// 507 ////////////////////////////////////////////////////////////////////////////////
504 // MagnificationController: 508 // MagnificationController:
505 509
506 // static 510 // static
507 MagnificationController* MagnificationController::CreateInstance() { 511 MagnificationController* MagnificationController::CreateInstance() {
508 return new MagnificationControllerImpl(); 512 return new MagnificationControllerImpl();
509 } 513 }
510 514
511 } // namespace internal
512 } // namespace ash 515 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698