[Android] A prototype of the interactive media notification.
[chromium-blink-merge.git] / content / browser / bad_message.h
blob30d33d4aa73e2c47b090afda25e3d4d757c9e00f
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 CONTENT_BROWSER_BAD_MESSAGE_H_
6 #define CONTENT_BROWSER_BAD_MESSAGE_H_
8 namespace content {
9 class BrowserMessageFilter;
10 class RenderProcessHost;
12 namespace bad_message {
14 // The browser process often chooses to terminate a renderer if it receives
15 // a bad IPC message. The reasons are tracked for metrics.
17 // Content embedders should implement their own bad message statistics but
18 // should use similar histogram names to make analysis easier.
20 // NOTE: Do not remove or reorder elements in this list. Add new entries at the
21 // end. Items may be renamed but do not change the values. We rely on the enum
22 // values in histograms. Also update histograms.xml with any new values by
23 // running:
24 // python tools/metrics/histograms/update_bad_message_reasons.py
25 enum BadMessageReason {
26 NC_IN_PAGE_NAVIGATION = 0,
27 RFH_CAN_COMMIT_URL_BLOCKED = 1,
28 RFH_CAN_ACCESS_FILES_OF_PAGE_STATE = 2,
29 RFH_SANDBOX_FLAGS = 3,
30 RFH_NO_PROXY_TO_PARENT = 4,
31 RPH_DESERIALIZATION_FAILED = 5,
32 RVH_CAN_ACCESS_FILES_OF_PAGE_STATE = 6,
33 RVH_FILE_CHOOSER_PATH = 7,
34 RWH_SYNTHETIC_GESTURE = 8,
35 RWH_FOCUS = 9,
36 RWH_BLUR = 10,
37 RWH_SHARED_BITMAP = 11,
38 RWH_BAD_ACK_MESSAGE = 12,
39 RWHVA_SHARED_MEMORY = 13,
40 SERVICE_WORKER_BAD_URL = 14,
41 WC_INVALID_FRAME_SOURCE = 15,
42 RWHVM_UNEXPECTED_FRAME_TYPE = 16,
43 RFPH_DETACH = 17,
44 DFH_BAD_EMBEDDER_MESSAGE = 18,
45 NC_AUTO_SUBFRAME = 19,
46 CSDH_NOT_RECOGNIZED = 20,
47 DSMF_OPEN_STORAGE = 21,
48 DSMF_LOAD_STORAGE = 22,
49 DBMF_INVALID_ORIGIN_ON_OPEN = 23,
50 DBMF_DB_NOT_OPEN_ON_MODIFY = 24,
51 DBMF_DB_NOT_OPEN_ON_CLOSE = 25,
52 DBMF_INVALID_ORIGIN_ON_SQLITE_ERROR = 26,
53 RDH_INVALID_PRIORITY = 27,
54 RDH_REQUEST_NOT_TRANSFERRING = 28,
55 RDH_BAD_DOWNLOAD = 29,
56 NMF_NO_PERMISSION_SHOW = 30,
57 NMF_NO_PERMISSION_CLOSE = 31,
58 NMF_NO_PERMISSION_VERIFY = 32,
59 MH_INVALID_MIDI_PORT = 33,
60 MH_SYS_EX_PERMISSION = 34,
61 ACDH_REGISTER = 35,
62 ACDH_UNREGISTER = 36,
63 ACDH_SET_SPAWNING = 37,
64 ACDH_SELECT_CACHE = 38,
65 ACDH_SELECT_CACHE_FOR_WORKER = 39,
66 ACDH_SELECT_CACHE_FOR_SHARED_WORKER = 40,
67 ACDH_MARK_AS_FOREIGN_ENTRY = 41,
68 ACDH_PENDING_REPLY_IN_GET_STATUS = 42,
69 ACDH_GET_STATUS = 43,
70 ACDH_PENDING_REPLY_IN_START_UPDATE = 44,
71 ACDH_START_UPDATE = 45,
72 ACDH_PENDING_REPLY_IN_SWAP_CACHE = 46,
73 ACDH_SWAP_CACHE = 47,
74 SWDH_NOT_HANDLED = 48,
75 SWDH_REGISTER_BAD_URL = 49,
76 SWDH_REGISTER_NO_HOST = 50,
77 SWDH_REGISTER_CANNOT = 51,
78 SWDH_UNREGISTER_BAD_URL = 52,
79 SWDH_UNREGISTER_NO_HOST = 53,
80 SWDH_UNREGISTER_CANNOT = 54,
81 SWDH_GET_REGISTRATION_BAD_URL = 55,
82 SWDH_GET_REGISTRATION_NO_HOST = 56,
83 SWDH_GET_REGISTRATION_CANNOT = 57,
84 SWDH_GET_REGISTRATION_FOR_READY_NO_HOST = 58,
85 SWDH_GET_REGISTRATION_FOR_READY_ALREADY_IN_PROGRESS = 59,
86 SWDH_POST_MESSAGE = 60,
87 SWDH_PROVIDER_CREATED_NO_HOST = 61,
88 SWDH_PROVIDER_DESTROYED_NO_HOST = 62,
89 SWDH_SET_HOSTED_VERSION_NO_HOST = 63,
90 SWDH_SET_HOSTED_VERSION = 64,
91 SWDH_WORKER_SCRIPT_LOAD_NO_HOST = 65,
92 SWDH_INCREMENT_WORKER_BAD_HANDLE = 66,
93 SWDH_DECREMENT_WORKER_BAD_HANDLE = 67,
94 SWDH_INCREMENT_REGISTRATION_BAD_HANDLE = 68,
95 SWDH_DECREMENT_REGISTRATION_BAD_HANDLE = 69,
96 SWDH_TERMINATE_BAD_HANDLE = 70,
97 FAMF_APPEND_ITEM_TO_BLOB = 71,
98 FAMF_APPEND_SHARED_MEMORY_TO_BLOB = 72,
99 FAMF_MALFORMED_STREAM_URL = 73,
100 FAMF_APPEND_ITEM_TO_STREAM = 74,
101 FAMF_APPEND_SHARED_MEMORY_TO_STREAM = 75,
102 IDBDH_CAN_READ_FILE = 76,
103 IDBDH_GET_OR_TERMINATE = 77,
104 RMF_SET_COOKIE_BAD_ORIGIN = 78,
105 RMF_GET_COOKIES_BAD_ORIGIN = 79,
106 SWDH_GET_REGISTRATIONS_NO_HOST = 80,
107 SWDH_GET_REGISTRATIONS_INVALID_ORIGIN = 81,
108 ARH_UNAUTHORIZED_URL = 82,
109 BDH_INVALID_SERVICE_ID = 83,
110 RFH_COMMIT_DESERIALIZATION_FAILED = 84,
111 BDH_INVALID_CHARACTERISTIC_ID = 85,
112 SWDH_UPDATE_NO_HOST = 86,
113 SWDH_UPDATE_BAD_REGISTRATION_ID = 87,
114 SWDH_UPDATE_CANNOT = 88,
115 SWDH_UNREGISTER_BAD_REGISTRATION_ID = 89,
117 // Please add new elements here. The naming convention is abbreviated class
118 // name (e.g. RenderFrameHost becomes RFH) plus a unique description of the
119 // reason.
120 BAD_MESSAGE_MAX
123 // Called when the browser receives a bad IPC message from a renderer process on
124 // the UI thread. Logs the event, records a histogram metric for the |reason|,
125 // and terminates the process for |host|.
126 void ReceivedBadMessage(RenderProcessHost* host, BadMessageReason reason);
128 // Called when a browser message filter receives a bad IPC message from a
129 // renderer or other child process. Logs the event, records a histogram metric
130 // for the |reason|, and terminates the process for |filter|.
131 void ReceivedBadMessage(BrowserMessageFilter* filter, BadMessageReason reason);
133 } // namespace bad_message
134 } // namespace content
136 #endif // CONTENT_BROWSER_BAD_MESSAGE_H_