15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef ASH_MAGNIFIER_MAGNIFICATION_CONTROLLER_H_
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define ASH_MAGNIFIER_MAGNIFICATION_CONTROLLER_H_
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
85d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "ash/ash_export.h"
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/compiler_specific.h"
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/logging.h"
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/memory/scoped_ptr.h"
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/gfx/point.h"
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/gfx/rect.h"
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace aura {
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class RootWindow;
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace ash {
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
215d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)class ASH_EXPORT MagnificationController {
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public:
235d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  enum ScrollDirection {
245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    SCROLL_NONE,
255d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    SCROLL_LEFT,
265d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    SCROLL_RIGHT,
275d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    SCROLL_UP,
285d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    SCROLL_DOWN
295d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  };
305d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual ~MagnificationController() {}
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Creates a new MagnificationController. The caller takes ownership of the
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // returned object.
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static MagnificationController* CreateInstance();
365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Enables (or disables if |enabled| is false) screen magnifier feature.
385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void SetEnabled(bool enabled) = 0;
395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
402a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Returns if the screen magnifier is enabled or not.
412a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual bool IsEnabled() const = 0;
422a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Sets the magnification ratio. 1.0f means no magnification.
445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void SetScale(float scale, bool animate) = 0;
455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns the current magnification ratio.
465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual float GetScale() const = 0;
475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Set the top-left point of the magnification window.
495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void MoveWindow(int x, int y, bool animate) = 0;
505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void MoveWindow(const gfx::Point& point, bool animate) = 0;
515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns the current top-left point of the magnification window.
525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual gfx::Point GetWindowPosition() const = 0;
535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
545d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual void SetScrollDirection(ScrollDirection direction) = 0;
555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
56c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // Returns |point_of_interest_| in MagnificationControllerImpl. This is
57c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // the internal variable to stores the last mouse cursor (or last touched)
58c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // location. This method is only for test purpose.
59c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  virtual gfx::Point GetPointOfInterestForTesting() = 0;
60c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) protected:
625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  MagnificationController() {}
635d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
645d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) private:
655d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(MagnificationController);
665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}  // namespace ash
695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif  // ASH_MAGNIFIER_MAGNIFICATION_CONTROLLER_H_
71