| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_EXCEPTIONS_VIEW_H__ | |
| 6 #define CHROME_BROWSER_PASSWORD_MANAGER_EXCEPTIONS_VIEW_H__ | |
| 7 | |
| 8 #include <vector> | |
| 9 | |
| 10 #include "chrome/browser/views/password_manager_view.h" | |
| 11 #include "chrome/browser/webdata/web_data_service.h" | |
| 12 #include "chrome/common/stl_util-inl.h" | |
| 13 #include "chrome/common/gfx/text_elider.h" | |
| 14 #include "chrome/views/controls/label.h" | |
| 15 #include "chrome/views/controls/table/table_view.h" | |
| 16 #include "chrome/views/window/dialog_delegate.h" | |
| 17 #include "chrome/views/window/window.h" | |
| 18 #include "webkit/glue/password_form.h" | |
| 19 | |
| 20 class PasswordManagerExceptionsTableModel : public PasswordManagerTableModel { | |
| 21 public: | |
| 22 explicit PasswordManagerExceptionsTableModel(Profile* profile); | |
| 23 virtual ~PasswordManagerExceptionsTableModel(); | |
| 24 | |
| 25 // TableModel methods. | |
| 26 virtual std::wstring GetText(int row, int column); | |
| 27 virtual int CompareValues(int row1, int row2, int col_id); | |
| 28 | |
| 29 // WebDataServiceConsumer implementation. | |
| 30 virtual void OnWebDataServiceRequestDone(WebDataService::Handle h, | |
| 31 const WDTypedResult* result); | |
| 32 // Request all logins data. | |
| 33 void GetAllExceptionsForProfile(); | |
| 34 }; | |
| 35 | |
| 36 class PasswordManagerExceptionsView : public views::View, | |
| 37 public views::DialogDelegate, | |
| 38 public views::TableViewObserver, | |
| 39 public views::ButtonListener, | |
| 40 public PasswordManagerTableModelObserver { | |
| 41 public: | |
| 42 explicit PasswordManagerExceptionsView(Profile* profile); | |
| 43 virtual ~PasswordManagerExceptionsView(); | |
| 44 | |
| 45 // Show the PasswordManagerExceptionsView for the given profile. | |
| 46 static void Show(Profile* profile); | |
| 47 | |
| 48 // View methods. | |
| 49 virtual void Layout(); | |
| 50 virtual gfx::Size GetPreferredSize(); | |
| 51 virtual void ViewHierarchyChanged(bool is_add, views::View* parent, | |
| 52 views::View* child); | |
| 53 | |
| 54 // views::TableViewObserver implementation. | |
| 55 virtual void OnSelectionChanged(); | |
| 56 | |
| 57 // ButtonListener implementation. | |
| 58 virtual void ButtonPressed(views::Button* sender); | |
| 59 | |
| 60 // views::DialogDelegate methods: | |
| 61 virtual int GetDialogButtons() const; | |
| 62 virtual bool CanResize() const { return true; } | |
| 63 virtual bool CanMaximize() const { return false; } | |
| 64 virtual bool IsAlwaysOnTop() const { return false; } | |
| 65 virtual bool HasAlwaysOnTopMenu() const { return false; } | |
| 66 virtual std::wstring GetWindowTitle() const; | |
| 67 virtual void WindowClosing(); | |
| 68 virtual views::View* GetContentsView(); | |
| 69 | |
| 70 // PasswordManagerTableModelObserver implementation. | |
| 71 virtual void OnRowCountChanged(size_t rows); | |
| 72 | |
| 73 private: | |
| 74 // Wire up buttons, the model, and the table view, and query the DB for | |
| 75 // exception data tied to the given profile. | |
| 76 void Init(); | |
| 77 | |
| 78 // Helper to configure our buttons and labels. | |
| 79 void SetupButtons(); | |
| 80 | |
| 81 // Helper to configure our table view. | |
| 82 void SetupTable(); | |
| 83 | |
| 84 // Components in this view. | |
| 85 PasswordManagerExceptionsTableModel table_model_; | |
| 86 views::TableView* table_view_; | |
| 87 | |
| 88 // The buttons and labels. | |
| 89 views::NativeButton remove_button_; | |
| 90 views::NativeButton remove_all_button_; | |
| 91 | |
| 92 static PasswordManagerExceptionsView* instance_; | |
| 93 | |
| 94 DISALLOW_EVIL_CONSTRUCTORS(PasswordManagerExceptionsView); | |
| 95 }; | |
| 96 #endif // CHROME_BROWSER_PASSWORD_MANAGER_EXCEPTIONS_VIEW_H__ | |
| OLD | NEW |