1 // Copyright 2016 The Chromium Embedded Framework Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be found 3 // in the LICENSE file. 4 5 #ifndef CEF_LIBCEF_BROWSER_VIEWS_BOX_LAYOUT_IMPL_H_ 6 #define CEF_LIBCEF_BROWSER_VIEWS_BOX_LAYOUT_IMPL_H_ 7 #pragma once 8 9 #include "include/views/cef_box_layout.h" 10 11 #include "libcef/browser/views/layout_impl.h" 12 #include "ui/views/layout/box_layout.h" 13 14 class CefBoxLayoutImpl : public CefLayoutImpl<views::BoxLayout, CefBoxLayout> { 15 public: 16 // Necessary for the CEF_REQUIRE_VALID_*() macros to compile. 17 typedef CefLayoutImpl<views::BoxLayout, CefBoxLayout> ParentClass; 18 19 // Create a new CefBoxLayout insance. |owner_view| must be non-nullptr. 20 static CefRefPtr<CefBoxLayoutImpl> Create( 21 const CefBoxLayoutSettings& settings, 22 views::View* owner_view); 23 24 // CefBoxLayout methods: 25 void SetFlexForView(CefRefPtr<CefView> view, int flex) override; 26 void ClearFlexForView(CefRefPtr<CefView> view) override; 27 28 // CefLayout methods: AsBoxLayout()29 CefRefPtr<CefBoxLayout> AsBoxLayout() override { return this; } 30 31 private: 32 explicit CefBoxLayoutImpl(const CefBoxLayoutSettings& settings); 33 34 views::BoxLayout* CreateLayout() override; 35 36 CefBoxLayoutSettings settings_; 37 38 IMPLEMENT_REFCOUNTING_DELETE_ON_UIT(CefBoxLayoutImpl); 39 DISALLOW_COPY_AND_ASSIGN(CefBoxLayoutImpl); 40 }; 41 42 #endif // CEF_LIBCEF_BROWSER_VIEWS_BOX_LAYOUT_IMPL_H_ 43