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; | |
22 using base::StringValue; | 21 using base::StringValue; |
23 | 22 |
24 namespace autofill { | 23 namespace autofill { |
25 | 24 |
26 namespace { | 25 namespace { |
27 | 26 |
28 // Returns true for all characters which we don't want to see in the logged IDs | 27 // Returns true for all characters which we don't want to see in the logged IDs |
29 // or names of HTML elements. | 28 // or names of HTML elements. |
30 bool IsUnwantedInElementID(char c) { | 29 bool IsUnwantedInElementID(char c) { |
31 return !(c == '_' || c == '-' || base::IsAsciiAlpha(c) || | 30 return !(c == '_' || c == '-' || base::IsAsciiAlpha(c) || |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 93 |
95 void SavePasswordProgressLogger::LogURL( | 94 void SavePasswordProgressLogger::LogURL( |
96 SavePasswordProgressLogger::StringID label, | 95 SavePasswordProgressLogger::StringID label, |
97 const GURL& url) { | 96 const GURL& url) { |
98 LogValue(label, StringValue(ScrubURL(url))); | 97 LogValue(label, StringValue(ScrubURL(url))); |
99 } | 98 } |
100 | 99 |
101 void SavePasswordProgressLogger::LogBoolean( | 100 void SavePasswordProgressLogger::LogBoolean( |
102 SavePasswordProgressLogger::StringID label, | 101 SavePasswordProgressLogger::StringID label, |
103 bool truth_value) { | 102 bool truth_value) { |
104 LogValue(label, FundamentalValue(truth_value)); | 103 LogValue(label, Value(truth_value)); |
105 } | 104 } |
106 | 105 |
107 void SavePasswordProgressLogger::LogNumber( | 106 void SavePasswordProgressLogger::LogNumber( |
108 SavePasswordProgressLogger::StringID label, | 107 SavePasswordProgressLogger::StringID label, |
109 int signed_number) { | 108 int signed_number) { |
110 LogValue(label, FundamentalValue(signed_number)); | 109 LogValue(label, Value(signed_number)); |
111 } | 110 } |
112 | 111 |
113 void SavePasswordProgressLogger::LogNumber( | 112 void SavePasswordProgressLogger::LogNumber( |
114 SavePasswordProgressLogger::StringID label, | 113 SavePasswordProgressLogger::StringID label, |
115 size_t unsigned_number) { | 114 size_t unsigned_number) { |
116 LogNumber(label, checked_cast<int>(unsigned_number)); | 115 LogNumber(label, checked_cast<int>(unsigned_number)); |
117 } | 116 } |
118 | 117 |
119 void SavePasswordProgressLogger::LogMessage( | 118 void SavePasswordProgressLogger::LogMessage( |
120 SavePasswordProgressLogger::StringID message) { | 119 SavePasswordProgressLogger::StringID message) { |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 return "Password reused from "; | 393 return "Password reused from "; |
395 case SavePasswordProgressLogger::STRING_INVALID: | 394 case SavePasswordProgressLogger::STRING_INVALID: |
396 return "INVALID"; | 395 return "INVALID"; |
397 // Intentionally no default: clause here -- all IDs need to get covered. | 396 // Intentionally no default: clause here -- all IDs need to get covered. |
398 } | 397 } |
399 NOTREACHED(); // Win compilers don't believe this is unreachable. | 398 NOTREACHED(); // Win compilers don't believe this is unreachable. |
400 return std::string(); | 399 return std::string(); |
401 } | 400 } |
402 | 401 |
403 } // namespace autofill | 402 } // namespace autofill |
OLD | NEW |