OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_MODEL_H_ | 5 #ifndef CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_MODEL_H_ |
6 #define CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_MODEL_H_ | 6 #define CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_MODEL_H_ |
7 | 7 |
8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
9 #include "chrome/browser/ui/passwords/manage_passwords_bubble.h" | 9 #include "chrome/browser/ui/passwords/manage_passwords_bubble.h" |
10 #include "components/autofill/core/common/password_form.h" | 10 #include "components/autofill/core/common/password_form.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 password_manager::CredentialType credential_type_); | 88 password_manager::CredentialType credential_type_); |
89 | 89 |
90 GURL origin() const { return origin_; } | 90 GURL origin() const { return origin_; } |
91 | 91 |
92 password_manager::ui::State state() const { return state_; } | 92 password_manager::ui::State state() const { return state_; } |
93 | 93 |
94 const base::string16& title() const { return title_; } | 94 const base::string16& title() const { return title_; } |
95 const autofill::PasswordForm& pending_password() const { | 95 const autofill::PasswordForm& pending_password() const { |
96 return pending_password_; | 96 return pending_password_; |
97 } | 97 } |
98 const autofill::ConstPasswordFormMap& best_matches() const { | 98 // Returns the available credentials which match the current site. |
99 return best_matches_; | 99 const ScopedVector<const autofill::PasswordForm>& local_credentials() const { |
| 100 return local_credentials_; |
100 } | 101 } |
101 const ScopedVector<autofill::PasswordForm>& local_pending_credentials() | 102 // Return the federated logins which may be used for logging in to the current |
| 103 // site. |
| 104 const ScopedVector<const autofill::PasswordForm>& federated_credentials() |
102 const { | 105 const { |
103 return local_pending_credentials_; | 106 return federated_credentials_; |
104 } | |
105 const ScopedVector<autofill::PasswordForm>& federated_pending_credentials() | |
106 const { | |
107 return federated_pending_credentials_; | |
108 } | 107 } |
109 const base::string16& manage_link() const { return manage_link_; } | 108 const base::string16& manage_link() const { return manage_link_; } |
110 bool never_save_passwords() const { return never_save_passwords_; } | 109 bool never_save_passwords() const { return never_save_passwords_; } |
111 const base::string16& save_confirmation_text() const { | 110 const base::string16& save_confirmation_text() const { |
112 return save_confirmation_text_; | 111 return save_confirmation_text_; |
113 } | 112 } |
114 const gfx::Range& save_confirmation_link_range() const { | 113 const gfx::Range& save_confirmation_link_range() const { |
115 return save_confirmation_link_range_; | 114 return save_confirmation_link_range_; |
116 } | 115 } |
117 | 116 |
118 Profile* GetProfile() const; | 117 Profile* GetProfile() const; |
119 | 118 |
120 #if defined(UNIT_TEST) | 119 #if defined(UNIT_TEST) |
121 // Gets and sets the reason the bubble was displayed. | 120 // Gets and sets the reason the bubble was displayed. |
122 password_manager::metrics_util::UIDisplayDisposition display_disposition() | 121 password_manager::metrics_util::UIDisplayDisposition display_disposition() |
123 const { | 122 const { |
124 return display_disposition_; | 123 return display_disposition_; |
125 } | 124 } |
126 | 125 |
127 // Gets the reason the bubble was dismissed. | 126 // Gets the reason the bubble was dismissed. |
128 password_manager::metrics_util::UIDismissalReason dismissal_reason() const { | 127 password_manager::metrics_util::UIDismissalReason dismissal_reason() const { |
129 return dismissal_reason_; | 128 return dismissal_reason_; |
130 } | 129 } |
131 | 130 |
132 // State setter. | 131 // State setter. |
133 void set_state(password_manager::ui::State state) { state_ = state; } | 132 void set_state(password_manager::ui::State state) { state_ = state; } |
134 #endif | 133 #endif |
135 | 134 |
136 // Upper limits on the size of the username and password fields. | 135 // Upper limits on the size of the username and password fields. |
137 static int UsernameFieldWidth(); | 136 static int UsernameFieldWidth(); |
138 static int PasswordFieldWidth(); | 137 static int PasswordFieldWidth(); |
139 | 138 |
140 private: | 139 private: |
141 // URL of the page from where this bubble was triggered. | 140 // URL of the page from where this bubble was triggered. |
142 GURL origin_; | 141 GURL origin_; |
143 password_manager::ui::State state_; | 142 password_manager::ui::State state_; |
144 base::string16 title_; | 143 base::string16 title_; |
145 autofill::PasswordForm pending_password_; | 144 autofill::PasswordForm pending_password_; |
146 autofill::ConstPasswordFormMap best_matches_; | 145 ScopedVector<const autofill::PasswordForm> local_credentials_; |
147 ScopedVector<autofill::PasswordForm> local_pending_credentials_; | 146 ScopedVector<const autofill::PasswordForm> federated_credentials_; |
148 ScopedVector<autofill::PasswordForm> federated_pending_credentials_; | |
149 base::string16 manage_link_; | 147 base::string16 manage_link_; |
150 base::string16 save_confirmation_text_; | 148 base::string16 save_confirmation_text_; |
151 gfx::Range save_confirmation_link_range_; | 149 gfx::Range save_confirmation_link_range_; |
152 // If true upon destruction, the user has confirmed that she never wants to | 150 // If true upon destruction, the user has confirmed that she never wants to |
153 // save passwords for a particular site. | 151 // save passwords for a particular site. |
154 bool never_save_passwords_; | 152 bool never_save_passwords_; |
155 password_manager::metrics_util::UIDisplayDisposition display_disposition_; | 153 password_manager::metrics_util::UIDisplayDisposition display_disposition_; |
156 password_manager::metrics_util::UIDismissalReason dismissal_reason_; | 154 password_manager::metrics_util::UIDismissalReason dismissal_reason_; |
157 | 155 |
158 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleModel); | 156 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleModel); |
159 }; | 157 }; |
160 | 158 |
161 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_MODEL_H_ | 159 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_MODEL_H_ |
OLD | NEW |