• 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 #ifndef CEF_LIBCEF_BROWSER_VIEWS_SCROLL_VIEW_IMPL_H_
6 #define CEF_LIBCEF_BROWSER_VIEWS_SCROLL_VIEW_IMPL_H_
7 #pragma once
8 
9 #include "include/views/cef_scroll_view.h"
10 #include "include/views/cef_view_delegate.h"
11 
12 #include "libcef/browser/views/scroll_view_view.h"
13 #include "libcef/browser/views/view_impl.h"
14 
15 class CefScrollViewImpl
16     : public CefViewImpl<CefScrollViewView, CefScrollView, CefViewDelegate> {
17  public:
18   using ParentClass =
19       CefViewImpl<CefScrollViewView, CefScrollView, CefViewDelegate>;
20 
21   CefScrollViewImpl(const CefScrollViewImpl&) = delete;
22   CefScrollViewImpl& operator=(const CefScrollViewImpl&) = delete;
23 
24   // Create a new CefScrollView instance. |delegate| may be nullptr.
25   static CefRefPtr<CefScrollViewImpl> Create(
26       CefRefPtr<CefViewDelegate> delegate);
27 
28   // CefScrollView methods:
AsScrollView()29   CefRefPtr<CefScrollView> AsScrollView() override { return this; }
30   void SetContentView(CefRefPtr<CefView> view) override;
31   CefRefPtr<CefView> GetContentView() override;
32   CefRect GetVisibleContentRect() override;
33   bool HasHorizontalScrollbar() override;
34   int GetHorizontalScrollbarHeight() override;
35   bool HasVerticalScrollbar() override;
36   int GetVerticalScrollbarWidth() override;
37 
38   // CefViewAdapter methods:
GetDebugType()39   std::string GetDebugType() override { return "ScrollView"; }
40   void GetDebugInfo(base::DictionaryValue* info,
41                     bool include_children) override;
42 
43  private:
44   // Create a new implementation object.
45   // Always call Initialize() after creation.
46   // |delegate| may be nullptr.
47   CefScrollViewImpl(CefRefPtr<CefViewDelegate> delegate);
48 
49   // CefViewImpl methods:
50   CefScrollViewView* CreateRootView() override;
51   void InitializeRootView() override;
52 
53   IMPLEMENT_REFCOUNTING_DELETE_ON_UIT(CefScrollViewImpl);
54 };
55 
56 #endif  // CEF_LIBCEF_BROWSER_VIEWS_SCROLL_VIEW_IMPL_H_
57