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

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

Issue 2900693002: [Password Manager] Convert |pending_login_managers_| to an array of scoped_refptr (Closed)
Patch Set: Rebase Created 3 years, 6 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 ChromePasswordManagerClient::FromWebContents(web_contents)); 62 ChromePasswordManagerClient::FromWebContents(web_contents));
63 password_manager::PasswordStore* password_store = 63 password_manager::PasswordStore* password_store =
64 GetPasswordStore(web_contents); 64 GetPasswordStore(web_contents);
65 if (password_store) 65 if (password_store)
66 password_store->AddObserver(this); 66 password_store->AddObserver(this);
67 } 67 }
68 68
69 ManagePasswordsUIController::~ManagePasswordsUIController() {} 69 ManagePasswordsUIController::~ManagePasswordsUIController() {}
70 70
71 void ManagePasswordsUIController::OnPasswordSubmitted( 71 void ManagePasswordsUIController::OnPasswordSubmitted(
72 std::unique_ptr<PasswordFormManager> form_manager) { 72 scoped_refptr<PasswordFormManager> form_manager) {
73 bool show_bubble = !form_manager->IsBlacklisted(); 73 bool show_bubble = !form_manager->IsBlacklisted();
74 DestroyAccountChooser(); 74 DestroyAccountChooser();
75 passwords_data_.OnPendingPassword(std::move(form_manager)); 75 passwords_data_.OnPendingPassword(std::move(form_manager));
76 if (show_bubble) { 76 if (show_bubble) {
77 const password_manager::InteractionsStats* stats = 77 const password_manager::InteractionsStats* stats =
78 GetCurrentInteractionStats(); 78 GetCurrentInteractionStats();
79 const int show_threshold = 79 const int show_threshold =
80 password_bubble_experiment::GetSmartBubbleDismissalThreshold(); 80 password_bubble_experiment::GetSmartBubbleDismissalThreshold();
81 if (stats && show_threshold > 0 && stats->dismissal_count >= show_threshold) 81 if (stats && show_threshold > 0 && stats->dismissal_count >= show_threshold)
82 show_bubble = false; 82 show_bubble = false;
83 } 83 }
84 if (show_bubble) 84 if (show_bubble)
85 bubble_status_ = SHOULD_POP_UP; 85 bubble_status_ = SHOULD_POP_UP;
86 UpdateBubbleAndIconVisibility(); 86 UpdateBubbleAndIconVisibility();
87 } 87 }
88 88
89 void ManagePasswordsUIController::OnUpdatePasswordSubmitted( 89 void ManagePasswordsUIController::OnUpdatePasswordSubmitted(
90 std::unique_ptr<PasswordFormManager> form_manager) { 90 scoped_refptr<PasswordFormManager> form_manager) {
91 DestroyAccountChooser(); 91 DestroyAccountChooser();
92 passwords_data_.OnUpdatePassword(std::move(form_manager)); 92 passwords_data_.OnUpdatePassword(std::move(form_manager));
93 bubble_status_ = SHOULD_POP_UP; 93 bubble_status_ = SHOULD_POP_UP;
94 UpdateBubbleAndIconVisibility(); 94 UpdateBubbleAndIconVisibility();
95 } 95 }
96 96
97 bool ManagePasswordsUIController::OnChooseCredentials( 97 bool ManagePasswordsUIController::OnChooseCredentials(
98 std::vector<std::unique_ptr<autofill::PasswordForm>> local_credentials, 98 std::vector<std::unique_ptr<autofill::PasswordForm>> local_credentials,
99 const GURL& origin, 99 const GURL& origin,
100 const ManagePasswordsState::CredentialsCallback& callback) { 100 const ManagePasswordsState::CredentialsCallback& callback) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 if (dialog_controller_) 135 if (dialog_controller_)
136 return; 136 return;
137 dialog_controller_.reset(new PasswordDialogControllerImpl( 137 dialog_controller_.reset(new PasswordDialogControllerImpl(
138 Profile::FromBrowserContext(web_contents()->GetBrowserContext()), 138 Profile::FromBrowserContext(web_contents()->GetBrowserContext()),
139 this)); 139 this));
140 dialog_controller_->ShowAutosigninPrompt( 140 dialog_controller_->ShowAutosigninPrompt(
141 CreateAutoSigninPrompt(dialog_controller_.get())); 141 CreateAutoSigninPrompt(dialog_controller_.get()));
142 } 142 }
143 143
144 void ManagePasswordsUIController::OnAutomaticPasswordSave( 144 void ManagePasswordsUIController::OnAutomaticPasswordSave(
145 std::unique_ptr<PasswordFormManager> form_manager) { 145 scoped_refptr<PasswordFormManager> form_manager) {
146 DestroyAccountChooser(); 146 DestroyAccountChooser();
147 passwords_data_.OnAutomaticPasswordSave(std::move(form_manager)); 147 passwords_data_.OnAutomaticPasswordSave(std::move(form_manager));
148 bubble_status_ = SHOULD_POP_UP; 148 bubble_status_ = SHOULD_POP_UP;
149 UpdateBubbleAndIconVisibility(); 149 UpdateBubbleAndIconVisibility();
150 } 150 }
151 151
152 void ManagePasswordsUIController::OnPasswordAutofilled( 152 void ManagePasswordsUIController::OnPasswordAutofilled(
153 const std::map<base::string16, const autofill::PasswordForm*>& 153 const std::map<base::string16, const autofill::PasswordForm*>&
154 password_form_map, 154 password_form_map,
155 const GURL& origin, 155 const GURL& origin,
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 passwords_data_.TransitionToState(password_manager::ui::MANAGE_STATE); 457 passwords_data_.TransitionToState(password_manager::ui::MANAGE_STATE);
458 } 458 }
459 } 459 }
460 460
461 void ManagePasswordsUIController::WebContentsDestroyed() { 461 void ManagePasswordsUIController::WebContentsDestroyed() {
462 password_manager::PasswordStore* password_store = 462 password_manager::PasswordStore* password_store =
463 GetPasswordStore(web_contents()); 463 GetPasswordStore(web_contents());
464 if (password_store) 464 if (password_store)
465 password_store->RemoveObserver(this); 465 password_store->RemoveObserver(this);
466 } 466 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698