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
|
// Copyright (c) 2006-2008 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_PASSWORD_MANAGER_EXCEPTIONS_VIEW_H__
#define CHROME_BROWSER_PASSWORD_MANAGER_EXCEPTIONS_VIEW_H__
#include <vector>
#include "chrome/browser/views/password_manager_view.h"
#include "chrome/browser/webdata/web_data_service.h"
#include "chrome/common/stl_util-inl.h"
#include "chrome/common/gfx/text_elider.h"
#include "chrome/views/controls/label.h"
#include "chrome/views/controls/table/table_view.h"
#include "chrome/views/window/dialog_delegate.h"
#include "chrome/views/window/window.h"
#include "webkit/glue/password_form.h"
class PasswordManagerExceptionsTableModel : public PasswordManagerTableModel {
public:
explicit PasswordManagerExceptionsTableModel(Profile* profile);
virtual ~PasswordManagerExceptionsTableModel();
// TableModel methods.
virtual std::wstring GetText(int row, int column);
virtual int CompareValues(int row1, int row2, int col_id);
// WebDataServiceConsumer implementation.
virtual void OnWebDataServiceRequestDone(WebDataService::Handle h,
const WDTypedResult* result);
// Request all logins data.
void GetAllExceptionsForProfile();
};
class PasswordManagerExceptionsView : public views::View,
public views::DialogDelegate,
public views::TableViewObserver,
public views::ButtonListener,
public PasswordManagerTableModelObserver {
public:
explicit PasswordManagerExceptionsView(Profile* profile);
virtual ~PasswordManagerExceptionsView();
// Show the PasswordManagerExceptionsView for the given profile.
static void Show(Profile* profile);
// View methods.
virtual void Layout();
virtual gfx::Size GetPreferredSize();
virtual void ViewHierarchyChanged(bool is_add, views::View* parent,
views::View* child);
// views::TableViewObserver implementation.
virtual void OnSelectionChanged();
// ButtonListener implementation.
virtual void ButtonPressed(views::Button* sender);
// views::DialogDelegate methods:
virtual int GetDialogButtons() const;
virtual bool CanResize() const { return true; }
virtual bool CanMaximize() const { return false; }
virtual bool IsAlwaysOnTop() const { return false; }
virtual bool HasAlwaysOnTopMenu() const { return false; }
virtual std::wstring GetWindowTitle() const;
virtual void WindowClosing();
virtual views::View* GetContentsView();
// PasswordManagerTableModelObserver implementation.
virtual void OnRowCountChanged(size_t rows);
private:
// Wire up buttons, the model, and the table view, and query the DB for
// exception data tied to the given profile.
void Init();
// Helper to configure our buttons and labels.
void SetupButtons();
// Helper to configure our table view.
void SetupTable();
// Components in this view.
PasswordManagerExceptionsTableModel table_model_;
views::TableView* table_view_;
// The buttons and labels.
views::NativeButton remove_button_;
views::NativeButton remove_all_button_;
static PasswordManagerExceptionsView* instance_;
DISALLOW_EVIL_CONSTRUCTORS(PasswordManagerExceptionsView);
};
#endif // CHROME_BROWSER_PASSWORD_MANAGER_EXCEPTIONS_VIEW_H__
|