• 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/basic_label_button_impl.h"
6 
7 #include "libcef/browser/views/basic_label_button_view.h"
8 
9 // static
CreateLabelButton(CefRefPtr<CefButtonDelegate> delegate,const CefString & text)10 CefRefPtr<CefLabelButton> CefLabelButton::CreateLabelButton(
11     CefRefPtr<CefButtonDelegate> delegate,
12     const CefString& text) {
13   return CefBasicLabelButtonImpl::Create(delegate, text);
14 }
15 
16 // static
Create(CefRefPtr<CefButtonDelegate> delegate,const CefString & text)17 CefRefPtr<CefBasicLabelButtonImpl> CefBasicLabelButtonImpl::Create(
18     CefRefPtr<CefButtonDelegate> delegate,
19     const CefString& text) {
20   CEF_REQUIRE_UIT_RETURN(nullptr);
21   CefRefPtr<CefBasicLabelButtonImpl> label_button =
22       new CefBasicLabelButtonImpl(delegate);
23   label_button->Initialize();
24   if (!text.empty())
25     label_button->SetText(text);
26   return label_button;
27 }
28 
CefBasicLabelButtonImpl(CefRefPtr<CefButtonDelegate> delegate)29 CefBasicLabelButtonImpl::CefBasicLabelButtonImpl(
30     CefRefPtr<CefButtonDelegate> delegate)
31     : ParentClass(delegate) {}
32 
CreateRootView()33 views::LabelButton* CefBasicLabelButtonImpl::CreateRootView() {
34   return new CefBasicLabelButtonView(delegate());
35 }
36 
InitializeRootView()37 void CefBasicLabelButtonImpl::InitializeRootView() {
38   static_cast<CefBasicLabelButtonView*>(root_view())->Initialize();
39 }
40