| 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.h" | 8 #include "chrome/browser/ui/passwords/manage_passwords_bubble.h" |
| 9 #include "components/autofill/core/common/password_form.h" | 9 #include "components/autofill/core/common/password_form.h" |
| 10 #include "components/password_manager/core/browser/password_manager_metrics_util
.h" | 10 #include "components/password_manager/core/browser/password_manager_metrics_util
.h" |
| 11 #include "components/password_manager/core/common/password_manager_ui.h" | 11 #include "components/password_manager/core/common/password_manager_ui.h" |
| 12 #include "content/public/browser/web_contents_observer.h" | 12 #include "content/public/browser/web_contents_observer.h" |
| 13 #include "ui/gfx/range/range.h" |
| 13 | 14 |
| 14 class ManagePasswordsIconController; | 15 class ManagePasswordsIconController; |
| 15 | 16 |
| 16 namespace content { | 17 namespace content { |
| 17 class WebContents; | 18 class WebContents; |
| 18 } | 19 } |
| 19 | 20 |
| 20 // This model provides data for the ManagePasswordsBubble and controls the | 21 // This model provides data for the ManagePasswordsBubble and controls the |
| 21 // password management actions. | 22 // password management actions. |
| 22 class ManagePasswordsBubbleModel : public content::WebContentsObserver { | 23 class ManagePasswordsBubbleModel : public content::WebContentsObserver { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 46 | 47 |
| 47 // Called by the view code when the site is unblacklisted. | 48 // Called by the view code when the site is unblacklisted. |
| 48 void OnUnblacklistClicked(); | 49 void OnUnblacklistClicked(); |
| 49 | 50 |
| 50 // Called by the view code when the save button in clicked by the user. | 51 // Called by the view code when the save button in clicked by the user. |
| 51 void OnSaveClicked(); | 52 void OnSaveClicked(); |
| 52 | 53 |
| 53 // Called by the view code when the "Done" button is clicked by the user. | 54 // Called by the view code when the "Done" button is clicked by the user. |
| 54 void OnDoneClicked(); | 55 void OnDoneClicked(); |
| 55 | 56 |
| 57 // Called by the view code when the "OK" button is clicked by the user. |
| 58 void OnOKClicked(); |
| 59 |
| 56 // Called by the view code when the manage link is clicked by the user. | 60 // Called by the view code when the manage link is clicked by the user. |
| 57 void OnManageLinkClicked(); | 61 void OnManageLinkClicked(); |
| 58 | 62 |
| 63 // Called by the view code when the manage in Google link is clicked by the |
| 64 // user. |
| 65 void OnRemoteManageLinkClicked(); |
| 66 |
| 59 // Called by the view code to delete or add a password form to the | 67 // Called by the view code to delete or add a password form to the |
| 60 // PasswordStore. | 68 // PasswordStore. |
| 61 void OnPasswordAction(const autofill::PasswordForm& password_form, | 69 void OnPasswordAction(const autofill::PasswordForm& password_form, |
| 62 PasswordAction action); | 70 PasswordAction action); |
| 63 | 71 |
| 64 password_manager::ui::State state() const { return state_; } | 72 password_manager::ui::State state() const { return state_; } |
| 65 | 73 |
| 66 const base::string16& title() const { return title_; } | 74 const base::string16& title() const { return title_; } |
| 67 const autofill::PasswordForm& pending_credentials() const { | 75 const autofill::PasswordForm& pending_credentials() const { |
| 68 return pending_credentials_; | 76 return pending_credentials_; |
| 69 } | 77 } |
| 70 const autofill::PasswordFormMap& best_matches() const { | 78 const autofill::ConstPasswordFormMap& best_matches() const { |
| 71 return best_matches_; | 79 return best_matches_; |
| 72 } | 80 } |
| 73 const base::string16& manage_link() const { return manage_link_; } | 81 const base::string16& manage_link() const { return manage_link_; } |
| 82 const base::string16& save_confirmation_text() const { |
| 83 return save_confirmation_text_; |
| 84 } |
| 85 const gfx::Range& save_confirmation_link_range() const { |
| 86 return save_confirmation_link_range_; |
| 87 } |
| 74 | 88 |
| 75 #if defined(UNIT_TEST) | 89 #if defined(UNIT_TEST) |
| 76 // Gets and sets the reason the bubble was displayed. | 90 // Gets and sets the reason the bubble was displayed. |
| 77 password_manager::metrics_util::UIDisplayDisposition display_disposition() | 91 password_manager::metrics_util::UIDisplayDisposition display_disposition() |
| 78 const { | 92 const { |
| 79 return display_disposition_; | 93 return display_disposition_; |
| 80 } | 94 } |
| 81 | 95 |
| 82 // Gets the reason the bubble was dismissed. | 96 // Gets the reason the bubble was dismissed. |
| 83 password_manager::metrics_util::UIDismissalReason dismissal_reason() const { | 97 password_manager::metrics_util::UIDismissalReason dismissal_reason() const { |
| 84 return dismissal_reason_; | 98 return dismissal_reason_; |
| 85 } | 99 } |
| 86 | 100 |
| 87 // State setter. | 101 // State setter. |
| 88 void set_state(password_manager::ui::State state) { state_ = state; } | 102 void set_state(password_manager::ui::State state) { state_ = state; } |
| 89 #endif | 103 #endif |
| 90 | 104 |
| 91 private: | 105 private: |
| 92 password_manager::ui::State state_; | 106 password_manager::ui::State state_; |
| 93 base::string16 title_; | 107 base::string16 title_; |
| 94 autofill::PasswordForm pending_credentials_; | 108 autofill::PasswordForm pending_credentials_; |
| 95 autofill::PasswordFormMap best_matches_; | 109 autofill::ConstPasswordFormMap best_matches_; |
| 96 base::string16 manage_link_; | 110 base::string16 manage_link_; |
| 111 base::string16 save_confirmation_text_; |
| 112 gfx::Range save_confirmation_link_range_; |
| 97 | 113 |
| 98 password_manager::metrics_util::UIDisplayDisposition display_disposition_; | 114 password_manager::metrics_util::UIDisplayDisposition display_disposition_; |
| 99 password_manager::metrics_util::UIDismissalReason dismissal_reason_; | 115 password_manager::metrics_util::UIDismissalReason dismissal_reason_; |
| 100 | 116 |
| 101 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleModel); | 117 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleModel); |
| 102 }; | 118 }; |
| 103 | 119 |
| 104 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_MODEL_H_ | 120 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_MODEL_H_ |
| OLD | NEW |