| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 public: | 66 public: |
| 67 // Used when stacking windows. | 67 // Used when stacking windows. |
| 68 enum StackDirection { | 68 enum StackDirection { |
| 69 STACK_ABOVE, | 69 STACK_ABOVE, |
| 70 STACK_BELOW | 70 STACK_BELOW |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 typedef std::vector<Window*> Windows; | 73 typedef std::vector<Window*> Windows; |
| 74 | 74 |
| 75 explicit Window(WindowDelegate* delegate); | 75 explicit Window(WindowDelegate* delegate); |
| 76 virtual ~Window(); | 76 ~Window() override; |
| 77 | 77 |
| 78 // Initializes the window. This creates the window's layer. | 78 // Initializes the window. This creates the window's layer. |
| 79 void Init(WindowLayerType layer_type); | 79 void Init(WindowLayerType layer_type); |
| 80 | 80 |
| 81 void set_owned_by_parent(bool owned_by_parent) { | 81 void set_owned_by_parent(bool owned_by_parent) { |
| 82 owned_by_parent_ = owned_by_parent; | 82 owned_by_parent_ = owned_by_parent; |
| 83 } | 83 } |
| 84 bool owned_by_parent() const { return owned_by_parent_; } | 84 bool owned_by_parent() const { return owned_by_parent_; } |
| 85 | 85 |
| 86 // A type is used to identify a class of Windows and customize behavior such | 86 // A type is used to identify a class of Windows and customize behavior such |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 // NativeWidget::[GS]etNativeWindowProperty use strings as keys, and this is | 305 // NativeWidget::[GS]etNativeWindowProperty use strings as keys, and this is |
| 306 // difficult to change while retaining compatibility with other platforms. | 306 // difficult to change while retaining compatibility with other platforms. |
| 307 // TODO(benrg): Find a better solution. | 307 // TODO(benrg): Find a better solution. |
| 308 void SetNativeWindowProperty(const char* key, void* value); | 308 void SetNativeWindowProperty(const char* key, void* value); |
| 309 void* GetNativeWindowProperty(const char* key) const; | 309 void* GetNativeWindowProperty(const char* key) const; |
| 310 | 310 |
| 311 // Type of a function to delete a property that this window owns. | 311 // Type of a function to delete a property that this window owns. |
| 312 typedef void (*PropertyDeallocator)(int64 value); | 312 typedef void (*PropertyDeallocator)(int64 value); |
| 313 | 313 |
| 314 // Overridden from ui::LayerDelegate: | 314 // Overridden from ui::LayerDelegate: |
| 315 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) override; | 315 void OnDeviceScaleFactorChanged(float device_scale_factor) override; |
| 316 | 316 |
| 317 #if !defined(NDEBUG) | 317 #if !defined(NDEBUG) |
| 318 // These methods are useful when debugging. | 318 // These methods are useful when debugging. |
| 319 std::string GetDebugInfo() const; | 319 std::string GetDebugInfo() const; |
| 320 void PrintWindowHierarchy(int depth) const; | 320 void PrintWindowHierarchy(int depth) const; |
| 321 #endif | 321 #endif |
| 322 | 322 |
| 323 // Returns true if there was state needing to be cleaned up. | 323 // Returns true if there was state needing to be cleaned up. |
| 324 bool CleanupGestureState(); | 324 bool CleanupGestureState(); |
| 325 | 325 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 // Notifies this window and its child hierarchy of a transform applied to | 448 // Notifies this window and its child hierarchy of a transform applied to |
| 449 // |source|. | 449 // |source|. |
| 450 void NotifyAncestorWindowTransformed(Window* source); | 450 void NotifyAncestorWindowTransformed(Window* source); |
| 451 | 451 |
| 452 // Invoked when the bounds of the window changes. This may be invoked directly | 452 // Invoked when the bounds of the window changes. This may be invoked directly |
| 453 // by us, or from the closure returned by PrepareForLayerBoundsChange() after | 453 // by us, or from the closure returned by PrepareForLayerBoundsChange() after |
| 454 // the bounds of the layer has changed. |old_bounds| is the previous bounds. | 454 // the bounds of the layer has changed. |old_bounds| is the previous bounds. |
| 455 void OnWindowBoundsChanged(const gfx::Rect& old_bounds); | 455 void OnWindowBoundsChanged(const gfx::Rect& old_bounds); |
| 456 | 456 |
| 457 // Overridden from ui::LayerDelegate: | 457 // Overridden from ui::LayerDelegate: |
| 458 virtual void OnPaintLayer(gfx::Canvas* canvas) override; | 458 void OnPaintLayer(gfx::Canvas* canvas) override; |
| 459 virtual void OnDelegatedFrameDamage( | 459 void OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) override; |
| 460 const gfx::Rect& damage_rect_in_dip) override; | 460 base::Closure PrepareForLayerBoundsChange() override; |
| 461 virtual base::Closure PrepareForLayerBoundsChange() override; | |
| 462 | 461 |
| 463 // Overridden from ui::EventTarget: | 462 // Overridden from ui::EventTarget: |
| 464 virtual bool CanAcceptEvent(const ui::Event& event) override; | 463 bool CanAcceptEvent(const ui::Event& event) override; |
| 465 virtual EventTarget* GetParentTarget() override; | 464 EventTarget* GetParentTarget() override; |
| 466 virtual scoped_ptr<ui::EventTargetIterator> GetChildIterator() const override; | 465 scoped_ptr<ui::EventTargetIterator> GetChildIterator() const override; |
| 467 virtual ui::EventTargeter* GetEventTargeter() override; | 466 ui::EventTargeter* GetEventTargeter() override; |
| 468 virtual void ConvertEventToTarget(ui::EventTarget* target, | 467 void ConvertEventToTarget(ui::EventTarget* target, |
| 469 ui::LocatedEvent* event) override; | 468 ui::LocatedEvent* event) override; |
| 470 | 469 |
| 471 // Updates the layer name based on the window's name and id. | 470 // Updates the layer name based on the window's name and id. |
| 472 void UpdateLayerName(); | 471 void UpdateLayerName(); |
| 473 | 472 |
| 474 // Returns true if the mouse is currently within our bounds. | 473 // Returns true if the mouse is currently within our bounds. |
| 475 bool ContainsMouse(); | 474 bool ContainsMouse(); |
| 476 | 475 |
| 477 // Returns the first ancestor (starting at |this|) with a layer. |offset| is | 476 // Returns the first ancestor (starting at |this|) with a layer. |offset| is |
| 478 // set to the offset from |this| to the first ancestor with a layer. |offset| | 477 // set to the offset from |this| to the first ancestor with a layer. |offset| |
| 479 // may be NULL. | 478 // may be NULL. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 }; | 540 }; |
| 542 | 541 |
| 543 std::map<const void*, Value> prop_map_; | 542 std::map<const void*, Value> prop_map_; |
| 544 | 543 |
| 545 DISALLOW_COPY_AND_ASSIGN(Window); | 544 DISALLOW_COPY_AND_ASSIGN(Window); |
| 546 }; | 545 }; |
| 547 | 546 |
| 548 } // namespace aura | 547 } // namespace aura |
| 549 | 548 |
| 550 #endif // UI_AURA_WINDOW_H_ | 549 #endif // UI_AURA_WINDOW_H_ |
| OLD | NEW |