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

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

Issue 2659983002: Convert ManagePasswordsUIController to use the new navigation callbacks. (Closed)
Patch Set: fix tests Created 3 years, 10 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 <utility> 7 #include <utility>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "chrome/app/chrome_command_ids.h" 10 #include "chrome/app/chrome_command_ids.h"
(...skipping 10 matching lines...) Expand all
21 #include "chrome/browser/ui/passwords/password_dialog_controller_impl.h" 21 #include "chrome/browser/ui/passwords/password_dialog_controller_impl.h"
22 #include "chrome/browser/ui/passwords/password_dialog_prompts.h" 22 #include "chrome/browser/ui/passwords/password_dialog_prompts.h"
23 #include "chrome/browser/ui/tab_dialogs.h" 23 #include "chrome/browser/ui/tab_dialogs.h"
24 #include "chrome/common/url_constants.h" 24 #include "chrome/common/url_constants.h"
25 #include "components/password_manager/core/browser/browser_save_password_progres s_logger.h" 25 #include "components/password_manager/core/browser/browser_save_password_progres s_logger.h"
26 #include "components/password_manager/core/browser/password_bubble_experiment.h" 26 #include "components/password_manager/core/browser/password_bubble_experiment.h"
27 #include "components/password_manager/core/browser/password_form_manager.h" 27 #include "components/password_manager/core/browser/password_form_manager.h"
28 #include "components/password_manager/core/browser/password_manager_constants.h" 28 #include "components/password_manager/core/browser/password_manager_constants.h"
29 #include "components/password_manager/core/browser/statistics_table.h" 29 #include "components/password_manager/core/browser/statistics_table.h"
30 #include "components/password_manager/core/common/credential_manager_types.h" 30 #include "components/password_manager/core/common/credential_manager_types.h"
31 #include "content/public/browser/navigation_details.h" 31 #include "content/public/browser/navigation_handle.h"
32 32
33 using password_manager::PasswordFormManager; 33 using password_manager::PasswordFormManager;
34 34
35 namespace { 35 namespace {
36 36
37 password_manager::PasswordStore* GetPasswordStore( 37 password_manager::PasswordStore* GetPasswordStore(
38 content::WebContents* web_contents) { 38 content::WebContents* web_contents) {
39 return PasswordStoreFactory::GetForProfile( 39 return PasswordStoreFactory::GetForProfile(
40 Profile::FromBrowserContext(web_contents->GetBrowserContext()), 40 Profile::FromBrowserContext(web_contents->GetBrowserContext()),
41 ServiceAccessType::EXPLICIT_ACCESS).get(); 41 ServiceAccessType::EXPLICIT_ACCESS).get();
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 402
403 AutoSigninFirstRunPrompt* ManagePasswordsUIController::CreateAutoSigninPrompt( 403 AutoSigninFirstRunPrompt* ManagePasswordsUIController::CreateAutoSigninPrompt(
404 PasswordDialogController* controller) { 404 PasswordDialogController* controller) {
405 return CreateAutoSigninPromptView(controller, web_contents()); 405 return CreateAutoSigninPromptView(controller, web_contents());
406 } 406 }
407 407
408 bool ManagePasswordsUIController::HasBrowserWindow() const { 408 bool ManagePasswordsUIController::HasBrowserWindow() const {
409 return chrome::FindBrowserWithWebContents(web_contents()) != nullptr; 409 return chrome::FindBrowserWithWebContents(web_contents()) != nullptr;
410 } 410 }
411 411
412 void ManagePasswordsUIController::DidNavigateMainFrame( 412 void ManagePasswordsUIController::DidFinishNavigation(
413 const content::LoadCommittedDetails& details, 413 content::NavigationHandle* navigation_handle) {
414 const content::FrameNavigateParams& params) { 414 if (!navigation_handle->IsInMainFrame() ||
415 // Don't react to in-page (fragment) navigations. 415 !navigation_handle->HasCommitted() ||
416 if (details.is_in_page) 416 // Don't react to in-page (fragment) navigations.
417 navigation_handle->IsSamePage()) {
417 return; 418 return;
419 }
418 420
419 // It is possible that the user was not able to interact with the password 421 // It is possible that the user was not able to interact with the password
420 // bubble. 422 // bubble.
421 if (bubble_status_ == SHOWN || bubble_status_ == SHOWN_PENDING_ICON_UPDATE) 423 if (bubble_status_ == SHOWN || bubble_status_ == SHOWN_PENDING_ICON_UPDATE)
422 return; 424 return;
423 425
424 // Otherwise, reset the password manager. 426 // Otherwise, reset the password manager.
425 DestroyAccountChooser(); 427 DestroyAccountChooser();
426 passwords_data_.OnInactive(); 428 passwords_data_.OnInactive();
427 UpdateBubbleAndIconVisibility(); 429 UpdateBubbleAndIconVisibility();
(...skipping 19 matching lines...) Expand all
447 passwords_data_.TransitionToState(password_manager::ui::MANAGE_STATE); 449 passwords_data_.TransitionToState(password_manager::ui::MANAGE_STATE);
448 } 450 }
449 } 451 }
450 452
451 void ManagePasswordsUIController::WebContentsDestroyed() { 453 void ManagePasswordsUIController::WebContentsDestroyed() {
452 password_manager::PasswordStore* password_store = 454 password_manager::PasswordStore* password_store =
453 GetPasswordStore(web_contents()); 455 GetPasswordStore(web_contents());
454 if (password_store) 456 if (password_store)
455 password_store->RemoveObserver(this); 457 password_store->RemoveObserver(this);
456 } 458 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698