| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 ASH_COMMON_WM_WINDOW_H_ | 5 #ifndef ASH_COMMON_WM_WINDOW_H_ |
| 6 #define ASH_COMMON_WM_WINDOW_H_ | 6 #define ASH_COMMON_WM_WINDOW_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 class Widget; | 42 class Widget; |
| 43 } | 43 } |
| 44 | 44 |
| 45 namespace ash { | 45 namespace ash { |
| 46 | 46 |
| 47 class ImmersiveFullscreenController; | 47 class ImmersiveFullscreenController; |
| 48 class RootWindowController; | 48 class RootWindowController; |
| 49 class WmLayoutManager; | 49 class WmLayoutManager; |
| 50 class WmShell; | 50 class WmShell; |
| 51 class WmTransientWindowObserver; | 51 class WmTransientWindowObserver; |
| 52 class WmWindowObserver; | |
| 53 class WmWindowTestApi; | 52 class WmWindowTestApi; |
| 54 enum class WmWindowProperty; | 53 enum class WmWindowProperty; |
| 55 | 54 |
| 56 namespace wm { | 55 namespace wm { |
| 57 class WindowState; | 56 class WindowState; |
| 58 } | 57 } |
| 59 | 58 |
| 60 // WmWindow abstracts away differences between ash running in classic mode | 59 // WmWindow abstracts away differences between ash running in classic mode |
| 61 // and ash running with aura-mus. | 60 // and ash running with aura-mus. |
| 62 // | 61 // |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 // snaps the layer associated with this window to the layer associated with | 346 // snaps the layer associated with this window to the layer associated with |
| 348 // the ancestor. | 347 // the ancestor. |
| 349 void SnapToPixelBoundaryIfNecessary(); | 348 void SnapToPixelBoundaryIfNecessary(); |
| 350 | 349 |
| 351 // Makes the hit region for children slightly larger for easier resizing. | 350 // Makes the hit region for children slightly larger for easier resizing. |
| 352 void SetChildrenUseExtendedHitRegion(); | 351 void SetChildrenUseExtendedHitRegion(); |
| 353 | 352 |
| 354 // Returns a View that renders the contents of this window's layers. | 353 // Returns a View that renders the contents of this window's layers. |
| 355 std::unique_ptr<views::View> CreateViewWithRecreatedLayers(); | 354 std::unique_ptr<views::View> CreateViewWithRecreatedLayers(); |
| 356 | 355 |
| 357 void AddObserver(WmWindowObserver* observer); | |
| 358 void RemoveObserver(WmWindowObserver* observer); | |
| 359 bool HasObserver(const WmWindowObserver* observer) const; | |
| 360 | |
| 361 void AddTransientWindowObserver(WmTransientWindowObserver* observer); | 356 void AddTransientWindowObserver(WmTransientWindowObserver* observer); |
| 362 void RemoveTransientWindowObserver(WmTransientWindowObserver* observer); | 357 void RemoveTransientWindowObserver(WmTransientWindowObserver* observer); |
| 363 | 358 |
| 364 // Adds or removes a handler to receive events targeted at this window, before | 359 // Adds or removes a handler to receive events targeted at this window, before |
| 365 // this window handles the events itself; the handler does not recieve events | 360 // this window handles the events itself; the handler does not recieve events |
| 366 // from embedded windows. This only supports windows with internal widgets; | 361 // from embedded windows. This only supports windows with internal widgets; |
| 367 // see GetInternalWidget(). Ownership of the handler is not transferred. | 362 // see GetInternalWidget(). Ownership of the handler is not transferred. |
| 368 // | 363 // |
| 369 // Also note that the target of these events is always an aura::Window. | 364 // Also note that the target of these events is always an aura::Window. |
| 370 void AddLimitedPreTargetHandler(ui::EventHandler* handler); | 365 void AddLimitedPreTargetHandler(ui::EventHandler* handler); |
| 371 void RemoveLimitedPreTargetHandler(ui::EventHandler* handler); | 366 void RemoveLimitedPreTargetHandler(ui::EventHandler* handler); |
| 372 | 367 |
| 373 private: | 368 private: |
| 374 friend class WmWindowTestApi; | 369 friend class WmWindowTestApi; |
| 375 | 370 |
| 376 explicit WmWindow(aura::Window* window); | 371 explicit WmWindow(aura::Window* window); |
| 377 | 372 |
| 378 // aura::WindowObserver: | 373 // aura::WindowObserver: |
| 379 void OnWindowHierarchyChanging(const HierarchyChangeParams& params) override; | |
| 380 void OnWindowHierarchyChanged(const HierarchyChangeParams& params) override; | |
| 381 void OnWindowStackingChanged(aura::Window* window) override; | |
| 382 void OnWindowPropertyChanged(aura::Window* window, | 374 void OnWindowPropertyChanged(aura::Window* window, |
| 383 const void* key, | 375 const void* key, |
| 384 intptr_t old) override; | 376 intptr_t old) override; |
| 385 void OnWindowBoundsChanged(aura::Window* window, | |
| 386 const gfx::Rect& old_bounds, | |
| 387 const gfx::Rect& new_bounds) override; | |
| 388 void OnWindowDestroying(aura::Window* window) override; | |
| 389 void OnWindowDestroyed(aura::Window* window) override; | |
| 390 void OnWindowVisibilityChanging(aura::Window* window, bool visible) override; | |
| 391 void OnWindowVisibilityChanged(aura::Window* window, bool visible) override; | |
| 392 void OnWindowTitleChanged(aura::Window* window) override; | |
| 393 | 377 |
| 394 // ::wm::TransientWindowObserver overrides: | 378 // ::wm::TransientWindowObserver overrides: |
| 395 void OnTransientChildAdded(aura::Window* window, | 379 void OnTransientChildAdded(aura::Window* window, |
| 396 aura::Window* transient) override; | 380 aura::Window* transient) override; |
| 397 void OnTransientChildRemoved(aura::Window* window, | 381 void OnTransientChildRemoved(aura::Window* window, |
| 398 aura::Window* transient) override; | 382 aura::Window* transient) override; |
| 399 | 383 |
| 400 aura::Window* window_; | 384 aura::Window* window_; |
| 401 | 385 |
| 402 base::ObserverList<WmWindowObserver> observers_; | |
| 403 | |
| 404 bool added_transient_observer_ = false; | 386 bool added_transient_observer_ = false; |
| 405 base::ObserverList<WmTransientWindowObserver> transient_observers_; | 387 base::ObserverList<WmTransientWindowObserver> transient_observers_; |
| 406 | 388 |
| 407 // If true child windows should get a slightly larger hit region to make | 389 // If true child windows should get a slightly larger hit region to make |
| 408 // resizing easier. | 390 // resizing easier. |
| 409 bool children_use_extended_hit_region_ = false; | 391 bool children_use_extended_hit_region_ = false; |
| 410 | 392 |
| 411 // Default value for |use_empty_minimum_size_for_testing_|. | 393 // Default value for |use_empty_minimum_size_for_testing_|. |
| 412 static bool default_use_empty_minimum_size_for_testing_; | 394 static bool default_use_empty_minimum_size_for_testing_; |
| 413 | 395 |
| 414 // If true the minimum size is 0x0, default is minimum size comes from widget. | 396 // If true the minimum size is 0x0, default is minimum size comes from widget. |
| 415 bool use_empty_minimum_size_for_testing_; | 397 bool use_empty_minimum_size_for_testing_; |
| 416 | 398 |
| 417 DISALLOW_COPY_AND_ASSIGN(WmWindow); | 399 DISALLOW_COPY_AND_ASSIGN(WmWindow); |
| 418 }; | 400 }; |
| 419 | 401 |
| 420 } // namespace ash | 402 } // namespace ash |
| 421 | 403 |
| 422 #endif // ASH_COMMON_WM_WINDOW_H_ | 404 #endif // ASH_COMMON_WM_WINDOW_H_ |
| OLD | NEW |