1 // Copyright 2014 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. 4 5 #ifndef ASH_DISPLAY_DISPLAY_UTIL_H_ 6 #define ASH_DISPLAY_DISPLAY_UTIL_H_ 7 8 #include <memory> 9 10 #include "ash/ash_export.h" 11 #include "base/strings/string16.h" 12 13 namespace aura { 14 class Window; 15 } 16 17 namespace display { 18 class DisplayManager; 19 } 20 21 namespace gfx { 22 class Point; 23 class Rect; 24 } 25 26 namespace ash { 27 class AshWindowTreeHost; 28 class MouseWarpController; 29 30 // Creates a MouseWarpController for the current display 31 // configuration. |drag_source| is the window where dragging 32 // started, or nullptr otherwise. 33 std::unique_ptr<MouseWarpController> CreateMouseWarpController( 34 display::DisplayManager* manager, 35 aura::Window* drag_source); 36 37 // Creates edge bounds from |bounds_in_screen| that fits the edge 38 // of the native window for |ash_host|. 39 ASH_EXPORT gfx::Rect GetNativeEdgeBounds(AshWindowTreeHost* ash_host, 40 const gfx::Rect& bounds_in_screen); 41 42 // Moves the cursor to the point inside the |ash_host| that is closest to 43 // the point_in_screen, which may be outside of the root window. 44 // |update_last_loation_now| is used for the test to update the mouse 45 // location synchronously. 46 void MoveCursorTo(AshWindowTreeHost* ash_host, 47 const gfx::Point& point_in_screen, 48 bool update_last_location_now); 49 50 // Shows the notification message for display related issues, and optionally 51 // adds a button to send a feedback report. 52 void ShowDisplayErrorNotification(const base::string16& message, 53 bool allow_feedback); 54 55 // Takes a refresh rate represented as a float and rounds it to two decimal 56 // places. If the rounded refresh rate is a whole number, the mantissa is 57 // removed. Ex: 54.60712 -> "54.61" 58 ASH_EXPORT base::string16 ConvertRefreshRateToString16(float refresh_rate); 59 60 ASH_EXPORT base::string16 GetDisplayErrorNotificationMessageForTest(); 61 62 } // namespace ash 63 64 #endif // ASH_DISPLAY_DISPLAY_UTIL_H_ 65