Don't preload rarely seen large images
[chromium-blink-merge.git] / ash / magnifier / magnification_controller.h
blobea132d6a5d6d43ff36494fa48800077a980757ae
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
3 // found in the LICENSE file.
5 #ifndef ASH_MAGNIFIER_MAGNIFICATION_CONTROLLER_H_
6 #define ASH_MAGNIFIER_MAGNIFICATION_CONTROLLER_H_
8 #include "ash/ash_export.h"
9 #include "base/compiler_specific.h"
10 #include "base/logging.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "ui/gfx/geometry/point.h"
13 #include "ui/gfx/geometry/rect.h"
15 namespace aura {
16 class Window;
19 namespace ash {
21 class ASH_EXPORT MagnificationController {
22 public:
23 enum ScrollDirection {
24 SCROLL_NONE,
25 SCROLL_LEFT,
26 SCROLL_RIGHT,
27 SCROLL_UP,
28 SCROLL_DOWN
31 virtual ~MagnificationController() {}
33 // Creates a new MagnificationController. The caller takes ownership of the
34 // returned object.
35 static MagnificationController* CreateInstance();
37 // Enables (or disables if |enabled| is false) screen magnifier feature.
38 virtual void SetEnabled(bool enabled) = 0;
40 // Returns if the screen magnifier is enabled or not.
41 virtual bool IsEnabled() const = 0;
43 // Enables or disables the feature for keeping the text input focus centered.
44 virtual void SetKeepFocusCentered(bool keep_focus_centered) = 0;
46 // Returns true if magnifier will keep the focus centered in screen for text
47 // input.
48 virtual bool KeepFocusCentered() const = 0;
50 // Sets the magnification ratio. 1.0f means no magnification.
51 virtual void SetScale(float scale, bool animate) = 0;
52 // Returns the current magnification ratio.
53 virtual float GetScale() const = 0;
55 // Set the top-left point of the magnification window.
56 virtual void MoveWindow(int x, int y, bool animate) = 0;
57 virtual void MoveWindow(const gfx::Point& point, bool animate) = 0;
58 // Returns the current top-left point of the magnification window.
59 virtual gfx::Point GetWindowPosition() const = 0;
61 virtual void SetScrollDirection(ScrollDirection direction) = 0;
63 // Returns the view port(i.e. the current visible window)'s Rect in root
64 // window coordinates.
65 virtual gfx::Rect GetViewportRect() const = 0;
67 // Follows the focus on web page for non-editable controls.
68 virtual void HandleFocusedNodeChanged(
69 bool is_editable_node,
70 const gfx::Rect& node_bounds_in_screen) = 0;
72 // Returns |point_of_interest_| in MagnificationControllerImpl. This is
73 // the internal variable to stores the last mouse cursor (or last touched)
74 // location. This method is only for test purpose.
75 virtual gfx::Point GetPointOfInterestForTesting() = 0;
77 // Returns true if magnifier is still on animation for moving viewport.
78 // This is only used for testing purpose.
79 virtual bool IsOnAnimationForTesting() const = 0;
81 // Disables the delay for moving magnifier window in testing mode.
82 virtual void DisableMoveMagnifierDelayForTesting() = 0;
84 // Switch the magnified root window to |new_root_window|. This does following:
85 // - Unzoom the current root_window.
86 // - Zoom the given new root_window |new_root_window|.
87 // - Switch the target window from current window to |new_root_window|.
88 virtual void SwitchTargetRootWindow(aura::Window* new_root_window,
89 bool redraw_original_root) = 0;
91 protected:
92 MagnificationController() {}
94 private:
95 DISALLOW_COPY_AND_ASSIGN(MagnificationController);
98 } // namespace ash
100 #endif // ASH_MAGNIFIER_MAGNIFICATION_CONTROLLER_H_