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

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

Issue 1550053002: Convert Pass()→std::move() in //chrome/browser/ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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>
8
7 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
8 #include "chrome/app/chrome_command_ids.h" 10 #include "chrome/app/chrome_command_ids.h"
9 #include "chrome/browser/browsing_data/browsing_data_helper.h" 11 #include "chrome/browser/browsing_data/browsing_data_helper.h"
10 #include "chrome/browser/password_manager/chrome_password_manager_client.h" 12 #include "chrome/browser/password_manager/chrome_password_manager_client.h"
11 #include "chrome/browser/password_manager/password_store_factory.h" 13 #include "chrome/browser/password_manager/password_store_factory.h"
12 #include "chrome/browser/ui/browser_command_controller.h" 14 #include "chrome/browser/ui/browser_command_controller.h"
13 #include "chrome/browser/ui/browser_finder.h" 15 #include "chrome/browser/ui/browser_finder.h"
14 #include "chrome/browser/ui/browser_navigator_params.h" 16 #include "chrome/browser/ui/browser_navigator_params.h"
15 #include "chrome/browser/ui/browser_window.h" 17 #include "chrome/browser/ui/browser_window.h"
16 #include "chrome/browser/ui/chrome_pages.h" 18 #include "chrome/browser/ui/chrome_pages.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 GetPasswordStore(web_contents); 61 GetPasswordStore(web_contents);
60 if (password_store) 62 if (password_store)
61 password_store->AddObserver(this); 63 password_store->AddObserver(this);
62 } 64 }
63 65
64 ManagePasswordsUIController::~ManagePasswordsUIController() {} 66 ManagePasswordsUIController::~ManagePasswordsUIController() {}
65 67
66 void ManagePasswordsUIController::OnPasswordSubmitted( 68 void ManagePasswordsUIController::OnPasswordSubmitted(
67 scoped_ptr<PasswordFormManager> form_manager) { 69 scoped_ptr<PasswordFormManager> form_manager) {
68 bool show_bubble = !form_manager->IsBlacklisted(); 70 bool show_bubble = !form_manager->IsBlacklisted();
69 passwords_data_.OnPendingPassword(form_manager.Pass()); 71 passwords_data_.OnPendingPassword(std::move(form_manager));
70 if (show_bubble) { 72 if (show_bubble) {
71 password_manager::InteractionsStats* stats = GetCurrentInteractionStats(); 73 password_manager::InteractionsStats* stats = GetCurrentInteractionStats();
72 const int show_threshold = 74 const int show_threshold =
73 password_bubble_experiment::GetSmartBubbleDismissalThreshold(); 75 password_bubble_experiment::GetSmartBubbleDismissalThreshold();
74 if (stats && show_threshold > 0 && stats->dismissal_count >= show_threshold) 76 if (stats && show_threshold > 0 && stats->dismissal_count >= show_threshold)
75 show_bubble = false; 77 show_bubble = false;
76 } 78 }
77 base::AutoReset<bool> resetter(&should_pop_up_bubble_, show_bubble); 79 base::AutoReset<bool> resetter(&should_pop_up_bubble_, show_bubble);
78 UpdateBubbleAndIconVisibility(); 80 UpdateBubbleAndIconVisibility();
79 } 81 }
80 82
81 void ManagePasswordsUIController::OnUpdatePasswordSubmitted( 83 void ManagePasswordsUIController::OnUpdatePasswordSubmitted(
82 scoped_ptr<PasswordFormManager> form_manager) { 84 scoped_ptr<PasswordFormManager> form_manager) {
83 passwords_data_.OnUpdatePassword(form_manager.Pass()); 85 passwords_data_.OnUpdatePassword(std::move(form_manager));
84 base::AutoReset<bool> resetter(&should_pop_up_bubble_, true); 86 base::AutoReset<bool> resetter(&should_pop_up_bubble_, true);
85 UpdateBubbleAndIconVisibility(); 87 UpdateBubbleAndIconVisibility();
86 } 88 }
87 89
88 bool ManagePasswordsUIController::OnChooseCredentials( 90 bool ManagePasswordsUIController::OnChooseCredentials(
89 ScopedVector<autofill::PasswordForm> local_credentials, 91 ScopedVector<autofill::PasswordForm> local_credentials,
90 ScopedVector<autofill::PasswordForm> federated_credentials, 92 ScopedVector<autofill::PasswordForm> federated_credentials,
91 const GURL& origin, 93 const GURL& origin,
92 base::Callback<void(const password_manager::CredentialInfo&)> callback) { 94 base::Callback<void(const password_manager::CredentialInfo&)> callback) {
93 DCHECK(!local_credentials.empty() || !federated_credentials.empty()); 95 DCHECK(!local_credentials.empty() || !federated_credentials.empty());
94 passwords_data_.OnRequestCredentials(local_credentials.Pass(), 96 passwords_data_.OnRequestCredentials(
95 federated_credentials.Pass(), 97 std::move(local_credentials), std::move(federated_credentials), origin);
96 origin);
97 base::AutoReset<bool> resetter(&should_pop_up_bubble_, true); 98 base::AutoReset<bool> resetter(&should_pop_up_bubble_, true);
98 UpdateBubbleAndIconVisibility(); 99 UpdateBubbleAndIconVisibility();
99 if (!should_pop_up_bubble_) { 100 if (!should_pop_up_bubble_) {
100 passwords_data_.set_credentials_callback(callback); 101 passwords_data_.set_credentials_callback(callback);
101 return true; 102 return true;
102 } 103 }
103 passwords_data_.TransitionToState(password_manager::ui::MANAGE_STATE); 104 passwords_data_.TransitionToState(password_manager::ui::MANAGE_STATE);
104 return false; 105 return false;
105 } 106 }
106 107
107 void ManagePasswordsUIController::OnAutoSignin( 108 void ManagePasswordsUIController::OnAutoSignin(
108 ScopedVector<autofill::PasswordForm> local_forms) { 109 ScopedVector<autofill::PasswordForm> local_forms) {
109 DCHECK(!local_forms.empty()); 110 DCHECK(!local_forms.empty());
110 passwords_data_.OnAutoSignin(local_forms.Pass()); 111 passwords_data_.OnAutoSignin(std::move(local_forms));
111 base::AutoReset<bool> resetter(&should_pop_up_bubble_, true); 112 base::AutoReset<bool> resetter(&should_pop_up_bubble_, true);
112 UpdateBubbleAndIconVisibility(); 113 UpdateBubbleAndIconVisibility();
113 } 114 }
114 115
115 void ManagePasswordsUIController::OnAutomaticPasswordSave( 116 void ManagePasswordsUIController::OnAutomaticPasswordSave(
116 scoped_ptr<PasswordFormManager> form_manager) { 117 scoped_ptr<PasswordFormManager> form_manager) {
117 passwords_data_.OnAutomaticPasswordSave(form_manager.Pass()); 118 passwords_data_.OnAutomaticPasswordSave(std::move(form_manager));
118 base::AutoReset<bool> resetter(&should_pop_up_bubble_, true); 119 base::AutoReset<bool> resetter(&should_pop_up_bubble_, true);
119 UpdateBubbleAndIconVisibility(); 120 UpdateBubbleAndIconVisibility();
120 } 121 }
121 122
122 void ManagePasswordsUIController::OnPasswordAutofilled( 123 void ManagePasswordsUIController::OnPasswordAutofilled(
123 const PasswordFormMap& password_form_map, 124 const PasswordFormMap& password_form_map,
124 const GURL& origin) { 125 const GURL& origin) {
125 // If we fill a form while a dialog is open, then skip the state change; we 126 // If we fill a form while a dialog is open, then skip the state change; we
126 // have 127 // have
127 // the information we need, and the dialog will change its own state once the 128 // the information we need, and the dialog will change its own state once the
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 updater->ExecuteCommand(IDC_MANAGE_PASSWORDS_FOR_PAGE); 379 updater->ExecuteCommand(IDC_MANAGE_PASSWORDS_FOR_PAGE);
379 #endif 380 #endif
380 } 381 }
381 382
382 void ManagePasswordsUIController::WebContentsDestroyed() { 383 void ManagePasswordsUIController::WebContentsDestroyed() {
383 password_manager::PasswordStore* password_store = 384 password_manager::PasswordStore* password_store =
384 GetPasswordStore(web_contents()); 385 GetPasswordStore(web_contents());
385 if (password_store) 386 if (password_store)
386 password_store->RemoveObserver(this); 387 password_store->RemoveObserver(this);
387 } 388 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698