| 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 #include "chrome/browser/ui/passwords/manage_passwords_bubble_ui_controller.h" | 5 #include "chrome/browser/ui/passwords/manage_passwords_bubble_ui_controller.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.h" |
| 8 #include "chrome/browser/ui/browser_finder.h" | 8 #include "chrome/browser/ui/browser_finder.h" |
| 9 #include "chrome/browser/ui/browser_window.h" | 9 #include "chrome/browser/ui/browser_window.h" |
| 10 #include "chrome/browser/ui/chrome_pages.h" |
| 10 #include "chrome/browser/ui/omnibox/location_bar.h" | 11 #include "chrome/browser/ui/omnibox/location_bar.h" |
| 12 #include "chrome/common/url_constants.h" |
| 11 #include "content/public/browser/notification_service.h" | 13 #include "content/public/browser/notification_service.h" |
| 12 | 14 |
| 13 using autofill::PasswordFormMap; | 15 using autofill::PasswordFormMap; |
| 14 using password_manager::PasswordFormManager; | 16 using password_manager::PasswordFormManager; |
| 15 | 17 |
| 16 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ManagePasswordsBubbleUIController); | 18 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ManagePasswordsBubbleUIController); |
| 17 | 19 |
| 18 ManagePasswordsBubbleUIController::ManagePasswordsBubbleUIController( | 20 ManagePasswordsBubbleUIController::ManagePasswordsBubbleUIController( |
| 19 content::WebContents* web_contents) | 21 content::WebContents* web_contents) |
| 20 : content::WebContentsObserver(web_contents), | 22 : content::WebContentsObserver(web_contents), |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 73 |
| 72 void ManagePasswordsBubbleUIController::RemoveFromBestMatches( | 74 void ManagePasswordsBubbleUIController::RemoveFromBestMatches( |
| 73 autofill::PasswordForm password_form) { | 75 autofill::PasswordForm password_form) { |
| 74 password_form_map_.erase(password_form.username_value); | 76 password_form_map_.erase(password_form.username_value); |
| 75 } | 77 } |
| 76 | 78 |
| 77 void ManagePasswordsBubbleUIController::OnBubbleShown() { | 79 void ManagePasswordsBubbleUIController::OnBubbleShown() { |
| 78 unset_manage_passwords_bubble_needs_showing(); | 80 unset_manage_passwords_bubble_needs_showing(); |
| 79 } | 81 } |
| 80 | 82 |
| 83 void ManagePasswordsBubbleUIController:: |
| 84 NavigateToPasswordManagerSettingsPage() { |
| 85 chrome::ShowSettingsSubPage( |
| 86 chrome::FindBrowserWithWebContents(web_contents()), |
| 87 chrome::kPasswordManagerSubPage); |
| 88 } |
| 89 |
| 81 void ManagePasswordsBubbleUIController::SavePassword() { | 90 void ManagePasswordsBubbleUIController::SavePassword() { |
| 82 DCHECK(form_manager_.get()); | 91 DCHECK(form_manager_.get()); |
| 83 form_manager_->Save(); | 92 form_manager_->Save(); |
| 84 } | 93 } |
| 85 | 94 |
| 86 void ManagePasswordsBubbleUIController::NeverSavePassword() { | 95 void ManagePasswordsBubbleUIController::NeverSavePassword() { |
| 87 DCHECK(form_manager_.get()); | 96 DCHECK(form_manager_.get()); |
| 88 form_manager_->PermanentlyBlacklist(); | 97 form_manager_->PermanentlyBlacklist(); |
| 89 } | 98 } |
| 90 | 99 |
| 91 void ManagePasswordsBubbleUIController::DidNavigateMainFrame( | 100 void ManagePasswordsBubbleUIController::DidNavigateMainFrame( |
| 92 const content::LoadCommittedDetails& details, | 101 const content::LoadCommittedDetails& details, |
| 93 const content::FrameNavigateParams& params) { | 102 const content::FrameNavigateParams& params) { |
| 94 if (details.is_in_page) | 103 if (details.is_in_page) |
| 95 return; | 104 return; |
| 96 // Reset password states for next page. | 105 // Reset password states for next page. |
| 97 manage_passwords_icon_to_be_shown_ = false; | 106 manage_passwords_icon_to_be_shown_ = false; |
| 98 password_to_be_saved_ = false; | 107 password_to_be_saved_ = false; |
| 99 manage_passwords_bubble_needs_showing_ = false; | 108 manage_passwords_bubble_needs_showing_ = false; |
| 100 password_submitted_ = false; | 109 password_submitted_ = false; |
| 101 UpdateBubbleAndIconVisibility(); | 110 UpdateBubbleAndIconVisibility(); |
| 102 } | 111 } |
| OLD | NEW |