OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_WINDOW_H_ | 5 #ifndef UI_AURA_WINDOW_H_ |
6 #define UI_AURA_WINDOW_H_ | 6 #define UI_AURA_WINDOW_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 class LayoutManager; | 44 class LayoutManager; |
45 class RootWindow; | 45 class RootWindow; |
46 class WindowDelegate; | 46 class WindowDelegate; |
47 class WindowObserver; | 47 class WindowObserver; |
48 | 48 |
49 // Defined in window_property.h (which we do not include) | 49 // Defined in window_property.h (which we do not include) |
50 template<typename T> | 50 template<typename T> |
51 struct WindowProperty; | 51 struct WindowProperty; |
52 | 52 |
| 53 namespace test { |
| 54 class WindowTestApi; |
| 55 } |
| 56 |
53 // Aura window implementation. Interesting events are sent to the | 57 // Aura window implementation. Interesting events are sent to the |
54 // WindowDelegate. | 58 // WindowDelegate. |
55 // TODO(beng): resolve ownership. | 59 // TODO(beng): resolve ownership. |
56 class AURA_EXPORT Window : public ui::LayerDelegate, | 60 class AURA_EXPORT Window : public ui::LayerDelegate, |
57 public ui::LayerOwner, | 61 public ui::LayerOwner, |
58 public ui::EventTarget, | 62 public ui::EventTarget, |
59 public ui::GestureConsumer { | 63 public ui::GestureConsumer { |
60 public: | 64 public: |
61 typedef std::vector<Window*> Windows; | 65 typedef std::vector<Window*> Windows; |
62 | 66 |
63 class AURA_EXPORT TestApi { | |
64 public: | |
65 explicit TestApi(Window* window); | |
66 | |
67 bool OwnsLayer() const; | |
68 bool ContainsMouse(); | |
69 | |
70 private: | |
71 TestApi(); | |
72 | |
73 Window* window_; | |
74 | |
75 DISALLOW_COPY_AND_ASSIGN(TestApi); | |
76 }; | |
77 | |
78 explicit Window(WindowDelegate* delegate); | 67 explicit Window(WindowDelegate* delegate); |
79 virtual ~Window(); | 68 virtual ~Window(); |
80 | 69 |
81 // Initializes the window. This creates the window's layer. | 70 // Initializes the window. This creates the window's layer. |
82 void Init(ui::LayerType layer_type); | 71 void Init(ui::LayerType layer_type); |
83 | 72 |
84 // Creates a new layer for the window. Erases the layer-owned bounds, so the | 73 // Creates a new layer for the window. Erases the layer-owned bounds, so the |
85 // caller may wish to set new bounds and other state on the window/layer. | 74 // caller may wish to set new bounds and other state on the window/layer. |
86 // Returns the old layer, which can be used for animations. Caller owns the | 75 // Returns the old layer, which can be used for animations. Caller owns the |
87 // memory for the returned layer and must delete it when animation completes. | 76 // memory for the returned layer and must delete it when animation completes. |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 // Overridden from ui::LayerDelegate: | 341 // Overridden from ui::LayerDelegate: |
353 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; | 342 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; |
354 | 343 |
355 #ifndef NDEBUG | 344 #ifndef NDEBUG |
356 // These methods are useful when debugging. | 345 // These methods are useful when debugging. |
357 std::string GetDebugInfo() const; | 346 std::string GetDebugInfo() const; |
358 void PrintWindowHierarchy(int depth) const; | 347 void PrintWindowHierarchy(int depth) const; |
359 #endif | 348 #endif |
360 | 349 |
361 private: | 350 private: |
| 351 friend class test::WindowTestApi; |
362 friend class LayoutManager; | 352 friend class LayoutManager; |
363 | 353 |
364 // Used when stacking windows. | 354 // Used when stacking windows. |
365 enum StackDirection { | 355 enum StackDirection { |
366 STACK_ABOVE, | 356 STACK_ABOVE, |
367 STACK_BELOW | 357 STACK_BELOW |
368 }; | 358 }; |
369 | 359 |
370 // Called by the public {Set,Get,Clear}Property functions. | 360 // Called by the public {Set,Get,Clear}Property functions. |
371 int64 SetPropertyInternal(const void* key, | 361 int64 SetPropertyInternal(const void* key, |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 }; | 502 }; |
513 | 503 |
514 std::map<const void*, Value> prop_map_; | 504 std::map<const void*, Value> prop_map_; |
515 | 505 |
516 DISALLOW_COPY_AND_ASSIGN(Window); | 506 DISALLOW_COPY_AND_ASSIGN(Window); |
517 }; | 507 }; |
518 | 508 |
519 } // namespace aura | 509 } // namespace aura |
520 | 510 |
521 #endif // UI_AURA_WINDOW_H_ | 511 #endif // UI_AURA_WINDOW_H_ |
OLD | NEW |