Index: views/layout/center_layout.h |
diff --git a/views/layout/center_layout.h b/views/layout/center_layout.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..67a0d1d4557a3f42a932adfc5acdfbea8ac45eb5 |
--- /dev/null |
+++ b/views/layout/center_layout.h |
@@ -0,0 +1,36 @@ |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef VIEWS_LAYOUT_CENTER_LAYOUT_H_ |
+#define VIEWS_LAYOUT_CENTER_LAYOUT_H_ |
+#pragma once |
+ |
+#include "views/layout/layout_manager.h" |
+#include "views/view.h" |
+ |
+namespace gfx { |
+class Size; |
+} |
+ |
+namespace views { |
+ |
+// A layout manager that layouts a single child at the center of the host view. |
+// The child's size is limited by the host's local bounds and insets. |
+class VIEWS_EXPORT CenterLayout : public LayoutManager { |
+ public: |
+ CenterLayout(); |
+ virtual ~CenterLayout(); |
+ |
+ // Overridden from LayoutManager: |
+ virtual void Layout(View* host) OVERRIDE; |
+ virtual gfx::Size GetPreferredSize(View* host) OVERRIDE; |
+ virtual int GetPreferredHeightForWidth(View* host, int width) OVERRIDE; |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(CenterLayout); |
+}; |
+ |
+} // namespace views |
+ |
+#endif // VIEWS_LAYOUT_CENTER_LAYOUT_H_ |