File: overlay_panel_layer.h

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (113 lines) | stat: -rw-r--r-- 4,226 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_OVERLAY_PANEL_LAYER_H_
#define CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_OVERLAY_PANEL_LAYER_H_

#include "base/memory/raw_ptr.h"
#include "chrome/browser/android/compositor/layer/layer.h"

namespace cc::slim {
class Layer;
class NinePatchLayer;
class SolidColorLayer;
class UIResourceLayer;
}  // namespace cc::slim

namespace ui {
class ResourceManager;
}

namespace android {

class OverlayPanelLayer : public Layer {
 public:
  // Default width for any icon displayed on an OverlayPanel.
  static constexpr float kDefaultIconWidthDp = 36.0f;

  // ID for Invalid resource.
  static constexpr int kInvalidResourceID = -1;

  void SetResourceIds(int bar_text_resource_id,
                      int panel_shadow_resource_id,
                      int rounded_bar_top_resource_id,
                      int bar_shadow_resource_id,
                      int panel_icon_resource_id,
                      int drag_handlebar_resource_id,
                      int open_tab_resource_id,
                      int close_icon_resource_id);

  void SetProperties(float dp_to_px,
                     const scoped_refptr<cc::slim::Layer>& content_layer,
                     float content_offset_y,
                     float panel_x,
                     float panel_y,
                     float panel_width,
                     float panel_height,
                     int bar_background_color,
                     float bar_margin_side,
                     float bar_margin_top,
                     float bar_margin_bottom,
                     float bar_height,
                     float bar_offset_y,
                     float bar_text_opacity,
                     bool bar_border_visible,
                     float bar_border_height,
                     int icon_tint,
                     int drag_handlebar_tint,
                     float icon_opacity,
                     int separator_line_color,
                     float in_bar_related_searches_height);

  void SetProgressBar(int progress_bar_background_resource_id,
                      int progress_bar_background_tint,
                      int progress_bar_resource_id,
                      int progress_bar_tint,
                      bool progress_bar_visible,
                      float progress_bar_position_y,
                      float progress_bar_height,
                      float progress_bar_opacity,
                      float progress_bar_completion,
                      float panel_width);

  scoped_refptr<cc::slim::Layer> layer() override;

 protected:
  explicit OverlayPanelLayer(ui::ResourceManager* resource_manager);
  ~OverlayPanelLayer() override;

  virtual scoped_refptr<cc::slim::Layer> GetIconLayer();
  void AddBarTextLayer(scoped_refptr<cc::slim::Layer> text_layer);

  raw_ptr<ui::ResourceManager> resource_manager_;
  scoped_refptr<cc::slim::Layer> layer_;

  scoped_refptr<cc::slim::NinePatchLayer> panel_shadow_;
  scoped_refptr<cc::slim::NinePatchLayer> rounded_bar_top_;
  scoped_refptr<cc::slim::SolidColorLayer> bar_background_;
  scoped_refptr<cc::slim::UIResourceLayer> bar_text_;
  scoped_refptr<cc::slim::UIResourceLayer> bar_shadow_;
  scoped_refptr<cc::slim::UIResourceLayer> panel_icon_;
  scoped_refptr<cc::slim::UIResourceLayer> drag_handlebar_;
  scoped_refptr<cc::slim::UIResourceLayer> open_tab_icon_;
  scoped_refptr<cc::slim::UIResourceLayer> close_icon_;
  scoped_refptr<cc::slim::Layer> content_container_;
  scoped_refptr<cc::slim::Layer> text_container_;
  scoped_refptr<cc::slim::SolidColorLayer> bar_border_;
  scoped_refptr<cc::slim::NinePatchLayer> progress_bar_;
  scoped_refptr<cc::slim::NinePatchLayer> progress_bar_background_;

  int panel_icon_resource_id_;
  int bar_text_resource_id_;
  int panel_shadow_resource_id_;
  int rounded_bar_top_resource_id_;
  int bar_shadow_resource_id_;
  int drag_handlebar_resource_id_;
  int open_tab_icon_resource_id_;
  int close_icon_resource_id_;
};

}  //  namespace android

#endif  // CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_OVERLAY_PANEL_LAYER_H_