Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Side by Side Diff: ui/aura/window.h

Issue 115453004: Moves management of transients out of Window (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix MRUWindowTracker and MultiProfileMultiBrowserShelfLayoutChromeLauncherControllerTest Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 24 matching lines...) Expand all
35 class Transform; 35 class Transform;
36 class Vector2d; 36 class Vector2d;
37 } 37 }
38 38
39 namespace ui { 39 namespace ui {
40 class EventHandler; 40 class EventHandler;
41 class Layer; 41 class Layer;
42 class Texture; 42 class Texture;
43 } 43 }
44 44
45 // TODO(sky): nuke. Temporary while moving transients out of Window.
46 namespace views {
47 namespace corewm {
48 class TransientWindowManager;
49 }
50 }
45 namespace aura { 51 namespace aura {
46 52
47 class LayoutManager; 53 class LayoutManager;
48 class RootWindow; 54 class RootWindow;
49 class WindowDelegate; 55 class WindowDelegate;
50 class WindowObserver; 56 class WindowObserver;
51 57
52 // TODO(beng): remove once RootWindow is renamed. 58 // TODO(beng): remove once RootWindow is renamed.
53 typedef RootWindow WindowEventDispatcher; 59 typedef RootWindow WindowEventDispatcher;
54 60
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 210
205 // Tree operations. 211 // Tree operations.
206 void AddChild(Window* child); 212 void AddChild(Window* child);
207 void RemoveChild(Window* child); 213 void RemoveChild(Window* child);
208 214
209 const Windows& children() const { return children_; } 215 const Windows& children() const { return children_; }
210 216
211 // Returns true if this Window contains |other| somewhere in its children. 217 // Returns true if this Window contains |other| somewhere in its children.
212 bool Contains(const Window* other) const; 218 bool Contains(const Window* other) const;
213 219
214 // Adds or removes |child| as a transient child of this window. Transient
215 // children get the following behavior:
216 // . The transient parent destroys any transient children when it is
217 // destroyed. This means a transient child is destroyed if either its parent
218 // or transient parent is destroyed.
219 // . If a transient child and its transient parent share the same parent, then
220 // transient children are always ordered above the transient parent.
221 // Transient windows are typically used for popups and menus.
222 void AddTransientChild(Window* child);
223 void RemoveTransientChild(Window* child);
224
225 const Windows& transient_children() const { return transient_children_; }
226
227 Window* transient_parent() { return transient_parent_; }
228 const Window* transient_parent() const { return transient_parent_; }
229
230 // Retrieves the first-level child with the specified id, or NULL if no first- 220 // Retrieves the first-level child with the specified id, or NULL if no first-
231 // level child is found matching |id|. 221 // level child is found matching |id|.
232 Window* GetChildById(int id); 222 Window* GetChildById(int id);
233 const Window* GetChildById(int id) const; 223 const Window* GetChildById(int id) const;
234 224
235 // Converts |point| from |source|'s coordinates to |target|'s. If |source| is 225 // Converts |point| from |source|'s coordinates to |target|'s. If |source| is
236 // NULL, the function returns without modifying |point|. |target| cannot be 226 // NULL, the function returns without modifying |point|. |target| cannot be
237 // NULL. 227 // NULL.
238 static void ConvertPointToTarget(const Window* source, 228 static void ConvertPointToTarget(const Window* source,
239 const Window* target, 229 const Window* target,
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 void PrintWindowHierarchy(int depth) const; 366 void PrintWindowHierarchy(int depth) const;
377 #endif 367 #endif
378 368
379 protected: 369 protected:
380 // Deletes (or removes if not owned by parent) all child windows. Intended for 370 // Deletes (or removes if not owned by parent) all child windows. Intended for
381 // use from the destructor. 371 // use from the destructor.
382 void RemoveOrDestroyChildren(); 372 void RemoveOrDestroyChildren();
383 373
384 private: 374 private:
385 friend class test::WindowTestApi; 375 friend class test::WindowTestApi;
376 // TODO(sky): temporary until TransientWindowManager gets its own observer.
377 friend class views::corewm::TransientWindowManager;
Ben Goodger (Google) 2013/12/18 00:32:38 What's this used for?
sky 2014/01/06 18:42:48 WindowObserver has two methods related to transien
386 friend class LayoutManager; 378 friend class LayoutManager;
387 friend class RootWindow; 379 friend class RootWindow;
388 friend class WindowTargeter; 380 friend class WindowTargeter;
389 381
390 // Called by the public {Set,Get,Clear}Property functions. 382 // Called by the public {Set,Get,Clear}Property functions.
391 int64 SetPropertyInternal(const void* key, 383 int64 SetPropertyInternal(const void* key,
392 const char* name, 384 const char* name,
393 PropertyDeallocator deallocator, 385 PropertyDeallocator deallocator,
394 int64 value, 386 int64 value,
395 int64 default_value); 387 int64 default_value);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 // |parent| as well as updating bounds of windows with a layerless ancestor. 430 // |parent| as well as updating bounds of windows with a layerless ancestor.
439 void ReparentLayers(ui::Layer* parent, const gfx::Vector2d& offset); 431 void ReparentLayers(ui::Layer* parent, const gfx::Vector2d& offset);
440 432
441 // Offsets the first encountered Windows with layers by |offset|. This 433 // Offsets the first encountered Windows with layers by |offset|. This
442 // recurses through all layerless Windows, stopping at windows with layers. 434 // recurses through all layerless Windows, stopping at windows with layers.
443 void OffsetLayerBounds(const gfx::Vector2d& offset); 435 void OffsetLayerBounds(const gfx::Vector2d& offset);
444 436
445 // Called when this window's parent has changed. 437 // Called when this window's parent has changed.
446 void OnParentChanged(); 438 void OnParentChanged();
447 439
448 // Returns true when |ancestor| is a transient ancestor of |this|. 440 // The various stacking functions call into this to do the actual stacking.
449 bool HasTransientAncestor(const Window* ancestor) const;
450
451 // Adjusts |target| so that we don't attempt to stack on top of a window with
452 // a NULL delegate. See implementation for details.
453 void SkipNullDelegatesForStacking(StackDirection direction,
454 Window** target) const;
455
456 // Determines the real location for stacking |child| and invokes
457 // StackChildRelativeToImpl().
458 void StackChildRelativeTo(Window* child, 441 void StackChildRelativeTo(Window* child,
459 Window* target, 442 Window* target,
460 StackDirection direction); 443 StackDirection direction);
461 444
462 // Implementation of StackChildRelativeTo(). 445 // Invoked from StackChildRelativeTo() to stack the layers appropriately
463 void StackChildRelativeToImpl(Window* child,
464 Window* target,
465 StackDirection direction);
466
467 // Invoked from StackChildRelativeToImpl() to stack the layers appropriately
468 // when stacking |child| relative to |target|. 446 // when stacking |child| relative to |target|.
469 void StackChildLayerRelativeTo(Window* child, 447 void StackChildLayerRelativeTo(Window* child,
470 Window* target, 448 Window* target,
471 StackDirection direction); 449 StackDirection direction);
472 450
473 // Called when this window's stacking order among its siblings is changed. 451 // Called when this window's stacking order among its siblings is changed.
474 void OnStackingChanged(); 452 void OnStackingChanged();
475 453
476 // Notifies observers registered with this Window (and its subtree) when the 454 // Notifies observers registered with this Window (and its subtree) when the
477 // Window has been added or is about to be removed from a RootWindow. 455 // Window has been added or is about to be removed from a RootWindow.
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 bool owned_by_parent_; 533 bool owned_by_parent_;
556 534
557 WindowDelegate* delegate_; 535 WindowDelegate* delegate_;
558 536
559 // The Window's parent. 537 // The Window's parent.
560 Window* parent_; 538 Window* parent_;
561 539
562 // Child windows. Topmost is last. 540 // Child windows. Topmost is last.
563 Windows children_; 541 Windows children_;
564 542
565 // Transient windows.
566 Windows transient_children_;
567
568 Window* transient_parent_;
569
570 // The visibility state of the window as set by Show()/Hide(). This may differ 543 // The visibility state of the window as set by Show()/Hide(). This may differ
571 // from the visibility of the underlying layer, which may remain visible after 544 // from the visibility of the underlying layer, which may remain visible after
572 // the window is hidden (e.g. to animate its disappearance). 545 // the window is hidden (e.g. to animate its disappearance).
573 bool visible_; 546 bool visible_;
574 547
575 int id_; 548 int id_;
576 std::string name_; 549 std::string name_;
577 550
578 base::string16 title_; 551 base::string16 title_;
579 552
(...skipping 26 matching lines...) Expand all
606 }; 579 };
607 580
608 std::map<const void*, Value> prop_map_; 581 std::map<const void*, Value> prop_map_;
609 582
610 DISALLOW_COPY_AND_ASSIGN(Window); 583 DISALLOW_COPY_AND_ASSIGN(Window);
611 }; 584 };
612 585
613 } // namespace aura 586 } // namespace aura
614 587
615 #endif // UI_AURA_WINDOW_H_ 588 #endif // UI_AURA_WINDOW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698