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 "chrome/browser/content_settings/tab_specific_content_settings.h" | 8 #include "components/autofill/core/common/password_form.h" |
9 #include "content/public/browser/web_contents_observer.h" | |
10 | |
11 class ManagePasswordsIconController; | |
12 | |
13 namespace autofill { | |
14 class PasswordForm; | |
15 } | |
9 | 16 |
10 namespace content { | 17 namespace content { |
11 class WebContents; | 18 class WebContents; |
12 } | 19 } |
13 | 20 |
14 // This model provides data for the ManagePasswordsBubble and controls the | 21 // This model provides data for the ManagePasswordsBubble and controls the |
15 // password management actions. | 22 // password management actions. |
16 class ManagePasswordsBubbleModel : public content::WebContentsObserver { | 23 class ManagePasswordsBubbleModel : public content::WebContentsObserver { |
17 public: | 24 public: |
18 explicit ManagePasswordsBubbleModel(content::WebContents* web_contents); | 25 explicit ManagePasswordsBubbleModel(content::WebContents* web_contents); |
19 virtual ~ManagePasswordsBubbleModel(); | 26 virtual ~ManagePasswordsBubbleModel(); |
20 | 27 |
21 enum ManagePasswordsBubbleState { | 28 enum ManagePasswordsBubbleState { |
22 PASSWORD_TO_BE_SAVED, | 29 PASSWORD_TO_BE_SAVED, |
23 MANAGE_PASSWORDS_AFTER_SAVING, | 30 MANAGE_PASSWORDS_AFTER_SAVING, |
24 MANAGE_PASSWORDS | 31 MANAGE_PASSWORDS |
25 }; | 32 }; |
26 | 33 |
27 // Called by the view code when the cancel button in clicked by the user. | 34 // Called by the view code when the cancel button in clicked by the user. |
28 void OnCancelClicked(); | 35 void OnCancelClicked(); |
29 | 36 |
30 // Called by the view code when the save button in clicked by the user. | 37 // Called by the view code when the save button in clicked by the user. |
31 void OnSaveClicked(); | 38 void OnSaveClicked(); |
32 | 39 |
33 // Called by the view code when the manage link is clicked by the user. | 40 // Called by the view code when the manage link is clicked by the user. |
34 void OnManageLinkClicked(); | 41 void OnManageLinkClicked(); |
35 | 42 |
36 // Called by the view code to delete or add a password form to the | 43 // Called by the view code to delete or add a password form to the |
37 // PasswordStore. | 44 // PasswordStore. |
38 void PasswordAction(autofill::PasswordForm password_form, bool remove); | 45 void AddOrRemovePassword(autofill::PasswordForm password_form, bool remove); |
markusheintz_
2013/11/26 12:44:37
"Add" or "Remove" are two contradicting verbs that
npentrel
2013/11/26 14:25:55
Done.
| |
39 | 46 |
40 // Called by the view code when the ManagePasswordItemView is destroyed and | 47 // Called by the view code when the ManagePasswordItemView is destroyed and |
41 // the user chose to delete the password. | 48 // the user chose to delete the password. |
42 // TODO(npentrel): Remove this once best_matches_ are newly made on bubble | 49 // TODO(npentrel): Remove this once best_matches_ are newly made on bubble |
43 // opening. | 50 // opening. |
44 void DeleteFromBestMatches(autofill::PasswordForm password_form); | 51 void DeleteFromBestMatches(autofill::PasswordForm password_form); |
45 | 52 |
46 ManagePasswordsBubbleState manage_passwords_bubble_state() { | 53 ManagePasswordsBubbleState manage_passwords_bubble_state() { |
47 return manage_passwords_bubble_state_; | 54 return manage_passwords_bubble_state_; |
48 } | 55 } |
49 | 56 |
50 bool password_submitted() { return password_submitted_; } | 57 bool password_submitted() { return password_submitted_; } |
58 | |
markusheintz_
2013/11/26 12:44:37
nit: remove this empty line
npentrel
2013/11/26 14:25:55
Done.
| |
51 const string16& title() { return title_; } | 59 const string16& title() { return title_; } |
52 const autofill::PasswordForm& pending_credentials() { | 60 const autofill::PasswordForm& pending_credentials() { |
53 return pending_credentials_; | 61 return pending_credentials_; |
54 } | 62 } |
55 const autofill::PasswordFormMap& best_matches() { return best_matches_; } | 63 const autofill::PasswordFormMap& best_matches() { return best_matches_; } |
56 const string16& manage_link() { return manage_link_; } | 64 const string16& manage_link() { return manage_link_; } |
57 | 65 |
58 private: | 66 private: |
59 // content::WebContentsObserver | 67 // content::WebContentsObserver |
60 virtual void WebContentsDestroyed( | 68 virtual void WebContentsDestroyed( |
61 content::WebContents* web_contents) OVERRIDE; | 69 content::WebContents* web_contents) OVERRIDE; |
62 | 70 |
63 content::WebContents* web_contents_; | 71 content::WebContents* web_contents_; |
64 ManagePasswordsBubbleState manage_passwords_bubble_state_; | 72 ManagePasswordsBubbleState manage_passwords_bubble_state_; |
65 bool password_submitted_; | 73 bool password_submitted_; |
66 string16 title_; | 74 string16 title_; |
67 autofill::PasswordForm pending_credentials_; | 75 autofill::PasswordForm pending_credentials_; |
68 autofill::PasswordFormMap best_matches_; | 76 autofill::PasswordFormMap best_matches_; |
69 string16 manage_link_; | 77 string16 manage_link_; |
70 | 78 |
71 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleModel); | 79 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleModel); |
72 }; | 80 }; |
73 | 81 |
74 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_MODEL_H_ | 82 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_MODEL_H_ |
OLD | NEW |