• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "libcef/browser/views/layout_adapter.h"
6 
7 #include "libcef/browser/views/box_layout_impl.h"
8 #include "libcef/browser/views/fill_layout_impl.h"
9 
10 // static
GetFor(CefRefPtr<CefLayout> layout)11 CefLayoutAdapter* CefLayoutAdapter::GetFor(CefRefPtr<CefLayout> layout) {
12   CefLayoutAdapter* adapter = nullptr;
13   if (layout->AsBoxLayout()) {
14     adapter = static_cast<CefBoxLayoutImpl*>(layout->AsBoxLayout().get());
15   } else if (layout->AsFillLayout()) {
16     adapter = static_cast<CefFillLayoutImpl*>(layout->AsFillLayout().get());
17   }
18 
19   DCHECK(adapter);
20   return adapter;
21 }
22