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 "base/metrics/histogram_macros.h" | |
7 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
8 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 9 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
9 #include "chrome/browser/password_manager/chrome_password_manager_client.h" | 10 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
10 #include "chrome/browser/password_manager/password_store_factory.h" | 11 #include "chrome/browser/password_manager/password_store_factory.h" |
11 #include "chrome/browser/ui/browser_command_controller.h" | 12 #include "chrome/browser/ui/browser_command_controller.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" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 UpdateBubbleAndIconVisibility(); | 106 UpdateBubbleAndIconVisibility(); |
106 } | 107 } |
107 | 108 |
108 void ManagePasswordsUIController::OnPasswordSubmitted( | 109 void ManagePasswordsUIController::OnPasswordSubmitted( |
109 scoped_ptr<PasswordFormManager> form_manager) { | 110 scoped_ptr<PasswordFormManager> form_manager) { |
110 form_manager_ = form_manager.Pass(); | 111 form_manager_ = form_manager.Pass(); |
111 password_form_map_ = ConstifyMap(form_manager_->best_matches()); | 112 password_form_map_ = ConstifyMap(form_manager_->best_matches()); |
112 origin_ = PendingPassword().origin; | 113 origin_ = PendingPassword().origin; |
113 SetState(password_manager::ui::PENDING_PASSWORD_AND_BUBBLE_STATE); | 114 SetState(password_manager::ui::PENDING_PASSWORD_AND_BUBBLE_STATE); |
114 timer_.reset(new base::ElapsedTimer()); | 115 timer_.reset(new base::ElapsedTimer()); |
116 UMA_HISTOGRAM_BOOLEAN("PasswordManager.OfferSaveEmptyUsername", | |
vabr (Chromium)
2015/01/29 15:40:23
You might consider putting this in PasswordManager
vasilii
2015/01/30 12:35:41
Done.
| |
117 PendingPassword().username_value.empty()); | |
115 UpdateBubbleAndIconVisibility(); | 118 UpdateBubbleAndIconVisibility(); |
116 } | 119 } |
117 | 120 |
118 bool ManagePasswordsUIController::OnChooseCredentials( | 121 bool ManagePasswordsUIController::OnChooseCredentials( |
119 ScopedVector<autofill::PasswordForm> local_credentials, | 122 ScopedVector<autofill::PasswordForm> local_credentials, |
120 ScopedVector<autofill::PasswordForm> federated_credentials, | 123 ScopedVector<autofill::PasswordForm> federated_credentials, |
121 base::Callback<void(const password_manager::CredentialInfo&)> callback){ | 124 base::Callback<void(const password_manager::CredentialInfo&)> callback){ |
122 DCHECK(!local_credentials.empty() || !federated_credentials.empty()); | 125 DCHECK(!local_credentials.empty() || !federated_credentials.empty()); |
123 form_manager_.reset(); | 126 form_manager_.reset(); |
124 // TODO(melandory): fix the crash when |local_credentials| is empty. | 127 // TODO(melandory): fix the crash when |local_credentials| is empty. |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
356 bool ManagePasswordsUIController::PasswordPendingUserDecision() const { | 359 bool ManagePasswordsUIController::PasswordPendingUserDecision() const { |
357 return password_manager::ui::IsPendingState(state_); | 360 return password_manager::ui::IsPendingState(state_); |
358 } | 361 } |
359 | 362 |
360 void ManagePasswordsUIController::WebContentsDestroyed() { | 363 void ManagePasswordsUIController::WebContentsDestroyed() { |
361 password_manager::PasswordStore* password_store = | 364 password_manager::PasswordStore* password_store = |
362 GetPasswordStore(web_contents()); | 365 GetPasswordStore(web_contents()); |
363 if (password_store) | 366 if (password_store) |
364 password_store->RemoveObserver(this); | 367 password_store->RemoveObserver(this); |
365 } | 368 } |
OLD | NEW |