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

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, 2 months 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 "ui/aura/event_filter.h" 9 #include "ui/aura/event_filter.h"
10 #include "ui/aura/root_window.h" 10 #include "ui/aura/root_window.h"
(...skipping 28 matching lines...) Expand all
39 39
40 class MagnificationControllerImpl : virtual public MagnificationController, 40 class MagnificationControllerImpl : virtual public MagnificationController,
41 public aura::EventFilter, 41 public aura::EventFilter,
42 public ui::ImplicitAnimationObserver { 42 public ui::ImplicitAnimationObserver {
43 public: 43 public:
44 MagnificationControllerImpl(); 44 MagnificationControllerImpl();
45 virtual ~MagnificationControllerImpl(); 45 virtual ~MagnificationControllerImpl();
46 46
47 // MagnificationController overrides: 47 // MagnificationController overrides:
48 virtual void SetEnabled(bool enabled) OVERRIDE; 48 virtual void SetEnabled(bool enabled) OVERRIDE;
49 virtual bool IsEnabled() const OVERRIDE;
49 virtual void SetScale(float scale, bool animate) OVERRIDE; 50 virtual void SetScale(float scale, bool animate) OVERRIDE;
50 virtual float GetScale() const OVERRIDE { return scale_; } 51 virtual float GetScale() const OVERRIDE { return scale_; }
51 virtual void MoveWindow(int x, int y, bool animate) OVERRIDE; 52 virtual void MoveWindow(int x, int y, bool animate) OVERRIDE;
52 virtual void MoveWindow(const gfx::Point& point, bool animate) OVERRIDE; 53 virtual void MoveWindow(const gfx::Point& point, bool animate) OVERRIDE;
53 virtual gfx::Point GetWindowPosition() const OVERRIDE { return origin_; } 54 virtual gfx::Point GetWindowPosition() const OVERRIDE { return origin_; }
54 virtual void EnsureRectIsVisible(const gfx::Rect& rect, 55 virtual void EnsureRectIsVisible(const gfx::Rect& rect,
55 bool animate) OVERRIDE; 56 bool animate) OVERRIDE;
56 virtual void EnsurePointIsVisible(const gfx::Point& point, 57 virtual void EnsurePointIsVisible(const gfx::Point& point,
57 bool animate) OVERRIDE; 58 bool animate) OVERRIDE;
58 59
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 ash::Shell::GetInstance()->delegate()->GetSavedScreenMagnifierScale(); 420 ash::Shell::GetInstance()->delegate()->GetSavedScreenMagnifierScale();
420 ValidateScale(&scale); 421 ValidateScale(&scale);
421 RedrawKeepingMousePosition(scale, true); 422 RedrawKeepingMousePosition(scale, true);
422 is_enabled_ = enabled; 423 is_enabled_ = enabled;
423 } else { 424 } else {
424 RedrawKeepingMousePosition(kNonMagnifiedScale, true); 425 RedrawKeepingMousePosition(kNonMagnifiedScale, true);
425 is_enabled_ = enabled; 426 is_enabled_ = enabled;
426 } 427 }
427 } 428 }
428 429
430 bool MagnificationControllerImpl::IsEnabled() const {
431 return is_enabled_;
432 }
433
429 //////////////////////////////////////////////////////////////////////////////// 434 ////////////////////////////////////////////////////////////////////////////////
430 // MagnificationControllerImpl: aura::EventFilter implementation 435 // MagnificationControllerImpl: aura::EventFilter implementation
431 436
432 bool MagnificationControllerImpl::PreHandleKeyEvent(aura::Window* target, 437 bool MagnificationControllerImpl::PreHandleKeyEvent(aura::Window* target,
433 ui::KeyEvent* event) { 438 ui::KeyEvent* event) {
434 return false; 439 return false;
435 } 440 }
436 441
437 bool MagnificationControllerImpl::PreHandleMouseEvent(aura::Window* target, 442 bool MagnificationControllerImpl::PreHandleMouseEvent(aura::Window* target,
438 ui::MouseEvent* event) { 443 ui::MouseEvent* event) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 //////////////////////////////////////////////////////////////////////////////// 481 ////////////////////////////////////////////////////////////////////////////////
477 // MagnificationController: 482 // MagnificationController:
478 483
479 // static 484 // static
480 MagnificationController* MagnificationController::CreateInstance() { 485 MagnificationController* MagnificationController::CreateInstance() {
481 return new MagnificationControllerImpl(); 486 return new MagnificationControllerImpl();
482 } 487 }
483 488
484 } // namespace internal 489 } // namespace internal
485 } // namespace ash 490 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698