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