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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
174 | 175 |
175 void ChromePasswordManagerClient::SetLogger( | 176 void ChromePasswordManagerClient::SetLogger( |
176 password_manager::PasswordManagerLogger* logger) { | 177 password_manager::PasswordManagerLogger* logger) { |
177 // We should never be replacing one logger with a different one, because that | 178 // We should never be replacing one logger with a different one, because that |
178 // will leave the first without further updates, and the user likely confused. | 179 // will leave the first without further updates, and the user likely confused. |
179 // TODO(vabr): For the reason above, before moving the internals page from | 180 // TODO(vabr): For the reason above, before moving the internals page from |
180 // behind the flag, make sure to restrict the number of internals page | 181 // behind the flag, make sure to restrict the number of internals page |
181 // instances to 1 in normal profiles, and 0 in incognito. | 182 // instances to 1 in normal profiles, and 0 in incognito. |
182 DCHECK(!logger || !logger_); | 183 DCHECK(!logger || !logger_); |
183 logger_ = logger; | 184 logger_ = logger; |
185 | |
186 // We need to inform also the renderer side that we now want to start or stop | |
187 // logging. | |
Ilya Sherman
2014/04/23 05:19:56
nit: "Also inform the renderer process to start or
vabr (Chromium)
2014/04/23 18:15:35
Done.
| |
188 web_contents()->GetRenderViewHost()->Send(new AutofillMsg_ChangeLoggingState( | |
189 web_contents()->GetRenderViewHost()->GetRoutingID(), logger != NULL)); | |
184 } | 190 } |
185 | 191 |
186 void ChromePasswordManagerClient::LogSavePasswordProgress( | 192 void ChromePasswordManagerClient::LogSavePasswordProgress( |
187 const std::string& text) { | 193 const std::string& text) { |
188 if (IsLoggingActive()) | 194 if (IsLoggingActive()) |
189 logger_->LogSavePasswordProgress(text); | 195 logger_->LogSavePasswordProgress(text); |
190 } | 196 } |
191 | 197 |
192 bool ChromePasswordManagerClient::IsLoggingActive() const { | 198 bool ChromePasswordManagerClient::IsLoggingActive() const { |
193 return logger_ != NULL; | 199 return logger_ != NULL; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
284 web_contents(), | 290 web_contents(), |
285 web_contents()->GetView()->GetNativeView()); | 291 web_contents()->GetView()->GetNativeView()); |
286 popup_controller_->Show(false /* display_password */); | 292 popup_controller_->Show(false /* display_password */); |
287 #endif // #if defined(USE_AURA) | 293 #endif // #if defined(USE_AURA) |
288 } | 294 } |
289 | 295 |
290 void ChromePasswordManagerClient::CommitFillPasswordForm( | 296 void ChromePasswordManagerClient::CommitFillPasswordForm( |
291 autofill::PasswordFormFillData* data) { | 297 autofill::PasswordFormFillData* data) { |
292 driver_.FillPasswordForm(*data); | 298 driver_.FillPasswordForm(*data); |
293 } | 299 } |
OLD | NEW |