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

Side by Side Diff: chrome/browser/ui/passwords/manage_passwords_ui_controller.cc

Issue 276683003: Password bubble: Deal correctly with blacklist state changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 6 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/ui/passwords/manage_passwords_ui_controller_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_ui_controller.h" 5 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h"
6 6
7 #include "chrome/app/chrome_command_ids.h" 7 #include "chrome/app/chrome_command_ids.h"
8 #include "chrome/browser/chrome_notification_types.h" 8 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/password_manager/password_store_factory.h" 9 #include "chrome/browser/password_manager/password_store_factory.h"
10 #include "chrome/browser/ui/browser_command_controller.h" 10 #include "chrome/browser/ui/browser_command_controller.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 void ManagePasswordsUIController::WebContentsDestroyed( 84 void ManagePasswordsUIController::WebContentsDestroyed(
85 content::WebContents* web_contents) { 85 content::WebContents* web_contents) {
86 password_manager::PasswordStore* password_store = 86 password_manager::PasswordStore* password_store =
87 GetPasswordStore(web_contents); 87 GetPasswordStore(web_contents);
88 if (password_store) 88 if (password_store)
89 password_store->RemoveObserver(this); 89 password_store->RemoveObserver(this);
90 } 90 }
91 91
92 void ManagePasswordsUIController::OnLoginsChanged( 92 void ManagePasswordsUIController::OnLoginsChanged(
93 const password_manager::PasswordStoreChangeList& changes) { 93 const password_manager::PasswordStoreChangeList& changes) {
94 password_manager::ui::State current_state = state_;
94 for (password_manager::PasswordStoreChangeList::const_iterator it = 95 for (password_manager::PasswordStoreChangeList::const_iterator it =
95 changes.begin(); 96 changes.begin();
96 it != changes.end(); 97 it != changes.end();
97 it++) { 98 it++) {
98 const autofill::PasswordForm& changed_form = it->form(); 99 const autofill::PasswordForm& changed_form = it->form();
99 if (changed_form.origin != origin_) 100 if (changed_form.origin != origin_)
100 continue; 101 continue;
101 102
102 if (it->type() == password_manager::PasswordStoreChange::REMOVE) { 103 if (it->type() == password_manager::PasswordStoreChange::REMOVE) {
103 password_form_map_.erase(changed_form.username_value); 104 password_form_map_.erase(changed_form.username_value);
105 if (changed_form.blacklisted_by_user) {
106 DCHECK(state_ == password_manager::ui::BLACKLIST_STATE);
107 state_ = password_manager::ui::MANAGE_STATE;
108 }
104 } else { 109 } else {
105 autofill::PasswordForm* new_form = 110 autofill::PasswordForm* new_form =
106 new autofill::PasswordForm(changed_form); 111 new autofill::PasswordForm(changed_form);
107 password_form_map_[changed_form.username_value] = new_form; 112 password_form_map_[changed_form.username_value] = new_form;
113 if (changed_form.blacklisted_by_user)
114 state_ = password_manager::ui::BLACKLIST_STATE;
108 } 115 }
109 } 116 }
117 if (current_state != state_)
118 UpdateBubbleAndIconVisibility();
110 } 119 }
111 120
112 void ManagePasswordsUIController:: 121 void ManagePasswordsUIController::
113 NavigateToPasswordManagerSettingsPage() { 122 NavigateToPasswordManagerSettingsPage() {
114 // TODO(mkwst): chrome_pages.h is compiled out of Android. Need to figure out 123 // TODO(mkwst): chrome_pages.h is compiled out of Android. Need to figure out
115 // how this navigation should work there. 124 // how this navigation should work there.
116 #if !defined(OS_ANDROID) 125 #if !defined(OS_ANDROID)
117 chrome::ShowSettingsSubPage( 126 chrome::ShowSettingsSubPage(
118 chrome::FindBrowserWithWebContents(web_contents()), 127 chrome::FindBrowserWithWebContents(web_contents()),
119 chrome::kPasswordManagerSubPage); 128 chrome::kPasswordManagerSubPage);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 return; 202 return;
194 CommandUpdater* updater = browser->command_controller()->command_updater(); 203 CommandUpdater* updater = browser->command_controller()->command_updater();
195 updater->ExecuteCommand(IDC_MANAGE_PASSWORDS_FOR_PAGE); 204 updater->ExecuteCommand(IDC_MANAGE_PASSWORDS_FOR_PAGE);
196 #endif 205 #endif
197 } 206 }
198 207
199 bool ManagePasswordsUIController::PasswordPendingUserDecision() const { 208 bool ManagePasswordsUIController::PasswordPendingUserDecision() const {
200 return state_ == password_manager::ui::PENDING_PASSWORD_STATE || 209 return state_ == password_manager::ui::PENDING_PASSWORD_STATE ||
201 state_ == password_manager::ui::PENDING_PASSWORD_AND_BUBBLE_STATE; 210 state_ == password_manager::ui::PENDING_PASSWORD_AND_BUBBLE_STATE;
202 } 211 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/passwords/manage_passwords_ui_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698