| 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 "components/autofill/core/common/save_password_progress_logger.h" | 5 #include "components/autofill/core/common/save_password_progress_logger.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/numerics/safe_conversions.h" | 11 #include "base/numerics/safe_conversions.h" |
| 12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "base/values.h" | 15 #include "base/values.h" |
| 16 #include "components/autofill/core/common/password_form.h" | 16 #include "components/autofill/core/common/password_form.h" |
| 17 | 17 |
| 18 using base::checked_cast; | 18 using base::checked_cast; |
| 19 using base::Value; | 19 using base::Value; |
| 20 using base::DictionaryValue; | 20 using base::DictionaryValue; |
| 21 using base::FundamentalValue; | 21 using base::Value; |
| 22 using base::StringValue; | 22 using base::StringValue; |
| 23 | 23 |
| 24 namespace autofill { | 24 namespace autofill { |
| 25 | 25 |
| 26 namespace { | 26 namespace { |
| 27 | 27 |
| 28 // Returns true for all characters which we don't want to see in the logged IDs | 28 // Returns true for all characters which we don't want to see in the logged IDs |
| 29 // or names of HTML elements. | 29 // or names of HTML elements. |
| 30 bool IsUnwantedInElementID(char c) { | 30 bool IsUnwantedInElementID(char c) { |
| 31 return !(c == '_' || c == '-' || base::IsAsciiAlpha(c) || | 31 return !(c == '_' || c == '-' || base::IsAsciiAlpha(c) || |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 | 94 |
| 95 void SavePasswordProgressLogger::LogURL( | 95 void SavePasswordProgressLogger::LogURL( |
| 96 SavePasswordProgressLogger::StringID label, | 96 SavePasswordProgressLogger::StringID label, |
| 97 const GURL& url) { | 97 const GURL& url) { |
| 98 LogValue(label, StringValue(ScrubURL(url))); | 98 LogValue(label, StringValue(ScrubURL(url))); |
| 99 } | 99 } |
| 100 | 100 |
| 101 void SavePasswordProgressLogger::LogBoolean( | 101 void SavePasswordProgressLogger::LogBoolean( |
| 102 SavePasswordProgressLogger::StringID label, | 102 SavePasswordProgressLogger::StringID label, |
| 103 bool truth_value) { | 103 bool truth_value) { |
| 104 LogValue(label, FundamentalValue(truth_value)); | 104 LogValue(label, Value(truth_value)); |
| 105 } | 105 } |
| 106 | 106 |
| 107 void SavePasswordProgressLogger::LogNumber( | 107 void SavePasswordProgressLogger::LogNumber( |
| 108 SavePasswordProgressLogger::StringID label, | 108 SavePasswordProgressLogger::StringID label, |
| 109 int signed_number) { | 109 int signed_number) { |
| 110 LogValue(label, FundamentalValue(signed_number)); | 110 LogValue(label, Value(signed_number)); |
| 111 } | 111 } |
| 112 | 112 |
| 113 void SavePasswordProgressLogger::LogNumber( | 113 void SavePasswordProgressLogger::LogNumber( |
| 114 SavePasswordProgressLogger::StringID label, | 114 SavePasswordProgressLogger::StringID label, |
| 115 size_t unsigned_number) { | 115 size_t unsigned_number) { |
| 116 LogNumber(label, checked_cast<int>(unsigned_number)); | 116 LogNumber(label, checked_cast<int>(unsigned_number)); |
| 117 } | 117 } |
| 118 | 118 |
| 119 void SavePasswordProgressLogger::LogMessage( | 119 void SavePasswordProgressLogger::LogMessage( |
| 120 SavePasswordProgressLogger::StringID message) { | 120 SavePasswordProgressLogger::StringID message) { |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 return "Form votes"; | 390 return "Form votes"; |
| 391 case SavePasswordProgressLogger::STRING_INVALID: | 391 case SavePasswordProgressLogger::STRING_INVALID: |
| 392 return "INVALID"; | 392 return "INVALID"; |
| 393 // Intentionally no default: clause here -- all IDs need to get covered. | 393 // Intentionally no default: clause here -- all IDs need to get covered. |
| 394 } | 394 } |
| 395 NOTREACHED(); // Win compilers don't believe this is unreachable. | 395 NOTREACHED(); // Win compilers don't believe this is unreachable. |
| 396 return std::string(); | 396 return std::string(); |
| 397 } | 397 } |
| 398 | 398 |
| 399 } // namespace autofill | 399 } // namespace autofill |
| OLD | NEW |