Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: chrome/browser/ui/passwords/manage_passwords_bubble_model.h

Issue 228593002: Password bubble: Keep the bubble in sync with the password store. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: vabr's feedback. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "components/autofill/core/common/password_form.h" 8 #include "components/autofill/core/common/password_form.h"
9 #include "content/public/browser/web_contents_observer.h" 9 #include "content/public/browser/web_contents_observer.h"
10 10
11 class ManagePasswordsIconController; 11 class ManagePasswordsIconController;
12 12
13 namespace content { 13 namespace content {
14 class WebContents; 14 class WebContents;
15 } 15 }
16 16
17 // This model provides data for the ManagePasswordsBubble and controls the 17 // This model provides data for the ManagePasswordsBubble and controls the
18 // password management actions. 18 // password management actions.
19 class ManagePasswordsBubbleModel : public content::WebContentsObserver { 19 class ManagePasswordsBubbleModel : public content::WebContentsObserver {
20 public: 20 public:
21 explicit ManagePasswordsBubbleModel(content::WebContents* web_contents); 21 explicit ManagePasswordsBubbleModel(content::WebContents* web_contents);
22 virtual ~ManagePasswordsBubbleModel(); 22 virtual ~ManagePasswordsBubbleModel();
23 23
24 enum ManagePasswordsBubbleState { 24 enum ManagePasswordsBubbleState {
25 PASSWORD_TO_BE_SAVED, 25 PASSWORD_TO_BE_SAVED,
26 MANAGE_PASSWORDS_AFTER_SAVING,
27 MANAGE_PASSWORDS, 26 MANAGE_PASSWORDS,
28 NEVER_SAVE_PASSWORDS, 27 NEVER_SAVE_PASSWORDS,
29 }; 28 };
30 29
31 enum PasswordAction { REMOVE_PASSWORD, ADD_PASSWORD }; 30 enum PasswordAction { REMOVE_PASSWORD, ADD_PASSWORD };
32 31
33 // Called by the view code when the "Nope" button in clicked by the user. 32 // Called by the view code when the "Nope" button in clicked by the user.
34 void OnNopeClicked(); 33 void OnNopeClicked();
35 34
36 // Called by the view code when the "Never for this site." button in clicked 35 // Called by the view code when the "Never for this site." button in clicked
37 // by the user. 36 // by the user.
38 void OnNeverForThisSiteClicked(); 37 void OnNeverForThisSiteClicked();
39 38
40 // Called by the view code when the save button in clicked by the user. 39 // Called by the view code when the save button in clicked by the user.
41 void OnSaveClicked(); 40 void OnSaveClicked();
42 41
43 // Called by the view code when the manage link is clicked by the user. 42 // Called by the view code when the manage link is clicked by the user.
44 void OnManageLinkClicked(); 43 void OnManageLinkClicked();
45 44
46 // Called by the view code to delete or add a password form to the 45 // Called by the view code to delete or add a password form to the
47 // PasswordStore. 46 // PasswordStore.
48 void OnPasswordAction(const autofill::PasswordForm& password_form, 47 void OnPasswordAction(const autofill::PasswordForm& password_form,
49 PasswordAction action); 48 PasswordAction action);
50 49
51 // Called by the view code when the ManagePasswordItemView is destroyed and
52 // the user chose to delete the password.
53 // TODO(npentrel): Remove this once best_matches_ are newly made on bubble
54 // opening.
55 void DeleteFromBestMatches(autofill::PasswordForm password_form);
56
57 ManagePasswordsBubbleState manage_passwords_bubble_state() { 50 ManagePasswordsBubbleState manage_passwords_bubble_state() {
58 return manage_passwords_bubble_state_; 51 return manage_passwords_bubble_state_;
59 } 52 }
60 53
61 bool WaitingToSavePassword() { 54 bool WaitingToSavePassword() {
62 return manage_passwords_bubble_state() == PASSWORD_TO_BE_SAVED; 55 return manage_passwords_bubble_state() == PASSWORD_TO_BE_SAVED;
63 } 56 }
64 57
65 bool password_submitted() { return password_submitted_; }
66 const base::string16& title() { return title_; } 58 const base::string16& title() { return title_; }
67 const autofill::PasswordForm& pending_credentials() { 59 const autofill::PasswordForm& pending_credentials() {
68 return pending_credentials_; 60 return pending_credentials_;
69 } 61 }
70 const autofill::PasswordFormMap& best_matches() { return best_matches_; } 62 const autofill::PasswordFormMap& best_matches() { return best_matches_; }
71 const base::string16& manage_link() { return manage_link_; } 63 const base::string16& manage_link() { return manage_link_; }
72 64
73 private: 65 private:
74 // content::WebContentsObserver 66 // content::WebContentsObserver
75 virtual void WebContentsDestroyed( 67 virtual void WebContentsDestroyed(
76 content::WebContents* web_contents) OVERRIDE; 68 content::WebContents* web_contents) OVERRIDE;
77 69
78 content::WebContents* web_contents_; 70 content::WebContents* web_contents_;
79 ManagePasswordsBubbleState manage_passwords_bubble_state_; 71 ManagePasswordsBubbleState manage_passwords_bubble_state_;
80 bool password_submitted_;
81 base::string16 title_; 72 base::string16 title_;
82 autofill::PasswordForm pending_credentials_; 73 autofill::PasswordForm pending_credentials_;
83 autofill::PasswordFormMap best_matches_; 74 autofill::PasswordFormMap best_matches_;
84 base::string16 manage_link_; 75 base::string16 manage_link_;
85 76
86 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleModel); 77 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleModel);
87 }; 78 };
88 79
89 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_MODEL_H_ 80 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698