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/password_manager/chrome_password_manager_client.h" | 5 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
6 | 6 |
7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
11 #include "chrome/browser/password_manager/password_manager_util.h" | 11 #include "chrome/browser/password_manager/password_manager_util.h" |
12 #include "chrome/browser/password_manager/password_store_factory.h" | 12 #include "chrome/browser/password_manager/password_store_factory.h" |
13 #include "chrome/browser/password_manager/save_password_infobar_delegate.h" | 13 #include "chrome/browser/password_manager/save_password_infobar_delegate.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/sync/profile_sync_service.h" | 15 #include "chrome/browser/sync/profile_sync_service.h" |
16 #include "chrome/browser/sync/profile_sync_service_factory.h" | 16 #include "chrome/browser/sync/profile_sync_service_factory.h" |
17 #include "chrome/browser/ui/autofill/password_generation_popup_controller_impl.h
" | 17 #include "chrome/browser/ui/autofill/password_generation_popup_controller_impl.h
" |
18 #include "chrome/browser/ui/passwords/manage_passwords_bubble_ui_controller.h" | 18 #include "chrome/browser/ui/passwords/manage_passwords_bubble_ui_controller.h" |
19 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
20 #include "chrome/common/chrome_version_info.h" | 20 #include "chrome/common/chrome_version_info.h" |
21 #include "components/autofill/content/common/autofill_messages.h" | 21 #include "components/autofill/content/common/autofill_messages.h" |
22 #include "components/autofill/core/browser/password_generator.h" | 22 #include "components/autofill/core/browser/password_generator.h" |
23 #include "components/autofill/core/common/password_form.h" | 23 #include "components/autofill/core/common/password_form.h" |
24 #include "components/password_manager/core/browser/password_form_manager.h" | 24 #include "components/password_manager/core/browser/password_form_manager.h" |
25 #include "components/password_manager/core/browser/password_manager.h" | 25 #include "components/password_manager/core/browser/password_manager.h" |
26 #include "components/password_manager/core/browser/password_manager_logger.h" | 26 #include "components/password_manager/core/browser/password_manager_logger.h" |
27 #include "components/password_manager/core/browser/password_manager_metrics_util
.h" | 27 #include "components/password_manager/core/browser/password_manager_metrics_util
.h" |
| 28 #include "content/public/browser/render_view_host.h" |
28 #include "content/public/browser/web_contents.h" | 29 #include "content/public/browser/web_contents.h" |
29 #include "content/public/browser/web_contents_view.h" | 30 #include "content/public/browser/web_contents_view.h" |
30 #include "ipc/ipc_message_macros.h" | 31 #include "ipc/ipc_message_macros.h" |
31 | 32 |
32 #if defined(OS_ANDROID) | 33 #if defined(OS_ANDROID) |
33 #include "chrome/browser/android/password_authentication_manager.h" | 34 #include "chrome/browser/android/password_authentication_manager.h" |
34 #endif // OS_ANDROID | 35 #endif // OS_ANDROID |
35 | 36 |
36 namespace { | 37 namespace { |
37 | 38 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 188 |
188 void ChromePasswordManagerClient::SetLogger( | 189 void ChromePasswordManagerClient::SetLogger( |
189 password_manager::PasswordManagerLogger* logger) { | 190 password_manager::PasswordManagerLogger* logger) { |
190 // We should never be replacing one logger with a different one, because that | 191 // We should never be replacing one logger with a different one, because that |
191 // will leave the first without further updates, and the user likely confused. | 192 // will leave the first without further updates, and the user likely confused. |
192 // TODO(vabr): For the reason above, before moving the internals page from | 193 // TODO(vabr): For the reason above, before moving the internals page from |
193 // behind the flag, make sure to restrict the number of internals page | 194 // behind the flag, make sure to restrict the number of internals page |
194 // instances to 1 in normal profiles, and 0 in incognito. | 195 // instances to 1 in normal profiles, and 0 in incognito. |
195 DCHECK(!logger || !logger_); | 196 DCHECK(!logger || !logger_); |
196 logger_ = logger; | 197 logger_ = logger; |
| 198 |
| 199 // Also inform the renderer process to start or stop logging. |
| 200 web_contents()->GetRenderViewHost()->Send(new AutofillMsg_ChangeLoggingState( |
| 201 web_contents()->GetRenderViewHost()->GetRoutingID(), logger != NULL)); |
197 } | 202 } |
198 | 203 |
199 void ChromePasswordManagerClient::LogSavePasswordProgress( | 204 void ChromePasswordManagerClient::LogSavePasswordProgress( |
200 const std::string& text) { | 205 const std::string& text) { |
201 if (IsLoggingActive()) | 206 if (IsLoggingActive()) |
202 logger_->LogSavePasswordProgress(text); | 207 logger_->LogSavePasswordProgress(text); |
203 } | 208 } |
204 | 209 |
205 bool ChromePasswordManagerClient::IsLoggingActive() const { | 210 bool ChromePasswordManagerClient::IsLoggingActive() const { |
206 return logger_ != NULL; | 211 return logger_ != NULL; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 web_contents(), | 302 web_contents(), |
298 web_contents()->GetView()->GetNativeView()); | 303 web_contents()->GetView()->GetNativeView()); |
299 popup_controller_->Show(false /* display_password */); | 304 popup_controller_->Show(false /* display_password */); |
300 #endif // #if defined(USE_AURA) | 305 #endif // #if defined(USE_AURA) |
301 } | 306 } |
302 | 307 |
303 void ChromePasswordManagerClient::CommitFillPasswordForm( | 308 void ChromePasswordManagerClient::CommitFillPasswordForm( |
304 autofill::PasswordFormFillData* data) { | 309 autofill::PasswordFormFillData* data) { |
305 driver_.FillPasswordForm(*data); | 310 driver_.FillPasswordForm(*data); |
306 } | 311 } |
OLD | NEW |