| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef UI_AURA_DESKTOP_H_ | 5 #ifndef UI_AURA_DESKTOP_H_ |
| 6 #define UI_AURA_DESKTOP_H_ | 6 #define UI_AURA_DESKTOP_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 bool OnKeyEvent(const KeyEvent& event); | 67 bool OnKeyEvent(const KeyEvent& event); |
| 68 | 68 |
| 69 // Called when the host changes size. | 69 // Called when the host changes size. |
| 70 void OnHostResized(const gfx::Size& size); | 70 void OnHostResized(const gfx::Size& size); |
| 71 | 71 |
| 72 // Compositor we're drawing to. | 72 // Compositor we're drawing to. |
| 73 ui::Compositor* compositor() { return compositor_.get(); } | 73 ui::Compositor* compositor() { return compositor_.get(); } |
| 74 | 74 |
| 75 Window* window() { return window_.get(); } | 75 Window* window() { return window_.get(); } |
| 76 | 76 |
| 77 static void set_compositor_factory_for_testing(ui::Compositor*(*factory)()) { | |
| 78 compositor_factory_ = factory; | |
| 79 } | |
| 80 static ui::Compositor* (*compositor_factory())() { | |
| 81 return compositor_factory_; | |
| 82 } | |
| 83 | |
| 84 // Sets the active window to |window| and the focused window to |to_focus|. | 77 // Sets the active window to |window| and the focused window to |to_focus|. |
| 85 // If |to_focus| is NULL, |window| is focused. | 78 // If |to_focus| is NULL, |window| is focused. |
| 86 void SetActiveWindow(Window* window, Window* to_focus); | 79 void SetActiveWindow(Window* window, Window* to_focus); |
| 87 Window* active_window() { return active_window_; } | 80 Window* active_window() { return active_window_; } |
| 88 | 81 |
| 89 // Activates the topmost window. Does nothing if the topmost window is already | 82 // Activates the topmost window. Does nothing if the topmost window is already |
| 90 // active. | 83 // active. |
| 91 void ActivateTopmostWindow(); | 84 void ActivateTopmostWindow(); |
| 92 | 85 |
| 93 // Deactivates |window| and activates the topmost window. Does nothing if | 86 // Deactivates |window| and activates the topmost window. Does nothing if |
| (...skipping 26 matching lines...) Expand all Loading... |
| 120 | 113 |
| 121 scoped_ptr<internal::RootWindow> window_; | 114 scoped_ptr<internal::RootWindow> window_; |
| 122 | 115 |
| 123 scoped_ptr<DesktopHost> host_; | 116 scoped_ptr<DesktopHost> host_; |
| 124 | 117 |
| 125 static Desktop* instance_; | 118 static Desktop* instance_; |
| 126 | 119 |
| 127 // Used to schedule painting. | 120 // Used to schedule painting. |
| 128 base::WeakPtrFactory<Desktop> schedule_paint_factory_; | 121 base::WeakPtrFactory<Desktop> schedule_paint_factory_; |
| 129 | 122 |
| 130 // Factory used to create Compositors. Settable by tests. | |
| 131 static ui::Compositor*(*compositor_factory_)(); | |
| 132 | |
| 133 Window* active_window_; | 123 Window* active_window_; |
| 134 | 124 |
| 135 // Last location seen in a mouse event. | 125 // Last location seen in a mouse event. |
| 136 gfx::Point last_mouse_location_; | 126 gfx::Point last_mouse_location_; |
| 137 | 127 |
| 138 // Are we in the process of being destroyed? Used to avoid processing during | 128 // Are we in the process of being destroyed? Used to avoid processing during |
| 139 // destruction. | 129 // destruction. |
| 140 bool in_destructor_; | 130 bool in_destructor_; |
| 141 | 131 |
| 142 ObserverList<DesktopObserver> observers_; | 132 ObserverList<DesktopObserver> observers_; |
| 143 | 133 |
| 144 DISALLOW_COPY_AND_ASSIGN(Desktop); | 134 DISALLOW_COPY_AND_ASSIGN(Desktop); |
| 145 }; | 135 }; |
| 146 | 136 |
| 147 } // namespace aura | 137 } // namespace aura |
| 148 | 138 |
| 149 #endif // UI_AURA_DESKTOP_H_ | 139 #endif // UI_AURA_DESKTOP_H_ |
| OLD | NEW |