| 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" |
| 11 #include "components/password_manager/core/browser/password_manager_metrics_util
.h" | 11 #include "components/password_manager/core/browser/password_manager_metrics_util
.h" |
| 12 #include "components/password_manager/core/common/password_manager_ui.h" | 12 #include "components/password_manager/core/common/password_manager_ui.h" |
| 13 #include "content/public/browser/web_contents_observer.h" | 13 #include "content/public/browser/web_contents_observer.h" |
| 14 #include "ui/gfx/range/range.h" | 14 #include "ui/gfx/range/range.h" |
| 15 | 15 |
| 16 class ManagePasswordsIconController; | 16 class ManagePasswordsIconController; |
| 17 class ManagePasswordsUIController; | 17 class ManagePasswordsUIController; |
| 18 class Profile; | 18 class Profile; |
| 19 | 19 |
| 20 namespace content { | 20 namespace content { |
| 21 class WebContents; | 21 class WebContents; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace password_manager { |
| 25 enum class CredentialType : unsigned int; |
| 26 } |
| 27 |
| 24 // This model provides data for the ManagePasswordsBubble and controls the | 28 // This model provides data for the ManagePasswordsBubble and controls the |
| 25 // password management actions. | 29 // password management actions. |
| 26 class ManagePasswordsBubbleModel : public content::WebContentsObserver { | 30 class ManagePasswordsBubbleModel : public content::WebContentsObserver { |
| 27 public: | 31 public: |
| 28 enum PasswordAction { REMOVE_PASSWORD, ADD_PASSWORD }; | 32 enum PasswordAction { REMOVE_PASSWORD, ADD_PASSWORD }; |
| 29 | 33 |
| 30 // Creates a ManagePasswordsBubbleModel, which holds a raw pointer to the | 34 // Creates a ManagePasswordsBubbleModel, which holds a raw pointer to the |
| 31 // WebContents in which it lives. Defaults to a display disposition of | 35 // WebContents in which it lives. Defaults to a display disposition of |
| 32 // AUTOMATIC_WITH_PASSWORD_PENDING, and a dismissal reason of NOT_DISPLAYED. | 36 // AUTOMATIC_WITH_PASSWORD_PENDING, and a dismissal reason of NOT_DISPLAYED. |
| 33 // The bubble's state is updated from the ManagePasswordsUIController | 37 // The bubble's state is updated from the ManagePasswordsUIController |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 79 |
| 76 // Called by the view code when the manage link is clicked by the user. | 80 // Called by the view code when the manage link is clicked by the user. |
| 77 void OnManageLinkClicked(); | 81 void OnManageLinkClicked(); |
| 78 | 82 |
| 79 // Called by the view code to delete or add a password form to the | 83 // Called by the view code to delete or add a password form to the |
| 80 // PasswordStore. | 84 // PasswordStore. |
| 81 void OnPasswordAction(const autofill::PasswordForm& password_form, | 85 void OnPasswordAction(const autofill::PasswordForm& password_form, |
| 82 PasswordAction action); | 86 PasswordAction action); |
| 83 | 87 |
| 84 // Called by the view code to notify about chosen credential. | 88 // Called by the view code to notify about chosen credential. |
| 85 void OnChooseCredentials(const autofill::PasswordForm& password_form); | 89 void OnChooseCredentials(const autofill::PasswordForm& password_form, |
| 90 password_manager::CredentialType credential_type_); |
| 86 | 91 |
| 87 GURL origin() const { return origin_; } | 92 GURL origin() const { return origin_; } |
| 88 | 93 |
| 89 password_manager::ui::State state() const { return state_; } | 94 password_manager::ui::State state() const { return state_; } |
| 90 | 95 |
| 91 const base::string16& title() const { return title_; } | 96 const base::string16& title() const { return title_; } |
| 92 const autofill::PasswordForm& pending_password() const { | 97 const autofill::PasswordForm& pending_password() const { |
| 93 return pending_password_; | 98 return pending_password_; |
| 94 } | 99 } |
| 95 const autofill::ConstPasswordFormMap& best_matches() const { | 100 const autofill::ConstPasswordFormMap& best_matches() const { |
| 96 return best_matches_; | 101 return best_matches_; |
| 97 } | 102 } |
| 98 const ScopedVector<autofill::PasswordForm>& pending_credentials() const { | 103 const ScopedVector<autofill::PasswordForm>& local_pending_credentials() |
| 99 return pending_credentials_; | 104 const { |
| 105 return local_pending_credentials_; |
| 106 } |
| 107 const ScopedVector<autofill::PasswordForm>& federated_pending_credentials() |
| 108 const { |
| 109 return federated_pending_credentials_; |
| 100 } | 110 } |
| 101 const base::string16& manage_link() const { return manage_link_; } | 111 const base::string16& manage_link() const { return manage_link_; } |
| 102 bool never_save_passwords() const { return never_save_passwords_; } | 112 bool never_save_passwords() const { return never_save_passwords_; } |
| 103 const base::string16& save_confirmation_text() const { | 113 const base::string16& save_confirmation_text() const { |
| 104 return save_confirmation_text_; | 114 return save_confirmation_text_; |
| 105 } | 115 } |
| 106 const gfx::Range& save_confirmation_link_range() const { | 116 const gfx::Range& save_confirmation_link_range() const { |
| 107 return save_confirmation_link_range_; | 117 return save_confirmation_link_range_; |
| 108 } | 118 } |
| 109 | 119 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 129 static int UsernameFieldWidth(); | 139 static int UsernameFieldWidth(); |
| 130 static int PasswordFieldWidth(); | 140 static int PasswordFieldWidth(); |
| 131 | 141 |
| 132 private: | 142 private: |
| 133 // URL of the page from where this bubble was triggered. | 143 // URL of the page from where this bubble was triggered. |
| 134 GURL origin_; | 144 GURL origin_; |
| 135 password_manager::ui::State state_; | 145 password_manager::ui::State state_; |
| 136 base::string16 title_; | 146 base::string16 title_; |
| 137 autofill::PasswordForm pending_password_; | 147 autofill::PasswordForm pending_password_; |
| 138 autofill::ConstPasswordFormMap best_matches_; | 148 autofill::ConstPasswordFormMap best_matches_; |
| 139 ScopedVector<autofill::PasswordForm> pending_credentials_; | 149 ScopedVector<autofill::PasswordForm> local_pending_credentials_; |
| 150 ScopedVector<autofill::PasswordForm> federated_pending_credentials_; |
| 140 base::string16 manage_link_; | 151 base::string16 manage_link_; |
| 141 base::string16 save_confirmation_text_; | 152 base::string16 save_confirmation_text_; |
| 142 gfx::Range save_confirmation_link_range_; | 153 gfx::Range save_confirmation_link_range_; |
| 143 // If true upon destruction, the user has confirmed that she never wants to | 154 // If true upon destruction, the user has confirmed that she never wants to |
| 144 // save passwords for a particular site. | 155 // save passwords for a particular site. |
| 145 bool never_save_passwords_; | 156 bool never_save_passwords_; |
| 146 password_manager::metrics_util::UIDisplayDisposition display_disposition_; | 157 password_manager::metrics_util::UIDisplayDisposition display_disposition_; |
| 147 password_manager::metrics_util::UIDismissalReason dismissal_reason_; | 158 password_manager::metrics_util::UIDismissalReason dismissal_reason_; |
| 148 | 159 |
| 149 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleModel); | 160 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleModel); |
| 150 }; | 161 }; |
| 151 | 162 |
| 152 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_MODEL_H_ | 163 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_MODEL_H_ |
| OLD | NEW |