summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/views/options/managed_prefs_banner_view.h
blob: 71396d81f4d209e93497df617687050ea69fc61f (plain)
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
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_UI_VIEWS_OPTIONS_MANAGED_PREFS_BANNER_VIEW_H_
#define CHROME_BROWSER_UI_VIEWS_OPTIONS_MANAGED_PREFS_BANNER_VIEW_H_
#pragma once

#include "chrome/browser/policy/managed_prefs_banner_base.h"
#include "views/view.h"

namespace views {
class ImageView;
class Label;
}

// Displays a banner showing a warning message that tells the user some options
// cannot be changed because the relevant preferences are managed by their
// system administrator.
class ManagedPrefsBannerView : public policy::ManagedPrefsBannerBase,
                               public views::View {
 public:
  // Initialize the banner. |page| is used to determine the names of the
  // preferences that control the banner visibility through their managed flag.
  ManagedPrefsBannerView(PrefService* pref_service, OptionsPage page);
  virtual ~ManagedPrefsBannerView() {}

 private:
  // Initialize contents and layout.
  void Init();

  // views::View overrides.
  virtual gfx::Size GetPreferredSize();
  virtual void Layout();
  virtual void ViewHierarchyChanged(bool is_add,
                                    views::View* parent,
                                    views::View* child);

  // ManagedPrefsBannerBase override.
  virtual void OnUpdateVisibility();

  // Holds the warning icon image and text label and renders the border.
  views::View* content_;
  // Warning icon image.
  views::ImageView* warning_image_;
  // The label responsible for rendering the warning text.
  views::Label* label_;

  DISALLOW_IMPLICIT_CONSTRUCTORS(ManagedPrefsBannerView);
};

#endif  // CHROME_BROWSER_UI_VIEWS_OPTIONS_MANAGED_PREFS_BANNER_VIEW_H_