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

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, 3 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 "ui/aura/event_filter.h" 8 #include "ui/aura/event_filter.h"
9 #include "ui/aura/root_window.h" 9 #include "ui/aura/root_window.h"
10 #include "ui/aura/shared/compound_event_filter.h" 10 #include "ui/aura/shared/compound_event_filter.h"
(...skipping 27 matching lines...) Expand all
38 38
39 class MagnificationControllerImpl : virtual public MagnificationController, 39 class MagnificationControllerImpl : virtual public MagnificationController,
40 public aura::EventFilter, 40 public aura::EventFilter,
41 public ui::ImplicitAnimationObserver { 41 public ui::ImplicitAnimationObserver {
42 public: 42 public:
43 MagnificationControllerImpl(); 43 MagnificationControllerImpl();
44 virtual ~MagnificationControllerImpl(); 44 virtual ~MagnificationControllerImpl();
45 45
46 // MagnificationController overrides: 46 // MagnificationController overrides:
47 virtual void SetEnabled(bool enabled) OVERRIDE; 47 virtual void SetEnabled(bool enabled) OVERRIDE;
48 virtual bool IsEnabled() OVERRIDE;
48 virtual void SetScale(float scale, bool animate) OVERRIDE; 49 virtual void SetScale(float scale, bool animate) OVERRIDE;
49 virtual float GetScale() const OVERRIDE { return scale_; } 50 virtual float GetScale() const OVERRIDE { return scale_; }
50 virtual void MoveWindow(int x, int y, bool animate) OVERRIDE; 51 virtual void MoveWindow(int x, int y, bool animate) OVERRIDE;
51 virtual void MoveWindow(const gfx::Point& point, bool animate) OVERRIDE; 52 virtual void MoveWindow(const gfx::Point& point, bool animate) OVERRIDE;
52 virtual gfx::Point GetWindowPosition() const OVERRIDE { return origin_; } 53 virtual gfx::Point GetWindowPosition() const OVERRIDE { return origin_; }
53 virtual void EnsureRectIsVisible(const gfx::Rect& rect, 54 virtual void EnsureRectIsVisible(const gfx::Rect& rect,
54 bool animate) OVERRIDE; 55 bool animate) OVERRIDE;
55 virtual void EnsurePointIsVisible(const gfx::Point& point, 56 virtual void EnsurePointIsVisible(const gfx::Point& point,
56 bool animate) OVERRIDE; 57 bool animate) OVERRIDE;
57 58
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 void MagnificationControllerImpl::SetEnabled(bool enabled) { 407 void MagnificationControllerImpl::SetEnabled(bool enabled) {
407 if (enabled) { 408 if (enabled) {
408 is_enabled_ = enabled; 409 is_enabled_ = enabled;
409 SetScale(kInitialMagnifiedScale, true); 410 SetScale(kInitialMagnifiedScale, true);
410 } else { 411 } else {
411 SetScale(kNonMagnifiedScale, true); 412 SetScale(kNonMagnifiedScale, true);
412 is_enabled_ = enabled; 413 is_enabled_ = enabled;
413 } 414 }
414 } 415 }
415 416
417 bool MagnificationControllerImpl::IsEnabled() {
418 return is_enabled_;
419 }
420
416 //////////////////////////////////////////////////////////////////////////////// 421 ////////////////////////////////////////////////////////////////////////////////
417 // MagnificationControllerImpl: aura::EventFilter implementation 422 // MagnificationControllerImpl: aura::EventFilter implementation
418 423
419 bool MagnificationControllerImpl::PreHandleKeyEvent(aura::Window* target, 424 bool MagnificationControllerImpl::PreHandleKeyEvent(aura::Window* target,
420 ui::KeyEvent* event) { 425 ui::KeyEvent* event) {
421 return false; 426 return false;
422 } 427 }
423 428
424 bool MagnificationControllerImpl::PreHandleMouseEvent(aura::Window* target, 429 bool MagnificationControllerImpl::PreHandleMouseEvent(aura::Window* target,
425 ui::MouseEvent* event) { 430 ui::MouseEvent* event) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 //////////////////////////////////////////////////////////////////////////////// 466 ////////////////////////////////////////////////////////////////////////////////
462 // MagnificationController: 467 // MagnificationController:
463 468
464 // static 469 // static
465 MagnificationController* MagnificationController::CreateInstance() { 470 MagnificationController* MagnificationController::CreateInstance() {
466 return new MagnificationControllerImpl(); 471 return new MagnificationControllerImpl();
467 } 472 }
468 473
469 } // namespace internal 474 } // namespace internal
470 } // namespace ash 475 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698