• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2021 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/chrome/views/toolbar_view_impl.h"
6 
7 // static
Create(CefRefPtr<CefViewDelegate> delegate,Browser * browser,BrowserView * browser_view,absl::optional<ToolbarView::DisplayMode> display_mode)8 CefRefPtr<CefToolbarViewImpl> CefToolbarViewImpl::Create(
9     CefRefPtr<CefViewDelegate> delegate,
10     Browser* browser,
11     BrowserView* browser_view,
12     absl::optional<ToolbarView::DisplayMode> display_mode) {
13   CEF_REQUIRE_UIT_RETURN(nullptr);
14   CefRefPtr<CefToolbarViewImpl> view =
15       new CefToolbarViewImpl(delegate, browser, browser_view, display_mode);
16   view->Initialize();
17   return view;
18 }
19 
20 // static
21 const char* const CefToolbarViewImpl::kTypeString = "ToolbarView";
22 
CefToolbarViewImpl(CefRefPtr<CefViewDelegate> delegate,Browser * browser,BrowserView * browser_view,absl::optional<ToolbarView::DisplayMode> display_mode)23 CefToolbarViewImpl::CefToolbarViewImpl(
24     CefRefPtr<CefViewDelegate> delegate,
25     Browser* browser,
26     BrowserView* browser_view,
27     absl::optional<ToolbarView::DisplayMode> display_mode)
28     : ParentClass(delegate),
29       browser_(browser),
30       browser_view_(browser_view),
31       display_mode_(display_mode) {}
32 
CreateRootView()33 CefToolbarViewView* CefToolbarViewImpl::CreateRootView() {
34   return new CefToolbarViewView(delegate(), browser_, browser_view_,
35                                 display_mode_);
36 }
37 
InitializeRootView()38 void CefToolbarViewImpl::InitializeRootView() {
39   static_cast<CefToolbarViewView*>(root_view())->Initialize();
40 }
41