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 "base/scoped_ptr.h" |
| 11 #include "chrome/browser/views/password_manager_view.h" |
| 12 #include "chrome/browser/webdata/web_data_service.h" |
| 13 #include "chrome/common/stl_util-inl.h" |
| 14 #include "chrome/common/gfx/text_elider.h" |
| 15 #include "chrome/views/dialog_delegate.h" |
| 16 #include "chrome/views/label.h" |
| 17 #include "chrome/views/native_button.h" |
| 18 #include "chrome/views/table_view.h" |
| 19 #include "chrome/views/window.h" |
| 20 #include "webkit/glue/password_form.h" |
| 21 |
| 22 class PasswordManagerExceptionsTableModel : public PasswordManagerTableModel { |
| 23 public: |
| 24 explicit PasswordManagerExceptionsTableModel(Profile* profile); |
| 25 virtual ~PasswordManagerExceptionsTableModel(); |
| 26 |
| 27 // TableModel methods. |
| 28 virtual std::wstring GetText(int row, int column); |
| 29 virtual int CompareValues(int row1, int row2, int col_id); |
| 30 |
| 31 // WebDataServiceConsumer implementation. |
| 32 virtual void OnWebDataServiceRequestDone(WebDataService::Handle h, |
| 33 const WDTypedResult* result); |
| 34 // Request all logins data. |
| 35 void GetAllExceptionsForProfile(); |
| 36 }; |
| 37 |
| 38 class PasswordManagerExceptionsView : public views::View, |
| 39 public views::DialogDelegate, |
| 40 public views::TableViewObserver, |
| 41 public views::NativeButton::Listener { |
| 42 public: |
| 43 explicit PasswordManagerExceptionsView(Profile* profile); |
| 44 virtual ~PasswordManagerExceptionsView(); |
| 45 |
| 46 // Show the PasswordManagerExceptionsView for the given profile. |
| 47 static void Show(Profile* profile); |
| 48 |
| 49 // View methods. |
| 50 virtual void Layout(); |
| 51 virtual gfx::Size GetPreferredSize(); |
| 52 virtual void ViewHierarchyChanged(bool is_add, views::View* parent, |
| 53 views::View* child); |
| 54 |
| 55 // views::TableViewObserver implementation. |
| 56 virtual void OnSelectionChanged(); |
| 57 |
| 58 // NativeButton::Listener implementation. |
| 59 virtual void ButtonPressed(views::NativeButton* sender); |
| 60 |
| 61 // views::DialogDelegate methods: |
| 62 virtual int GetDialogButtons() const; |
| 63 virtual bool CanResize() const { return true; } |
| 64 virtual bool CanMaximize() const { return false; } |
| 65 virtual bool IsAlwaysOnTop() const { return false; } |
| 66 virtual bool HasAlwaysOnTopMenu() const { return false; } |
| 67 virtual std::wstring GetWindowTitle() const; |
| 68 virtual void WindowClosing(); |
| 69 virtual views::View* GetContentsView(); |
| 70 |
| 71 private: |
| 72 // Wire up buttons, the model, and the table view, and query the DB for |
| 73 // exception data tied to the given profile. |
| 74 void Init(); |
| 75 |
| 76 // Helper to configure our buttons and labels. |
| 77 void SetupButtons(); |
| 78 |
| 79 // Helper to configure our table view. |
| 80 void SetupTable(); |
| 81 |
| 82 // Components in this view. |
| 83 PasswordManagerExceptionsTableModel table_model_; |
| 84 views::TableView* table_view_; |
| 85 |
| 86 // The buttons and labels. |
| 87 views::NativeButton remove_button_; |
| 88 views::NativeButton remove_all_button_; |
| 89 |
| 90 DISALLOW_EVIL_CONSTRUCTORS(PasswordManagerExceptionsView); |
| 91 }; |
| 92 #endif // CHROME_BROWSER_PASSWORD_MANAGER_EXCEPTIONS_VIEW_H__ |
| 93 |
OLD | NEW |