| 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 27 matching lines...) Expand all Loading... |
| 38 namespace ui { | 38 namespace ui { |
| 39 class EventHandler; | 39 class EventHandler; |
| 40 class Layer; | 40 class Layer; |
| 41 class Texture; | 41 class Texture; |
| 42 } | 42 } |
| 43 | 43 |
| 44 namespace aura { | 44 namespace aura { |
| 45 | 45 |
| 46 class LayoutManager; | 46 class LayoutManager; |
| 47 class WindowDelegate; | 47 class WindowDelegate; |
| 48 class WindowEventDispatcher; | |
| 49 class WindowObserver; | 48 class WindowObserver; |
| 49 class WindowTreeHost; |
| 50 | 50 |
| 51 // Defined in window_property.h (which we do not include) | 51 // Defined in window_property.h (which we do not include) |
| 52 template<typename T> | 52 template<typename T> |
| 53 struct WindowProperty; | 53 struct WindowProperty; |
| 54 | 54 |
| 55 namespace test { | 55 namespace test { |
| 56 class WindowTestApi; | 56 class WindowTestApi; |
| 57 } | 57 } |
| 58 | 58 |
| 59 // Aura window implementation. Interesting events are sent to the | 59 // Aura window implementation. Interesting events are sent to the |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 Window* parent() { return parent_; } | 116 Window* parent() { return parent_; } |
| 117 const Window* parent() const { return parent_; } | 117 const Window* parent() const { return parent_; } |
| 118 | 118 |
| 119 // Returns the root Window that contains this Window. The root Window is | 119 // Returns the root Window that contains this Window. The root Window is |
| 120 // defined as the Window that has a dispatcher. These functions return NULL if | 120 // defined as the Window that has a dispatcher. These functions return NULL if |
| 121 // the Window is contained in a hierarchy that does not have a dispatcher at | 121 // the Window is contained in a hierarchy that does not have a dispatcher at |
| 122 // its root. | 122 // its root. |
| 123 virtual Window* GetRootWindow(); | 123 virtual Window* GetRootWindow(); |
| 124 virtual const Window* GetRootWindow() const; | 124 virtual const Window* GetRootWindow() const; |
| 125 | 125 |
| 126 WindowEventDispatcher* GetDispatcher(); | 126 WindowTreeHost* GetHost(); |
| 127 const WindowEventDispatcher* GetDispatcher() const; | 127 const WindowTreeHost* GetHost() const; |
| 128 void set_dispatcher(WindowEventDispatcher* dispatcher) { | 128 void set_host(WindowTreeHost* host) { host_ = host; } |
| 129 dispatcher_ = dispatcher; | 129 bool IsRootWindow() const { return !!host_; } |
| 130 } | |
| 131 bool HasDispatcher() const { return !!dispatcher_; } | |
| 132 | 130 |
| 133 // The Window does not own this object. | 131 // The Window does not own this object. |
| 134 void set_user_data(void* user_data) { user_data_ = user_data; } | 132 void set_user_data(void* user_data) { user_data_ = user_data; } |
| 135 void* user_data() const { return user_data_; } | 133 void* user_data() const { return user_data_; } |
| 136 | 134 |
| 137 // Changes the visibility of the window. | 135 // Changes the visibility of the window. |
| 138 void Show(); | 136 void Show(); |
| 139 void Hide(); | 137 void Hide(); |
| 140 // Returns true if this window and all its ancestors are visible. | 138 // Returns true if this window and all its ancestors are visible. |
| 141 bool IsVisible() const; | 139 bool IsVisible() const; |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 #endif | 328 #endif |
| 331 | 329 |
| 332 protected: | 330 protected: |
| 333 // Deletes (or removes if not owned by parent) all child windows. Intended for | 331 // Deletes (or removes if not owned by parent) all child windows. Intended for |
| 334 // use from the destructor. | 332 // use from the destructor. |
| 335 void RemoveOrDestroyChildren(); | 333 void RemoveOrDestroyChildren(); |
| 336 | 334 |
| 337 private: | 335 private: |
| 338 friend class test::WindowTestApi; | 336 friend class test::WindowTestApi; |
| 339 friend class LayoutManager; | 337 friend class LayoutManager; |
| 340 friend class WindowEventDispatcher; | |
| 341 friend class WindowTargeter; | 338 friend class WindowTargeter; |
| 342 | 339 |
| 343 // Called by the public {Set,Get,Clear}Property functions. | 340 // Called by the public {Set,Get,Clear}Property functions. |
| 344 int64 SetPropertyInternal(const void* key, | 341 int64 SetPropertyInternal(const void* key, |
| 345 const char* name, | 342 const char* name, |
| 346 PropertyDeallocator deallocator, | 343 PropertyDeallocator deallocator, |
| 347 int64 value, | 344 int64 value, |
| 348 int64 default_value); | 345 int64 default_value); |
| 349 int64 GetPropertyInternal(const void* key, int64 default_value) const; | 346 int64 GetPropertyInternal(const void* key, int64 default_value) const; |
| 350 | 347 |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 const_cast<const Window*>(this)->GetAncestorWithLayer(offset)); | 482 const_cast<const Window*>(this)->GetAncestorWithLayer(offset)); |
| 486 } | 483 } |
| 487 const Window* GetAncestorWithLayer(gfx::Vector2d* offset) const; | 484 const Window* GetAncestorWithLayer(gfx::Vector2d* offset) const; |
| 488 | 485 |
| 489 // Bounds of this window relative to the parent. This is cached as the bounds | 486 // Bounds of this window relative to the parent. This is cached as the bounds |
| 490 // of the Layer and Window are not necessarily the same. In particular bounds | 487 // of the Layer and Window are not necessarily the same. In particular bounds |
| 491 // of the Layer are relative to the first ancestor with a Layer, where as this | 488 // of the Layer are relative to the first ancestor with a Layer, where as this |
| 492 // is relative to the parent Window. | 489 // is relative to the parent Window. |
| 493 gfx::Rect bounds_; | 490 gfx::Rect bounds_; |
| 494 | 491 |
| 495 WindowEventDispatcher* dispatcher_; | 492 WindowTreeHost* host_; |
| 496 | 493 |
| 497 ui::wm::WindowType type_; | 494 ui::wm::WindowType type_; |
| 498 | 495 |
| 499 // True if the Window is owned by its parent - i.e. it will be deleted by its | 496 // True if the Window is owned by its parent - i.e. it will be deleted by its |
| 500 // parent during its parents destruction. True is the default. | 497 // parent during its parents destruction. True is the default. |
| 501 bool owned_by_parent_; | 498 bool owned_by_parent_; |
| 502 | 499 |
| 503 WindowDelegate* delegate_; | 500 WindowDelegate* delegate_; |
| 504 | 501 |
| 505 // The Window's parent. | 502 // The Window's parent. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 }; | 542 }; |
| 546 | 543 |
| 547 std::map<const void*, Value> prop_map_; | 544 std::map<const void*, Value> prop_map_; |
| 548 | 545 |
| 549 DISALLOW_COPY_AND_ASSIGN(Window); | 546 DISALLOW_COPY_AND_ASSIGN(Window); |
| 550 }; | 547 }; |
| 551 | 548 |
| 552 } // namespace aura | 549 } // namespace aura |
| 553 | 550 |
| 554 #endif // UI_AURA_WINDOW_H_ | 551 #endif // UI_AURA_WINDOW_H_ |
| OLD | NEW |