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/ui/passwords/manage_passwords_bubble_ui_controller.h" | |
8 #include "components/autofill/core/common/password_form.h" | 9 #include "components/autofill/core/common/password_form.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 { |
20 public: | 20 public: |
21 explicit ManagePasswordsBubbleModel(content::WebContents* web_contents); | 21 explicit ManagePasswordsBubbleModel( |
22 ManagePasswordsBubbleUIController* ui_controller); | |
markusheintz_
2014/04/10 13:26:31
Instead of passing the UI controller to the model
| |
22 virtual ~ManagePasswordsBubbleModel(); | 23 virtual ~ManagePasswordsBubbleModel(); |
23 | 24 |
24 enum ManagePasswordsBubbleState { | 25 enum ManagePasswordsBubbleState { |
25 PASSWORD_TO_BE_SAVED, | 26 PASSWORD_TO_BE_SAVED, |
26 MANAGE_PASSWORDS_AFTER_SAVING, | 27 MANAGE_PASSWORDS_AFTER_SAVING, |
27 MANAGE_PASSWORDS, | 28 MANAGE_PASSWORDS, |
28 NEVER_SAVE_PASSWORDS, | 29 NEVER_SAVE_PASSWORDS, |
29 }; | 30 }; |
30 | 31 |
31 enum PasswordAction { REMOVE_PASSWORD, ADD_PASSWORD }; | 32 enum PasswordAction { REMOVE_PASSWORD, ADD_PASSWORD }; |
(...skipping 23 matching lines...) Expand all Loading... | |
55 void DeleteFromBestMatches(autofill::PasswordForm password_form); | 56 void DeleteFromBestMatches(autofill::PasswordForm password_form); |
56 | 57 |
57 ManagePasswordsBubbleState manage_passwords_bubble_state() { | 58 ManagePasswordsBubbleState manage_passwords_bubble_state() { |
58 return manage_passwords_bubble_state_; | 59 return manage_passwords_bubble_state_; |
59 } | 60 } |
60 | 61 |
61 bool WaitingToSavePassword() { | 62 bool WaitingToSavePassword() { |
62 return manage_passwords_bubble_state() == PASSWORD_TO_BE_SAVED; | 63 return manage_passwords_bubble_state() == PASSWORD_TO_BE_SAVED; |
63 } | 64 } |
64 | 65 |
65 bool password_submitted() { return password_submitted_; } | 66 bool password_submitted() { return ui_controller_->password_submitted(); } |
66 const base::string16& title() { return title_; } | 67 const base::string16& title() { return title_; } |
67 const autofill::PasswordForm& pending_credentials() { | 68 const autofill::PasswordForm& pending_credentials() { |
68 return pending_credentials_; | 69 return pending_credentials_; |
69 } | 70 } |
70 const autofill::PasswordFormMap& best_matches() { return best_matches_; } | 71 const autofill::PasswordFormMap& best_matches() { return best_matches_; } |
71 const base::string16& manage_link() { return manage_link_; } | 72 const base::string16& manage_link() { return manage_link_; } |
72 | 73 |
73 private: | 74 private: |
74 // content::WebContentsObserver | 75 ManagePasswordsBubbleUIController* ui_controller_; |
75 virtual void WebContentsDestroyed( | |
76 content::WebContents* web_contents) OVERRIDE; | |
77 | |
78 content::WebContents* web_contents_; | |
79 ManagePasswordsBubbleState manage_passwords_bubble_state_; | 76 ManagePasswordsBubbleState manage_passwords_bubble_state_; |
80 bool password_submitted_; | 77 bool password_submitted_; |
81 base::string16 title_; | 78 base::string16 title_; |
82 autofill::PasswordForm pending_credentials_; | 79 autofill::PasswordForm pending_credentials_; |
83 autofill::PasswordFormMap best_matches_; | 80 autofill::PasswordFormMap best_matches_; |
84 base::string16 manage_link_; | 81 base::string16 manage_link_; |
85 | 82 |
86 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleModel); | 83 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleModel); |
87 }; | 84 }; |
88 | 85 |
89 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_MODEL_H_ | 86 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_MODEL_H_ |
OLD | NEW |