Roll src/third_party/WebKit c63b89c:29324ab (svn 202546:202547)
[chromium-blink-merge.git] / components / password_manager / content / browser / bad_message.h
blob37efbefd42c78a20e7ad7c1bdca8a0cb6a05777a
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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_BAD_MESSAGE_H_
6 #define COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_BAD_MESSAGE_H_
8 namespace content {
9 class RenderProcessHost;
12 namespace password_manager {
13 // The browser process often chooses to terminate a renderer if it receives
14 // a bad IPC message. The reasons are tracked for metrics.
16 // See also content/browser/bad_message.h.
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
20 // values in histograms.
21 enum class BadMessageReason {
22 CPMD_BAD_ORIGIN_FORMS_PARSED = 1,
23 CPMD_BAD_ORIGIN_FORMS_RENDERED = 2,
24 CPMD_BAD_ORIGIN_FORM_SUBMITTED = 3,
25 CPMD_BAD_ORIGIN_FOCUSED_PASSWORD_FORM_FOUND = 4,
26 CPMD_BAD_ORIGIN_IN_PAGE_NAVIGATION = 5,
27 CPMD_BAD_ORIGIN_PASSWORD_NO_LONGER_GENERATED = 6,
29 // Please add new elements here. The naming convention is abbreviated class
30 // name (e.g. ContentPasswordManagerDriver becomes CPMD) plus a unique
31 // description of the reason. After making changes, you MUST update
32 // histograms.xml by running:
33 // "python tools/metrics/histograms/update_bad_message_reasons.py"
34 BAD_MESSAGE_MAX
37 namespace bad_message {
38 // Called when the browser receives a bad IPC message from a renderer process on
39 // the UI thread. Logs the event, records a histogram metric for the |reason|,
40 // and terminates the process for |host|.
41 void ReceivedBadMessage(content::RenderProcessHost* host,
42 BadMessageReason reason);
44 } // namespace bad_message
45 } // namespace password_manager
47 #endif // COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_BAD_MESSAGE_H_