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 using ParentClass = CefLayoutImpl<views::BoxLayout, CefBoxLayout>; 18 19 CefBoxLayoutImpl(const CefBoxLayoutImpl&) = delete; 20 CefBoxLayoutImpl& operator=(const CefBoxLayoutImpl&) = delete; 21 22 // Create a new CefBoxLayout insance. |owner_view| must be non-nullptr. 23 static CefRefPtr<CefBoxLayoutImpl> Create( 24 const CefBoxLayoutSettings& settings, 25 views::View* owner_view); 26 27 // CefBoxLayout methods: 28 void SetFlexForView(CefRefPtr<CefView> view, int flex) override; 29 void ClearFlexForView(CefRefPtr<CefView> view) override; 30 31 // CefLayout methods: AsBoxLayout()32 CefRefPtr<CefBoxLayout> AsBoxLayout() override { return this; } 33 34 private: 35 explicit CefBoxLayoutImpl(const CefBoxLayoutSettings& settings); 36 37 views::BoxLayout* CreateLayout() override; 38 39 CefBoxLayoutSettings settings_; 40 41 IMPLEMENT_REFCOUNTING_DELETE_ON_UIT(CefBoxLayoutImpl); 42 }; 43 44 #endif // CEF_LIBCEF_BROWSER_VIEWS_BOX_LAYOUT_IMPL_H_ 45