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. 4 5 #ifndef UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_NATIVE_CURSOR_MANAGER_H_ 6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_NATIVE_CURSOR_MANAGER_H_ 7 8 #include "base/compiler_specific.h" 9 #include "base/memory/scoped_ptr.h" 10 #include "ui/views/corewm/native_cursor_manager.h" 11 #include "ui/views/views_export.h" 12 13 namespace aura { 14 class RootWindow; 15 } 16 17 namespace ui { 18 class CursorLoader; 19 } 20 21 namespace views { 22 class DesktopCursorLoaderUpdater; 23 24 namespace corewm { 25 class NativeCursorManagerDelegate; 26 } 27 28 // A NativeCursorManager that interacts with only one RootWindow. (Unlike the 29 // one in ash, which interacts with all the RootWindows that ash knows about.) 30 class VIEWS_EXPORT DesktopNativeCursorManager 31 : public views::corewm::NativeCursorManager { 32 public: 33 DesktopNativeCursorManager( 34 aura::RootWindow* window, 35 scoped_ptr<DesktopCursorLoaderUpdater> cursor_loader_updater); 36 virtual ~DesktopNativeCursorManager(); 37 38 // Builds a cursor and sets the internal platform representation. 39 gfx::NativeCursor GetInitializedCursor(int type); 40 41 private: 42 // Overridden from views::corewm::NativeCursorManager: 43 virtual void SetDisplay( 44 const gfx::Display& display, 45 views::corewm::NativeCursorManagerDelegate* delegate) OVERRIDE; 46 virtual void SetCursor( 47 gfx::NativeCursor cursor, 48 views::corewm::NativeCursorManagerDelegate* delegate) OVERRIDE; 49 virtual void SetVisibility( 50 bool visible, 51 views::corewm::NativeCursorManagerDelegate* delegate) OVERRIDE; 52 virtual void SetScale( 53 float scale, 54 views::corewm::NativeCursorManagerDelegate* delegate) OVERRIDE; 55 virtual void SetMouseEventsEnabled( 56 bool enabled, 57 views::corewm::NativeCursorManagerDelegate* delegate) OVERRIDE; 58 59 aura::RootWindow* root_window_; 60 scoped_ptr<DesktopCursorLoaderUpdater> cursor_loader_updater_; 61 scoped_ptr<ui::CursorLoader> cursor_loader_; 62 63 DISALLOW_COPY_AND_ASSIGN(DesktopNativeCursorManager); 64 }; 65 66 } // namespace views 67 68 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_NATIVE_CURSOR_MANAGER_H_ 69 70