| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_PASSWORD_MANAGER_CONTENT_BROWSER_BAD_MESSAGE_H_ | 5 #ifndef COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_BAD_MESSAGE_H_ |
| 6 #define COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_BAD_MESSAGE_H_ | 6 #define COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_BAD_MESSAGE_H_ |
| 7 | 7 |
| 8 namespace content { | 8 namespace content { |
| 9 class RenderProcessHost; | 9 class RenderProcessHost; |
| 10 } | 10 } |
| 11 | 11 |
| 12 namespace password_manager { | 12 namespace password_manager { |
| 13 // The browser process often chooses to terminate a renderer if it receives | 13 // The browser process often chooses to terminate a renderer if it receives |
| 14 // a bad IPC message. The reasons are tracked for metrics. | 14 // a bad IPC message. The reasons are tracked for metrics. |
| 15 // | 15 // |
| 16 // See also content/browser/bad_message.h. | 16 // See also content/browser/bad_message.h. |
| 17 // | 17 // |
| 18 // NOTE: Do not remove or reorder elements in this list. Add new entries at the | 18 // NOTE: Do not remove or reorder elements in this list. Add new entries at the |
| 19 // end. Items may be renamed but do not change the values. We rely on the enum | 19 // end. Items may be renamed but do not change the values. We rely on the enum |
| 20 // values in histograms. | 20 // values in histograms. |
| 21 enum class BadMessageReason { | 21 enum class BadMessageReason { |
| 22 CPMD_BAD_ORIGIN_FORMS_PARSED = 1, | 22 CPMD_BAD_ORIGIN_FORMS_PARSED = 1, |
| 23 CPMD_BAD_ORIGIN_FORMS_RENDERED = 2, | 23 CPMD_BAD_ORIGIN_FORMS_RENDERED = 2, |
| 24 CPMD_BAD_ORIGIN_FORM_SUBMITTED = 3, | 24 CPMD_BAD_ORIGIN_FORM_SUBMITTED = 3, |
| 25 CPMD_BAD_ORIGIN_FOCUSED_PASSWORD_FORM_FOUND = 4, | 25 CPMD_BAD_ORIGIN_FOCUSED_PASSWORD_FORM_FOUND = 4, |
| 26 CPMD_BAD_ORIGIN_IN_PAGE_NAVIGATION = 5, | 26 CPMD_BAD_ORIGIN_IN_PAGE_NAVIGATION = 5, |
| 27 CPMD_BAD_ORIGIN_PASSWORD_NO_LONGER_GENERATED = 6, | 27 CPMD_BAD_ORIGIN_PASSWORD_NO_LONGER_GENERATED = 6, |
| 28 CPMD_BAD_ORIGIN_PRESAVE_GENERATED_PASSWORD = 7, | 28 CPMD_BAD_ORIGIN_PRESAVE_GENERATED_PASSWORD = 7, |
| 29 CPMD_BAD_ORIGIN_SAVE_GENERATION_FIELD_DETECTED_BY_CLASSIFIER = 8, |
| 29 | 30 |
| 30 // Please add new elements here. The naming convention is abbreviated class | 31 // Please add new elements here. The naming convention is abbreviated class |
| 31 // name (e.g. ContentPasswordManagerDriver becomes CPMD) plus a unique | 32 // name (e.g. ContentPasswordManagerDriver becomes CPMD) plus a unique |
| 32 // description of the reason. After making changes, you MUST update | 33 // description of the reason. After making changes, you MUST update |
| 33 // histograms.xml by running: | 34 // histograms.xml by running: |
| 34 // "python tools/metrics/histograms/update_bad_message_reasons.py" | 35 // "python tools/metrics/histograms/update_bad_message_reasons.py" |
| 35 BAD_MESSAGE_MAX | 36 BAD_MESSAGE_MAX |
| 36 }; | 37 }; |
| 37 | 38 |
| 38 namespace bad_message { | 39 namespace bad_message { |
| 39 // Called when the browser receives a bad IPC message from a renderer process on | 40 // Called when the browser receives a bad IPC message from a renderer process on |
| 40 // the UI thread. Logs the event, records a histogram metric for the |reason|, | 41 // the UI thread. Logs the event, records a histogram metric for the |reason|, |
| 41 // and terminates the process for |host|. | 42 // and terminates the process for |host|. |
| 42 void ReceivedBadMessage(content::RenderProcessHost* host, | 43 void ReceivedBadMessage(content::RenderProcessHost* host, |
| 43 BadMessageReason reason); | 44 BadMessageReason reason); |
| 44 | 45 |
| 45 } // namespace bad_message | 46 } // namespace bad_message |
| 46 } // namespace password_manager | 47 } // namespace password_manager |
| 47 | 48 |
| 48 #endif // COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_BAD_MESSAGE_H_ | 49 #endif // COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_BAD_MESSAGE_H_ |
| OLD | NEW |