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 #ifndef COMPONENTS_AUTOFILL_CORE_COMMON_SAVE_PASSWORD_PROGRESS_LOGGER_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_COMMON_SAVE_PASSWORD_PROGRESS_LOGGER_H_ |
6 #define COMPONENTS_AUTOFILL_CORE_COMMON_SAVE_PASSWORD_PROGRESS_LOGGER_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_COMMON_SAVE_PASSWORD_PROGRESS_LOGGER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "url/gurl.h" | 10 #include "url/gurl.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 // third component, shared by autofill and password_manager, this helper needs | 31 // third component, shared by autofill and password_manager, this helper needs |
32 // to stay in autofill as well. | 32 // to stay in autofill as well. |
33 class SavePasswordProgressLogger { | 33 class SavePasswordProgressLogger { |
34 public: | 34 public: |
35 // IDs of strings allowed in the logs: for security reasons, we only pass the | 35 // IDs of strings allowed in the logs: for security reasons, we only pass the |
36 // IDs from the renderer, and map them to strings in the browser. | 36 // IDs from the renderer, and map them to strings in the browser. |
37 enum StringID { | 37 enum StringID { |
38 STRING_DECISION_ASK, | 38 STRING_DECISION_ASK, |
39 STRING_DECISION_DROP, | 39 STRING_DECISION_DROP, |
40 STRING_DECISION_SAVE, | 40 STRING_DECISION_SAVE, |
41 STRING_METHOD, | |
42 STRING_METHOD_GET, | |
43 STRING_METHOD_POST, | |
44 STRING_METHOD_EMPTY, | |
45 STRING_OTHER, | 41 STRING_OTHER, |
46 STRING_SCHEME_HTML, | 42 STRING_SCHEME_HTML, |
47 STRING_SCHEME_BASIC, | 43 STRING_SCHEME_BASIC, |
48 STRING_SCHEME_DIGEST, | 44 STRING_SCHEME_DIGEST, |
49 STRING_SCHEME_MESSAGE, | 45 STRING_SCHEME_MESSAGE, |
50 STRING_SIGNON_REALM, | 46 STRING_SIGNON_REALM, |
51 STRING_ORIGINAL_SIGNON_REALM, | 47 STRING_ORIGINAL_SIGNON_REALM, |
52 STRING_ORIGIN, | 48 STRING_ORIGIN, |
53 STRING_ACTION, | 49 STRING_ACTION, |
54 STRING_USERNAME_ELEMENT, | 50 STRING_USERNAME_ELEMENT, |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 }; | 103 }; |
108 | 104 |
109 SavePasswordProgressLogger(); | 105 SavePasswordProgressLogger(); |
110 virtual ~SavePasswordProgressLogger(); | 106 virtual ~SavePasswordProgressLogger(); |
111 | 107 |
112 // Call these methods to log information. They sanitize the input and call | 108 // Call these methods to log information. They sanitize the input and call |
113 // SendLog to pass it for display. | 109 // SendLog to pass it for display. |
114 void LogPasswordForm(StringID label, const PasswordForm& form); | 110 void LogPasswordForm(StringID label, const PasswordForm& form); |
115 void LogHTMLForm(StringID label, | 111 void LogHTMLForm(StringID label, |
116 const std::string& name_or_id, | 112 const std::string& name_or_id, |
117 const std::string& method, | |
118 const GURL& action); | 113 const GURL& action); |
119 void LogURL(StringID label, const GURL& url); | 114 void LogURL(StringID label, const GURL& url); |
120 void LogBoolean(StringID label, bool truth_value); | 115 void LogBoolean(StringID label, bool truth_value); |
121 void LogNumber(StringID label, int signed_number); | 116 void LogNumber(StringID label, int signed_number); |
122 void LogNumber(StringID label, size_t unsigned_number); | 117 void LogNumber(StringID label, size_t unsigned_number); |
123 void LogMessage(StringID message); | 118 void LogMessage(StringID message); |
124 | 119 |
125 protected: | 120 protected: |
126 // Sends |log| immediately for display. | 121 // Sends |log| immediately for display. |
127 virtual void SendLog(const std::string& log) = 0; | 122 virtual void SendLog(const std::string& log) = 0; |
128 | 123 |
129 private: | 124 private: |
130 // Converts |log| and its |label| to a string and calls SendLog on the result. | 125 // Converts |log| and its |label| to a string and calls SendLog on the result. |
131 void LogValue(StringID label, const base::Value& log); | 126 void LogValue(StringID label, const base::Value& log); |
132 | 127 |
133 DISALLOW_COPY_AND_ASSIGN(SavePasswordProgressLogger); | 128 DISALLOW_COPY_AND_ASSIGN(SavePasswordProgressLogger); |
134 }; | 129 }; |
135 | 130 |
136 } // namespace autofill | 131 } // namespace autofill |
137 | 132 |
138 #endif // COMPONENTS_AUTOFILL_CORE_COMMON_SAVE_PASSWORD_PROGRESS_LOGGER_H_ | 133 #endif // COMPONENTS_AUTOFILL_CORE_COMMON_SAVE_PASSWORD_PROGRESS_LOGGER_H_ |
OLD | NEW |