File: quick_settings_header.h

package info (click to toggle)
chromium 138.0.7204.183-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 6,071,908 kB
  • sloc: cpp: 34,937,088; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,953; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,806; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (81 lines) | stat: -rw-r--r-- 3,013 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
// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ASH_SYSTEM_UNIFIED_QUICK_SETTINGS_HEADER_H_
#define ASH_SYSTEM_UNIFIED_QUICK_SETTINGS_HEADER_H_

#include "ash/ash_export.h"
#include "base/memory/raw_ptr.h"
#include "ui/views/view.h"

namespace views {
class Label;
}  // namespace views

namespace ash {

class ChannelIndicatorQuickSettingsView;
class EolNoticeQuickSettingsView;
class ExtendedUpdatesNoticeQuickSettingsView;
class UnifiedSystemTrayController;

// The header view shown at the top of the `QuickSettingsView`. Contains an
// optional "Managed by" button and an optional release channel indicator. Sets
// itself invisible when its child views do not need to be shown. When both
// buttons are shown uses a two-column side-by-side layout.
class ASH_EXPORT QuickSettingsHeader : public views::View {
  METADATA_HEADER(QuickSettingsHeader, views::View)

 public:
  explicit QuickSettingsHeader(UnifiedSystemTrayController* controller);
  QuickSettingsHeader(const QuickSettingsHeader&) = delete;
  QuickSettingsHeader& operator=(const QuickSettingsHeader&) = delete;
  ~QuickSettingsHeader() override;

  // views::View:
  void ChildVisibilityChanged(views::View* child) override;

  ChannelIndicatorQuickSettingsView* channel_view_for_test() {
    return channel_view_;
  }

  EolNoticeQuickSettingsView* eol_notice_for_test() { return eol_notice_; }

  // Shows enterprise managed device information.
  static void ShowEnterpriseInfo(UnifiedSystemTrayController* controller,
                                 bool show_management_disclosure_dialog,
                                 bool is_user_session_blocked,
                                 bool has_enterprise_domain_manager);

  views::View* GetManagedButtonForTest();
  views::View* GetSupervisedButtonForTest();
  views::Label* GetManagedButtonLabelForTest();
  views::Label* GetSupervisedButtonLabelForTest();
  views::View* GetExtendedUpdatesViewForTest();

 private:
  // A view that shows whether the device is enterprise managed or not. It
  // updates by observing `EnterpriseDomainModel`.
  class EnterpriseManagedView;

  // A base class of the views showing device management state.
  class ManagedStateView;

  // Updates visibility for this view. When it has no children it sets itself
  // invisible so it does not consume any space. Also updates the size of the
  // child views based on whether one or two columns are visible.
  void UpdateVisibilityAndLayout();

  // Owned by views hierarchy.
  raw_ptr<EnterpriseManagedView> enterprise_managed_view_ = nullptr;
  raw_ptr<ManagedStateView> supervised_view_ = nullptr;
  raw_ptr<ChannelIndicatorQuickSettingsView> channel_view_ = nullptr;
  raw_ptr<EolNoticeQuickSettingsView> eol_notice_ = nullptr;
  raw_ptr<ExtendedUpdatesNoticeQuickSettingsView> extended_updates_notice_ =
      nullptr;
};

}  // namespace ash

#endif  // ASH_SYSTEM_UNIFIED_QUICK_SETTINGS_HEADER_H_