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

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

Issue 565673002: Close the password bubble when navigating between tabs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Android Created 6 years, 3 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
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/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"
11 #include "chrome/browser/ui/browser_command_controller.h" 11 #include "chrome/browser/ui/browser_command_controller.h"
12 #include "chrome/browser/ui/browser_dialogs.h"
12 #include "chrome/browser/ui/browser_finder.h" 13 #include "chrome/browser/ui/browser_finder.h"
13 #include "chrome/browser/ui/browser_window.h" 14 #include "chrome/browser/ui/browser_window.h"
14 #include "chrome/browser/ui/chrome_pages.h" 15 #include "chrome/browser/ui/chrome_pages.h"
15 #include "chrome/browser/ui/location_bar/location_bar.h" 16 #include "chrome/browser/ui/location_bar/location_bar.h"
16 #include "chrome/browser/ui/passwords/manage_passwords_icon.h" 17 #include "chrome/browser/ui/passwords/manage_passwords_icon.h"
17 #include "chrome/common/url_constants.h" 18 #include "chrome/common/url_constants.h"
18 #include "components/password_manager/core/browser/password_store.h" 19 #include "components/password_manager/core/browser/password_store.h"
19 #include "content/public/browser/notification_service.h" 20 #include "content/public/browser/notification_service.h"
20 21
21 using autofill::PasswordFormMap; 22 using autofill::PasswordFormMap;
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 // interact with the password bubble. 233 // interact with the password bubble.
233 if (timer_ && timer_->Elapsed() < base::TimeDelta::FromSeconds(1)) 234 if (timer_ && timer_->Elapsed() < base::TimeDelta::FromSeconds(1))
234 return; 235 return;
235 236
236 // Otherwise, reset the password manager and the timer. 237 // Otherwise, reset the password manager and the timer.
237 state_ = password_manager::ui::INACTIVE_STATE; 238 state_ = password_manager::ui::INACTIVE_STATE;
238 UpdateBubbleAndIconVisibility(); 239 UpdateBubbleAndIconVisibility();
239 timer_.reset(new base::ElapsedTimer()); 240 timer_.reset(new base::ElapsedTimer());
240 } 241 }
241 242
243 void ManagePasswordsUIController::WasHidden() {
244 #if !defined(OS_ANDROID)
245 chrome::CloseManagePasswordsBubble(web_contents());
246 #endif
247 }
248
242 const autofill::PasswordForm& ManagePasswordsUIController:: 249 const autofill::PasswordForm& ManagePasswordsUIController::
243 PendingCredentials() const { 250 PendingCredentials() const {
244 DCHECK(form_manager_); 251 DCHECK(form_manager_);
245 return form_manager_->pending_credentials(); 252 return form_manager_->pending_credentials();
246 } 253 }
247 254
248 void ManagePasswordsUIController::UpdateIconAndBubbleState( 255 void ManagePasswordsUIController::UpdateIconAndBubbleState(
249 ManagePasswordsIcon* icon) { 256 ManagePasswordsIcon* icon) {
250 if (password_manager::ui::IsAutomaticDisplayState(state_)) { 257 if (password_manager::ui::IsAutomaticDisplayState(state_)) {
251 // We must display the icon before showing the bubble, as the bubble would 258 // We must display the icon before showing the bubble, as the bubble would
(...skipping 19 matching lines...) Expand all
271 return; 278 return;
272 CommandUpdater* updater = browser->command_controller()->command_updater(); 279 CommandUpdater* updater = browser->command_controller()->command_updater();
273 updater->ExecuteCommand(IDC_MANAGE_PASSWORDS_FOR_PAGE); 280 updater->ExecuteCommand(IDC_MANAGE_PASSWORDS_FOR_PAGE);
274 #endif 281 #endif
275 } 282 }
276 283
277 bool ManagePasswordsUIController::PasswordPendingUserDecision() const { 284 bool ManagePasswordsUIController::PasswordPendingUserDecision() const {
278 return state_ == password_manager::ui::PENDING_PASSWORD_STATE || 285 return state_ == password_manager::ui::PENDING_PASSWORD_STATE ||
279 state_ == password_manager::ui::PENDING_PASSWORD_AND_BUBBLE_STATE; 286 state_ == password_manager::ui::PENDING_PASSWORD_AND_BUBBLE_STATE;
280 } 287 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698