summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/options/exceptions_page_view.h
blob: 10756d9cbef35fa3c6b78d160ab8c085297aedcc (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// Copyright (c) 2009 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_EXCEPTIONS_PAGE_VIEW_H_
#define CHROME_BROWSER_VIEWS_OPTIONS_EXCEPTIONS_PAGE_VIEW_H_

#include <vector>

#include "chrome/browser/views/options/options_page_view.h"
#include "chrome/browser/views/options/passwords_page_view.h"
#include "views/controls/table/table_view_observer.h"

class Profile;

///////////////////////////////////////////////////////////////////////////////
// ExceptionsTableModel
class ExceptionsTableModel : public PasswordsTableModel {
 public:
  explicit ExceptionsTableModel(Profile* profile);
  virtual ~ExceptionsTableModel();

  // TableModel methods.
  virtual std::wstring GetText(int row, int column);
  virtual int CompareValues(int row1, int row2, int col_id);

  // PasswordStoreConsumer implementation.
  virtual void OnPasswordStoreRequestDone(
      int handle, const std::vector<webkit_glue::PasswordForm*>& result);
  // Request all logins data.
  void GetAllExceptionsForProfile();
};

///////////////////////////////////////////////////////////////////////////////
// ExceptionsPageView
class ExceptionsPageView : public OptionsPageView,
                           public views::TableViewObserver,
                           public views::ButtonListener,
                           public PasswordsTableModelObserver {
 public:
  explicit ExceptionsPageView(Profile* profile);
  virtual ~ExceptionsPageView();

  // views::TableViewObserverImplementation.
  virtual void OnSelectionChanged();

  // views::ButtonListener implementation.
  virtual void ButtonPressed(views::Button* sender, const views::Event& event);

  // PasswordsTableModelObserver implementation.
  virtual void OnRowCountChanged(size_t rows);

 protected:
  virtual void InitControlLayout();

 private:
  // Helper to configure our buttons and labels.
  void SetupButtons();

  // Helper to configure our table view.
  void SetupTable();

  ExceptionsTableModel table_model_;
  views::TableView* table_view_;

  // The buttons and labels.
  views::NativeButton remove_button_;
  views::NativeButton remove_all_button_;
  MultiLabelButtons show_button_;

  DISALLOW_COPY_AND_ASSIGN(ExceptionsPageView);
};

#endif  // CHROME_BROWSER_VIEWS_OPTIONS_EXCEPTIONS_PAGE_VIEW_H_