Roll WebRTC 9189:9205, Libjingle 9186:9198
[chromium-blink-merge.git] / ui / aura / layout_manager.h
blob2ae460676bc2b9bb4acb156ffc3f61bf821d7824
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
3 // found in the LICENSE file.
5 #ifndef UI_AURA_LAYOUT_MANAGER_H_
6 #define UI_AURA_LAYOUT_MANAGER_H_
8 #include "base/basictypes.h"
9 #include "ui/aura/aura_export.h"
11 namespace gfx {
12 class Rect;
15 namespace aura {
16 class Window;
18 // An interface implemented by an object that places child windows.
19 class AURA_EXPORT LayoutManager {
20 public:
21 LayoutManager();
22 virtual ~LayoutManager();
24 // Invoked when the window is resized.
25 virtual void OnWindowResized() = 0;
27 // Invoked when the window |child| has been added.
28 virtual void OnWindowAddedToLayout(Window* child) = 0;
30 // Invoked prior to removing |window|.
31 virtual void OnWillRemoveWindowFromLayout(Window* child) = 0;
33 // Invoked after removing |window|.
34 virtual void OnWindowRemovedFromLayout(Window* child) = 0;
36 // Invoked when the |SetVisible()| is invoked on the window |child|.
37 // |visible| is the value supplied to |SetVisible()|. If |visible| is true,
38 // window->IsVisible() may still return false. See description in
39 // Window::IsVisible() for details.
40 virtual void OnChildWindowVisibilityChanged(Window* child, bool visible) = 0;
42 // Invoked when |Window::SetBounds| is called on |child|.
43 // Implementation must call |SetChildBoundsDirect| to change the
44 // |child|'s bounds. LayoutManager may modify |requested_bounds|
45 // before applying, or ignore the request.
46 virtual void SetChildBounds(Window* child,
47 const gfx::Rect& requested_bounds) = 0;
49 protected:
50 // Sets the child's bounds forcibly. LayoutManager is responsible
51 // for checking the state and make sure the bounds are correctly
52 // adjusted.
53 void SetChildBoundsDirect(aura::Window* child, const gfx::Rect& bounds);
56 } // namespace aura
58 #endif // UI_AURA_LAYOUT_MANAGER_H_