| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_VIEW_H__ | 5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_VIEW_H__ |
| 6 #define CHROME_BROWSER_PASSWORD_MANAGER_VIEW_H__ | 6 #define CHROME_BROWSER_PASSWORD_MANAGER_VIEW_H__ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 // WebDataServiceConsumer implementation. | 43 // WebDataServiceConsumer implementation. |
| 44 virtual void OnWebDataServiceRequestDone(WebDataService::Handle h, | 44 virtual void OnWebDataServiceRequestDone(WebDataService::Handle h, |
| 45 const WDTypedResult* result); | 45 const WDTypedResult* result); |
| 46 // Request saved logins data. | 46 // Request saved logins data. |
| 47 void GetAllSavedLoginsForProfile(); | 47 void GetAllSavedLoginsForProfile(); |
| 48 | 48 |
| 49 // Return the PasswordForm at the specified index. | 49 // Return the PasswordForm at the specified index. |
| 50 PasswordForm* GetPasswordFormAt(int row); | 50 PasswordForm* GetPasswordFormAt(int row); |
| 51 | 51 |
| 52 private: | 52 protected: |
| 53 // Wraps the PasswordForm from the database and caches the display URL for | 53 // Wraps the PasswordForm from the database and caches the display URL for |
| 54 // quick sorting. | 54 // quick sorting. |
| 55 struct PasswordRow { | 55 struct PasswordRow { |
| 56 PasswordRow(const gfx::SortedDisplayURL& url, PasswordForm* password_form) | 56 PasswordRow(const gfx::SortedDisplayURL& url, PasswordForm* password_form) |
| 57 : display_url(url), form(password_form) { | 57 : display_url(url), form(password_form) { |
| 58 } | 58 } |
| 59 | 59 |
| 60 // Contains the URL that is displayed along with the | 60 // Contains the URL that is displayed along with the |
| 61 gfx::SortedDisplayURL display_url; | 61 gfx::SortedDisplayURL display_url; |
| 62 | 62 |
| 63 // The underlying PasswordForm. We own this. | 63 // The underlying PasswordForm. We own this. |
| 64 scoped_ptr<PasswordForm> form; | 64 scoped_ptr<PasswordForm> form; |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 // Cancel any pending login query involving a callback. | |
| 68 void CancelLoginsQuery(); | |
| 69 | |
| 70 // The web data service associated with the currently active profile. | 67 // The web data service associated with the currently active profile. |
| 71 WebDataService* web_data_service() { | 68 WebDataService* web_data_service() { |
| 72 return profile_->GetWebDataService(Profile::EXPLICIT_ACCESS); | 69 return profile_->GetWebDataService(Profile::EXPLICIT_ACCESS); |
| 73 } | 70 } |
| 74 | 71 |
| 75 // The TableView observing this model. | 72 // The TableView observing this model. |
| 76 views::TableModelObserver* observer_; | 73 views::TableModelObserver* observer_; |
| 77 | 74 |
| 78 // Handle to any pending WebDataService::GetLogins query. | 75 // Handle to any pending WebDataService::GetLogins query. |
| 79 WebDataService::Handle pending_login_query_; | 76 WebDataService::Handle pending_login_query_; |
| 80 | 77 |
| 81 // The set of passwords we're showing. | 78 // The set of passwords we're showing. |
| 82 typedef std::vector<PasswordRow*> PasswordRows; | 79 typedef std::vector<PasswordRow*> PasswordRows; |
| 83 PasswordRows saved_signons_; | 80 PasswordRows saved_signons_; |
| 84 STLElementDeleter<PasswordRows> saved_signons_cleanup_; | 81 STLElementDeleter<PasswordRows> saved_signons_cleanup_; |
| 85 | 82 |
| 86 Profile* profile_; | 83 Profile* profile_; |
| 87 | 84 |
| 85 private: |
| 86 // Cancel any pending login query involving a callback. |
| 87 void CancelLoginsQuery(); |
| 88 |
| 88 DISALLOW_EVIL_CONSTRUCTORS(PasswordManagerTableModel); | 89 DISALLOW_EVIL_CONSTRUCTORS(PasswordManagerTableModel); |
| 89 }; | 90 }; |
| 90 | 91 |
| 91 // A button that can have 2 different labels set on it and for which the | 92 // A button that can have 2 different labels set on it and for which the |
| 92 // preferred size is the size of the widest string. | 93 // preferred size is the size of the widest string. |
| 93 class MultiLabelButtons : public views::NativeButton { | 94 class MultiLabelButtons : public views::NativeButton { |
| 94 public: | 95 public: |
| 95 MultiLabelButtons(const std::wstring& label, const std::wstring& alt_label); | 96 MultiLabelButtons(const std::wstring& label, const std::wstring& alt_label); |
| 96 | 97 |
| 97 virtual gfx::Size GetPreferredSize(); | 98 virtual gfx::Size GetPreferredSize(); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 // The buttons and labels. | 156 // The buttons and labels. |
| 156 MultiLabelButtons show_button_; | 157 MultiLabelButtons show_button_; |
| 157 views::NativeButton remove_button_; | 158 views::NativeButton remove_button_; |
| 158 views::NativeButton remove_all_button_; | 159 views::NativeButton remove_all_button_; |
| 159 views::Label password_label_; | 160 views::Label password_label_; |
| 160 | 161 |
| 161 DISALLOW_EVIL_CONSTRUCTORS(PasswordManagerView); | 162 DISALLOW_EVIL_CONSTRUCTORS(PasswordManagerView); |
| 162 }; | 163 }; |
| 163 #endif // CHROME_BROWSER_PASSWORD_MANAGER_VIEW_H__ | 164 #endif // CHROME_BROWSER_PASSWORD_MANAGER_VIEW_H__ |
| 164 | 165 |
| OLD | NEW |