| 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" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 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/web_contents.h" | 28 #include "content/public/browser/web_contents.h" |
| 29 #include "content/public/browser/web_contents_view.h" | 29 #include "content/public/browser/web_contents_view.h" |
| 30 #include "ipc/ipc_message_macros.h" | 30 #include "ipc/ipc_message_macros.h" |
| 31 | 31 |
| 32 #if defined(OS_ANDROID) | 32 #if defined(OS_ANDROID) |
| 33 #include "chrome/browser/android/password_authentication_manager.h" | 33 #include "chrome/browser/android/password_authentication_manager.h" |
| 34 #endif // OS_ANDROID | 34 #endif // OS_ANDROID |
| 35 | 35 |
| 36 using autofill::SavePasswordProgressLogger; |
| 37 |
| 36 namespace { | 38 namespace { |
| 37 | 39 |
| 38 bool IsTheHotNewBubbleUIEnabled() { | 40 bool IsTheHotNewBubbleUIEnabled() { |
| 39 std::string group_name = | 41 std::string group_name = |
| 40 base::FieldTrialList::FindFullName("PasswordManagerUI"); | 42 base::FieldTrialList::FindFullName("PasswordManagerUI"); |
| 41 | 43 |
| 42 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 44 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 43 if (command_line->HasSwitch(switches::kDisableSavePasswordBubble)) | 45 if (command_line->HasSwitch(switches::kDisableSavePasswordBubble)) |
| 44 return false; | 46 return false; |
| 45 | 47 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 // 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 |
| 177 // 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. |
| 178 // 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 |
| 179 // 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 |
| 180 // instances to 1 in normal profiles, and 0 in incognito. | 182 // instances to 1 in normal profiles, and 0 in incognito. |
| 181 DCHECK(!logger || !logger_); | 183 DCHECK(!logger || !logger_); |
| 182 logger_ = logger; | 184 logger_ = logger; |
| 183 } | 185 } |
| 184 | 186 |
| 185 void ChromePasswordManagerClient::LogSavePasswordProgress( | 187 void ChromePasswordManagerClient::LogSavePasswordProgress( |
| 186 const std::string& text) { | 188 const std::vector<SavePasswordProgressLogger::StructuredLog>& logs) { |
| 189 std::string text(SavePasswordProgressLogger::SanitizeStructuredLogs(logs)); |
| 187 if (IsLoggingActive()) | 190 if (IsLoggingActive()) |
| 188 logger_->LogSavePasswordProgress(text); | 191 logger_->LogSavePasswordProgress(text); |
| 189 } | 192 } |
| 190 | 193 |
| 191 bool ChromePasswordManagerClient::IsLoggingActive() const { | 194 bool ChromePasswordManagerClient::IsLoggingActive() const { |
| 192 return logger_ != NULL; | 195 return logger_ != NULL; |
| 193 } | 196 } |
| 194 | 197 |
| 195 // static | 198 // static |
| 196 password_manager::PasswordGenerationManager* | 199 password_manager::PasswordGenerationManager* |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 web_contents(), | 286 web_contents(), |
| 284 web_contents()->GetView()->GetNativeView()); | 287 web_contents()->GetView()->GetNativeView()); |
| 285 popup_controller_->Show(false /* display_password */); | 288 popup_controller_->Show(false /* display_password */); |
| 286 #endif // #if defined(USE_AURA) | 289 #endif // #if defined(USE_AURA) |
| 287 } | 290 } |
| 288 | 291 |
| 289 void ChromePasswordManagerClient::CommitFillPasswordForm( | 292 void ChromePasswordManagerClient::CommitFillPasswordForm( |
| 290 autofill::PasswordFormFillData* data) { | 293 autofill::PasswordFormFillData* data) { |
| 291 driver_.FillPasswordForm(*data); | 294 driver_.FillPasswordForm(*data); |
| 292 } | 295 } |
| OLD | NEW |