Respond with QuotaExceededError when IndexedDB has no disk space on open.
[chromium-blink-merge.git] / content / common / input / input_event_disposition.cc
blobe3a1e77f75b3ca64fac9a4835b9b56cfd158d0d4
1 // Copyright 2013 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 #include "content/common/input/input_event_disposition.h"
7 #include "base/logging.h"
9 namespace content {
11 InputEventDisposition ToDisposition(InputEventAckState ack_state,
12 bool main_thread,
13 bool prevent_default) {
14 if (main_thread) {
15 switch (ack_state) {
16 case INPUT_EVENT_ACK_STATE_CONSUMED:
17 return INPUT_EVENT_MAIN_THREAD_CONSUMED;
18 case INPUT_EVENT_ACK_STATE_NOT_CONSUMED:
19 return prevent_default ? INPUT_EVENT_MAIN_THREAD_PREVENT_DEFAULTED
20 : INPUT_EVENT_MAIN_THREAD_NOT_PREVENT_DEFAULTED;
21 case INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS:
22 return INPUT_EVENT_MAIN_THREAD_NO_CONSUMER_EXISTS;
23 case INPUT_EVENT_ACK_STATE_UNKNOWN:
24 return INPUT_EVENT_UNHANDLED;
26 } else {
27 switch (ack_state) {
28 case INPUT_EVENT_ACK_STATE_CONSUMED:
29 return INPUT_EVENT_IMPL_THREAD_CONSUMED;
30 case INPUT_EVENT_ACK_STATE_NOT_CONSUMED:
31 return INPUT_EVENT_IMPL_THREAD_BOUNCE_TO_MAIN;
32 case INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS:
33 return INPUT_EVENT_IMPL_THREAD_NO_CONSUMER_EXISTS;
34 case INPUT_EVENT_ACK_STATE_UNKNOWN:
35 return INPUT_EVENT_UNHANDLED;
38 NOTREACHED();
39 return INPUT_EVENT_UNHANDLED;
42 InputEventAckState ToAckState(InputEventDisposition disposition) {
43 switch (disposition) {
44 case INPUT_EVENT_UNHANDLED:
45 return INPUT_EVENT_ACK_STATE_UNKNOWN;
46 case INPUT_EVENT_IMPL_THREAD_CONSUMED:
47 return INPUT_EVENT_ACK_STATE_CONSUMED;
48 case INPUT_EVENT_IMPL_THREAD_NO_CONSUMER_EXISTS:
49 return INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS;
50 case INPUT_EVENT_IMPL_THREAD_BOUNCE_TO_MAIN:
51 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED;
52 case INPUT_EVENT_COULD_NOT_DELIVER:
53 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED;
54 case INPUT_EVENT_MAIN_THREAD_CONSUMED:
55 return INPUT_EVENT_ACK_STATE_CONSUMED;
56 case INPUT_EVENT_MAIN_THREAD_PREVENT_DEFAULTED:
57 return INPUT_EVENT_ACK_STATE_CONSUMED;
58 case INPUT_EVENT_MAIN_THREAD_NOT_PREVENT_DEFAULTED:
59 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED;
60 case INPUT_EVENT_MAIN_THREAD_NO_CONSUMER_EXISTS:
61 return INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS;
63 NOTREACHED();
64 return INPUT_EVENT_ACK_STATE_UNKNOWN;
67 } // namespace content