| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 // by the user. | 56 // by the user. |
| 57 void OnNeverForThisSiteClicked(); | 57 void OnNeverForThisSiteClicked(); |
| 58 | 58 |
| 59 // Called by the view code when the "Undo" button is clicked in | 59 // Called by the view code when the "Undo" button is clicked in |
| 60 // "Never for this site." confirmation bubble by the user. | 60 // "Never for this site." confirmation bubble by the user. |
| 61 void OnUndoNeverForThisSite(); | 61 void OnUndoNeverForThisSite(); |
| 62 | 62 |
| 63 // Called by the view code when the site is unblacklisted. | 63 // Called by the view code when the site is unblacklisted. |
| 64 void OnUnblacklistClicked(); | 64 void OnUnblacklistClicked(); |
| 65 | 65 |
| 66 // Called by the view code when the save button in clicked by the user. | 66 // Called by the view code when the save button is clicked by the user. |
| 67 void OnSaveClicked(); | 67 void OnSaveClicked(); |
| 68 | 68 |
| 69 // Called by the view code when the update link is clicked by the user. |
| 70 void OnUpdateClicked(const autofill::PasswordForm& password_form); |
| 71 |
| 69 // Called by the view code when the "Done" button is clicked by the user. | 72 // Called by the view code when the "Done" button is clicked by the user. |
| 70 void OnDoneClicked(); | 73 void OnDoneClicked(); |
| 71 | 74 |
| 72 // Called by the view code when the "OK" button is clicked by the user. | 75 // Called by the view code when the "OK" button is clicked by the user. |
| 73 void OnOKClicked(); | 76 void OnOKClicked(); |
| 74 | 77 |
| 75 // Called by the view code when the manage link is clicked by the user. | 78 // Called by the view code when the manage link is clicked by the user. |
| 76 void OnManageLinkClicked(); | 79 void OnManageLinkClicked(); |
| 77 | 80 |
| 78 // Called by the view code when the brand name link is clicked by the user. | 81 // Called by the view code when the brand name link is clicked by the user. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 93 | 96 |
| 94 // Called by the view code to notify about chosen credential. | 97 // Called by the view code to notify about chosen credential. |
| 95 void OnChooseCredentials(const autofill::PasswordForm& password_form, | 98 void OnChooseCredentials(const autofill::PasswordForm& password_form, |
| 96 password_manager::CredentialType credential_type_); | 99 password_manager::CredentialType credential_type_); |
| 97 | 100 |
| 98 GURL origin() const { return origin_; } | 101 GURL origin() const { return origin_; } |
| 99 | 102 |
| 100 password_manager::ui::State state() const { return state_; } | 103 password_manager::ui::State state() const { return state_; } |
| 101 | 104 |
| 102 const base::string16& title() const { return title_; } | 105 const base::string16& title() const { return title_; } |
| 106 const base::string16& save_button_text() const { return save_button_text_; } |
| 103 const autofill::PasswordForm& pending_password() const { | 107 const autofill::PasswordForm& pending_password() const { |
| 104 return pending_password_; | 108 return pending_password_; |
| 105 } | 109 } |
| 106 // Returns the available credentials which match the current site. | 110 // Returns the available credentials which match the current site. |
| 107 const ScopedVector<const autofill::PasswordForm>& local_credentials() const { | 111 const ScopedVector<const autofill::PasswordForm>& local_credentials() const { |
| 108 return local_credentials_; | 112 return local_credentials_; |
| 109 } | 113 } |
| 110 // Return the federated logins which may be used for logging in to the current | 114 // Return the federated logins which may be used for logging in to the current |
| 111 // site. | 115 // site. |
| 112 const ScopedVector<const autofill::PasswordForm>& federated_credentials() | 116 const ScopedVector<const autofill::PasswordForm>& federated_credentials() |
| 113 const { | 117 const { |
| 114 return federated_credentials_; | 118 return federated_credentials_; |
| 115 } | 119 } |
| 116 const base::string16& manage_link() const { return manage_link_; } | 120 const base::string16& manage_link() const { return manage_link_; } |
| 117 bool never_save_passwords() const { return never_save_passwords_; } | 121 bool never_save_passwords() const { return never_save_passwords_; } |
| 118 const base::string16& save_confirmation_text() const { | 122 const base::string16& save_confirmation_text() const { |
| 119 return save_confirmation_text_; | 123 return save_confirmation_text_; |
| 120 } | 124 } |
| 121 const gfx::Range& save_confirmation_link_range() const { | 125 const gfx::Range& save_confirmation_link_range() const { |
| 122 return save_confirmation_link_range_; | 126 return save_confirmation_link_range_; |
| 123 } | 127 } |
| 124 | 128 |
| 125 const gfx::Range& title_brand_link_range() const { | 129 const gfx::Range& title_brand_link_range() const { |
| 126 return title_brand_link_range_; | 130 return title_brand_link_range_; |
| 127 } | 131 } |
| 128 | 132 |
| 133 bool is_password_change_form_without_username() const { |
| 134 return pending_password_.is_password_change_form_without_username; |
| 135 } |
| 136 |
| 129 Profile* GetProfile() const; | 137 Profile* GetProfile() const; |
| 130 | 138 |
| 131 // Returns true iff the new UI should be presented to user for managing and | 139 // Returns true iff the new UI should be presented to user for managing and |
| 132 // saving the passwords. | 140 // saving the passwords. |
| 133 bool IsNewUIActive() const; | 141 bool IsNewUIActive() const; |
| 134 | 142 |
| 143 // Returns true iff the multiple account selection prompt for account update |
| 144 // should be presented. |
| 145 bool ShouldShowMultipleAccountUpdateUI() const; |
| 146 |
| 135 #if defined(UNIT_TEST) | 147 #if defined(UNIT_TEST) |
| 136 // Gets and sets the reason the bubble was displayed. | 148 // Gets and sets the reason the bubble was displayed. |
| 137 password_manager::metrics_util::UIDisplayDisposition display_disposition() | 149 password_manager::metrics_util::UIDisplayDisposition display_disposition() |
| 138 const { | 150 const { |
| 139 return display_disposition_; | 151 return display_disposition_; |
| 140 } | 152 } |
| 141 | 153 |
| 142 // Gets the reason the bubble was dismissed. | 154 // Gets the reason the bubble was dismissed. |
| 143 password_manager::metrics_util::UIDismissalReason dismissal_reason() const { | 155 password_manager::metrics_util::UIDismissalReason dismissal_reason() const { |
| 144 return dismissal_reason_; | 156 return dismissal_reason_; |
| 145 } | 157 } |
| 146 | 158 |
| 147 // State setter. | 159 // State setter. |
| 148 void set_state(password_manager::ui::State state) { state_ = state; } | 160 void set_state(password_manager::ui::State state) { state_ = state; } |
| 149 #endif | 161 #endif |
| 150 | 162 |
| 151 // Upper limits on the size of the username and password fields. | 163 // Upper limits on the size of the username and password fields. |
| 152 static int UsernameFieldWidth(); | 164 static int UsernameFieldWidth(); |
| 153 static int PasswordFieldWidth(); | 165 static int PasswordFieldWidth(); |
| 154 | 166 |
| 155 private: | 167 private: |
| 156 // Updates |title_| and |title_brand_link_range_| for the | 168 // Updates |title_| and |title_brand_link_range_| for the |
| 157 // PENDING_PASSWORD_STATE. | 169 // PENDING_PASSWORD_STATE. |
| 158 void UpdatePendingStateTitle(); | 170 void UpdatePendingStateTitle(); |
| 159 // URL of the page from where this bubble was triggered. | 171 // URL of the page from where this bubble was triggered. |
| 160 GURL origin_; | 172 GURL origin_; |
| 161 password_manager::ui::State state_; | 173 password_manager::ui::State state_; |
| 162 base::string16 title_; | 174 base::string16 title_; |
| 175 base::string16 save_button_text_; |
| 163 // Range of characters in the title that contains the Smart Lock Brand and | 176 // Range of characters in the title that contains the Smart Lock Brand and |
| 164 // should point to an article. For the default title the range is empty. | 177 // should point to an article. For the default title the range is empty. |
| 165 gfx::Range title_brand_link_range_; | 178 gfx::Range title_brand_link_range_; |
| 166 autofill::PasswordForm pending_password_; | 179 autofill::PasswordForm pending_password_; |
| 167 ScopedVector<const autofill::PasswordForm> local_credentials_; | 180 ScopedVector<const autofill::PasswordForm> local_credentials_; |
| 168 ScopedVector<const autofill::PasswordForm> federated_credentials_; | 181 ScopedVector<const autofill::PasswordForm> federated_credentials_; |
| 169 base::string16 manage_link_; | 182 base::string16 manage_link_; |
| 170 base::string16 save_confirmation_text_; | 183 base::string16 save_confirmation_text_; |
| 171 gfx::Range save_confirmation_link_range_; | 184 gfx::Range save_confirmation_link_range_; |
| 172 // If true upon destruction, the user has confirmed that she never wants to | 185 // If true upon destruction, the user has confirmed that she never wants to |
| 173 // save passwords for a particular site. | 186 // save passwords for a particular site. |
| 174 bool never_save_passwords_; | 187 bool never_save_passwords_; |
| 175 password_manager::metrics_util::UIDisplayDisposition display_disposition_; | 188 password_manager::metrics_util::UIDisplayDisposition display_disposition_; |
| 176 password_manager::metrics_util::UIDismissalReason dismissal_reason_; | 189 password_manager::metrics_util::UIDismissalReason dismissal_reason_; |
| 177 | 190 |
| 178 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleModel); | 191 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleModel); |
| 179 }; | 192 }; |
| 180 | 193 |
| 181 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_MODEL_H_ | 194 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_MODEL_H_ |
| OLD | NEW |