OLD | NEW |
---|---|
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/browsing_data/browsing_data_helper.h" | 8 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
10 #include "chrome/browser/password_manager/password_store_factory.h" | 10 #include "chrome/browser/password_manager/password_store_factory.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
164 GetPasswordStore(web_contents()); | 164 GetPasswordStore(web_contents()); |
165 if (password_store) | 165 if (password_store) |
166 password_store->RemoveLogin(*password_form_map_.begin()->second); | 166 password_store->RemoveLogin(*password_form_map_.begin()->second); |
167 state_ = password_manager::ui::MANAGE_STATE; | 167 state_ = password_manager::ui::MANAGE_STATE; |
168 UpdateBubbleAndIconVisibility(); | 168 UpdateBubbleAndIconVisibility(); |
169 } | 169 } |
170 | 170 |
171 void ManagePasswordsUIController::DidNavigateMainFrame( | 171 void ManagePasswordsUIController::DidNavigateMainFrame( |
172 const content::LoadCommittedDetails& details, | 172 const content::LoadCommittedDetails& details, |
173 const content::FrameNavigateParams& params) { | 173 const content::FrameNavigateParams& params) { |
174 // Don't do anything if a navigation occurs before a user could reasonably | |
175 // interact with the password bubble. | |
176 if (timer_ && timer_->Elapsed() < base::TimeDelta::FromSeconds(1)) | |
vabr (Chromium)
2014/06/16 15:02:00
optional nit: You could make the 1 a named global
| |
177 return; | |
178 | |
179 // Don't react to in-page (fragment) navigations. | |
174 if (details.is_in_page) | 180 if (details.is_in_page) |
vabr (Chromium)
2014/06/16 15:02:00
optional nit: As the cheapest check, this should p
| |
175 return; | 181 return; |
182 | |
183 // Otherwise, reset the password manager and the timer. | |
176 state_ = password_manager::ui::INACTIVE_STATE; | 184 state_ = password_manager::ui::INACTIVE_STATE; |
177 UpdateBubbleAndIconVisibility(); | 185 UpdateBubbleAndIconVisibility(); |
186 timer_.reset(new base::ElapsedTimer()); | |
178 } | 187 } |
179 | 188 |
180 const autofill::PasswordForm& ManagePasswordsUIController:: | 189 const autofill::PasswordForm& ManagePasswordsUIController:: |
181 PendingCredentials() const { | 190 PendingCredentials() const { |
182 DCHECK(form_manager_); | 191 DCHECK(form_manager_); |
183 return form_manager_->pending_credentials(); | 192 return form_manager_->pending_credentials(); |
184 } | 193 } |
185 | 194 |
186 void ManagePasswordsUIController::UpdateIconAndBubbleState( | 195 void ManagePasswordsUIController::UpdateIconAndBubbleState( |
187 ManagePasswordsIcon* icon) { | 196 ManagePasswordsIcon* icon) { |
(...skipping 20 matching lines...) Expand all Loading... | |
208 return; | 217 return; |
209 CommandUpdater* updater = browser->command_controller()->command_updater(); | 218 CommandUpdater* updater = browser->command_controller()->command_updater(); |
210 updater->ExecuteCommand(IDC_MANAGE_PASSWORDS_FOR_PAGE); | 219 updater->ExecuteCommand(IDC_MANAGE_PASSWORDS_FOR_PAGE); |
211 #endif | 220 #endif |
212 } | 221 } |
213 | 222 |
214 bool ManagePasswordsUIController::PasswordPendingUserDecision() const { | 223 bool ManagePasswordsUIController::PasswordPendingUserDecision() const { |
215 return state_ == password_manager::ui::PENDING_PASSWORD_STATE || | 224 return state_ == password_manager::ui::PENDING_PASSWORD_STATE || |
216 state_ == password_manager::ui::PENDING_PASSWORD_AND_BUBBLE_STATE; | 225 state_ == password_manager::ui::PENDING_PASSWORD_AND_BUBBLE_STATE; |
217 } | 226 } |
OLD | NEW |