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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
| 11 #include <memory> |
11 #include <string> | 12 #include <string> |
12 #include <vector> | 13 #include <vector> |
13 | 14 |
14 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
15 #include "base/macros.h" | 16 #include "base/macros.h" |
16 #include "base/memory/scoped_ptr.h" | |
17 #include "base/observer_list.h" | 17 #include "base/observer_list.h" |
18 #include "base/strings/string16.h" | 18 #include "base/strings/string16.h" |
19 #include "ui/aura/aura_export.h" | 19 #include "ui/aura/aura_export.h" |
20 #include "ui/aura/window_observer.h" | 20 #include "ui/aura/window_observer.h" |
21 #include "ui/compositor/layer_animator.h" | 21 #include "ui/compositor/layer_animator.h" |
22 #include "ui/compositor/layer_delegate.h" | 22 #include "ui/compositor/layer_delegate.h" |
23 #include "ui/compositor/layer_owner.h" | 23 #include "ui/compositor/layer_owner.h" |
24 #include "ui/events/event_constants.h" | 24 #include "ui/events/event_constants.h" |
25 #include "ui/events/event_target.h" | 25 #include "ui/events/event_target.h" |
26 #include "ui/events/event_targeter.h" | 26 #include "ui/events/event_targeter.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 | 155 |
156 void SetTransform(const gfx::Transform& transform); | 156 void SetTransform(const gfx::Transform& transform); |
157 | 157 |
158 // Assigns a LayoutManager to size and place child windows. | 158 // Assigns a LayoutManager to size and place child windows. |
159 // The Window takes ownership of the LayoutManager. | 159 // The Window takes ownership of the LayoutManager. |
160 void SetLayoutManager(LayoutManager* layout_manager); | 160 void SetLayoutManager(LayoutManager* layout_manager); |
161 LayoutManager* layout_manager() { return layout_manager_.get(); } | 161 LayoutManager* layout_manager() { return layout_manager_.get(); } |
162 | 162 |
163 // Sets a new event-targeter for the window, and returns the previous | 163 // Sets a new event-targeter for the window, and returns the previous |
164 // event-targeter. | 164 // event-targeter. |
165 scoped_ptr<ui::EventTargeter> SetEventTargeter( | 165 std::unique_ptr<ui::EventTargeter> SetEventTargeter( |
166 scoped_ptr<ui::EventTargeter> targeter); | 166 std::unique_ptr<ui::EventTargeter> targeter); |
167 | 167 |
168 // Changes the bounds of the window. If present, the window's parent's | 168 // Changes the bounds of the window. If present, the window's parent's |
169 // LayoutManager may adjust the bounds. | 169 // LayoutManager may adjust the bounds. |
170 void SetBounds(const gfx::Rect& new_bounds); | 170 void SetBounds(const gfx::Rect& new_bounds); |
171 | 171 |
172 // Changes the bounds of the window in the screen coordintates. | 172 // Changes the bounds of the window in the screen coordintates. |
173 // If present, the window's parent's LayoutManager may adjust the bounds. | 173 // If present, the window's parent's LayoutManager may adjust the bounds. |
174 void SetBoundsInScreen(const gfx::Rect& new_bounds_in_screen_coords, | 174 void SetBoundsInScreen(const gfx::Rect& new_bounds_in_screen_coords, |
175 const gfx::Display& dst_display); | 175 const gfx::Display& dst_display); |
176 | 176 |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 void OnWindowBoundsChanged(const gfx::Rect& old_bounds); | 444 void OnWindowBoundsChanged(const gfx::Rect& old_bounds); |
445 | 445 |
446 // Overridden from ui::LayerDelegate: | 446 // Overridden from ui::LayerDelegate: |
447 void OnPaintLayer(const ui::PaintContext& context) override; | 447 void OnPaintLayer(const ui::PaintContext& context) override; |
448 void OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) override; | 448 void OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) override; |
449 base::Closure PrepareForLayerBoundsChange() override; | 449 base::Closure PrepareForLayerBoundsChange() override; |
450 | 450 |
451 // Overridden from ui::EventTarget: | 451 // Overridden from ui::EventTarget: |
452 bool CanAcceptEvent(const ui::Event& event) override; | 452 bool CanAcceptEvent(const ui::Event& event) override; |
453 EventTarget* GetParentTarget() override; | 453 EventTarget* GetParentTarget() override; |
454 scoped_ptr<ui::EventTargetIterator> GetChildIterator() const override; | 454 std::unique_ptr<ui::EventTargetIterator> GetChildIterator() const override; |
455 ui::EventTargeter* GetEventTargeter() override; | 455 ui::EventTargeter* GetEventTargeter() override; |
456 void ConvertEventToTarget(ui::EventTarget* target, | 456 void ConvertEventToTarget(ui::EventTarget* target, |
457 ui::LocatedEvent* event) override; | 457 ui::LocatedEvent* event) override; |
458 | 458 |
459 // Updates the layer name based on the window's name and id. | 459 // Updates the layer name based on the window's name and id. |
460 void UpdateLayerName(); | 460 void UpdateLayerName(); |
461 | 461 |
462 // Bounds of this window relative to the parent. This is cached as the bounds | 462 // Bounds of this window relative to the parent. This is cached as the bounds |
463 // of the Layer and Window are not necessarily the same. In particular bounds | 463 // of the Layer and Window are not necessarily the same. In particular bounds |
464 // of the Layer are relative to the first ancestor with a Layer, where as this | 464 // of the Layer are relative to the first ancestor with a Layer, where as this |
(...skipping 22 matching lines...) Expand all Loading... |
487 bool visible_; | 487 bool visible_; |
488 | 488 |
489 int id_; | 489 int id_; |
490 std::string name_; | 490 std::string name_; |
491 | 491 |
492 base::string16 title_; | 492 base::string16 title_; |
493 | 493 |
494 // Whether layer is initialized as non-opaque. | 494 // Whether layer is initialized as non-opaque. |
495 bool transparent_; | 495 bool transparent_; |
496 | 496 |
497 scoped_ptr<LayoutManager> layout_manager_; | 497 std::unique_ptr<LayoutManager> layout_manager_; |
498 scoped_ptr<ui::EventTargeter> targeter_; | 498 std::unique_ptr<ui::EventTargeter> targeter_; |
499 | 499 |
500 void* user_data_; | 500 void* user_data_; |
501 | 501 |
502 // Makes the window pass all events through to any windows behind it. | 502 // Makes the window pass all events through to any windows behind it. |
503 bool ignore_events_; | 503 bool ignore_events_; |
504 | 504 |
505 // See set_hit_test_bounds_override_inner(). | 505 // See set_hit_test_bounds_override_inner(). |
506 gfx::Insets hit_test_bounds_override_inner_; | 506 gfx::Insets hit_test_bounds_override_inner_; |
507 | 507 |
508 base::ObserverList<WindowObserver, true> observers_; | 508 base::ObserverList<WindowObserver, true> observers_; |
509 | 509 |
510 // Value struct to keep the name and deallocator for this property. | 510 // Value struct to keep the name and deallocator for this property. |
511 // Key cannot be used for this purpose because it can be char* or | 511 // Key cannot be used for this purpose because it can be char* or |
512 // WindowProperty<>. | 512 // WindowProperty<>. |
513 struct Value { | 513 struct Value { |
514 const char* name; | 514 const char* name; |
515 int64_t value; | 515 int64_t value; |
516 PropertyDeallocator deallocator; | 516 PropertyDeallocator deallocator; |
517 }; | 517 }; |
518 | 518 |
519 std::map<const void*, Value> prop_map_; | 519 std::map<const void*, Value> prop_map_; |
520 | 520 |
521 DISALLOW_COPY_AND_ASSIGN(Window); | 521 DISALLOW_COPY_AND_ASSIGN(Window); |
522 }; | 522 }; |
523 | 523 |
524 } // namespace aura | 524 } // namespace aura |
525 | 525 |
526 #endif // UI_AURA_WINDOW_H_ | 526 #endif // UI_AURA_WINDOW_H_ |
OLD | NEW |