summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/options/options_page_view.h
blob: 289b00a78b8b95ec271bb3f62edca86643d9ce8c (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_VIEWS_OPTIONS_OPTIONS_PAGE_VIEW_H__
#define CHROME_BROWSER_VIEWS_OPTIONS_OPTIONS_PAGE_VIEW_H__

#include "chrome/browser/options_page_base.h"
#include "views/controls/link.h"
#include "views/controls/button/native_button.h"

class PrefService;

///////////////////////////////////////////////////////////////////////////////
// OptionsPageView
//
//  A base class for Options dialog pages that handles ensuring control
//  initialization is done just once.
//
class OptionsPageView : public views::View,
                        public OptionsPageBase {
 public:
  virtual ~OptionsPageView();

  // Returns true if the window containing this view can be closed, given the
  // current state of this view. This can be used to prevent the window from
  // being closed when a modal dialog box is showing, for example.
  virtual bool CanClose() const { return true; }

 protected:
  // This class cannot be instantiated directly, but its constructor must be
  // called by derived classes.
  explicit OptionsPageView(Profile* profile);

  // Initializes the layout of the controls within the panel.
  virtual void InitControlLayout() = 0;

  // views::View overrides:
  virtual void ViewHierarchyChanged(bool is_add,
                                    views::View* parent,
                                    views::View* child);

  virtual bool GetAccessibleRole(AccessibilityTypes::Role* role);

 private:
  // Whether or not the control layout has been initialized for this page.
  bool initialized_;

  DISALLOW_COPY_AND_ASSIGN(OptionsPageView);
};

#endif  // CHROME_BROWSER_VIEWS_OPTIONS_OPTIONS_PAGE_VIEW_H__