Commit 949b6e50 authored by perezju's avatar perezju Committed by Commit bot

Revert of Use the new java_cpp_enum rule in content. (patchset #8 id:140001 of...

Revert of Use the new java_cpp_enum rule in content. (patchset #8 id:140001 of https://codereview.chromium.org/615893003/)

Reason for revert:
Fails to compile on several bots:

https://chromegw.corp.google.com/i/clank.tot/builders/clang-clankium-tot-builder/builds/56800/steps/compile/logs/stdio

First error:
FAILED: cd ../../clank/native/framework; python <snip ...>
../../../clank/java/apps/chrome/src/com/google/android/apps/chrome/webapps/FullScreenActivityTab.java:28: error: cannot find symbol
import org.chromium.content.common.TopControlsState;
                                  ^
  symbol:   class TopControlsState
  location: package org.chromium.content.common

Original issue's description:
> Use the new java_cpp_enum rule in content.
>
> This moves most of the generated Java enums under content/ to use the
> java_cpp_enum rule removing the need for keeping the enums in
> separate list files and the need for the .template files.
>
> BUG=405532, 351558
>
> Committed: https://crrev.com/7d5f0a581ba2f0e79b09ecbf6127ad453a861a96
> Cr-Commit-Position: refs/heads/master@{#297789}

TBR=jam@chromium.org,yfriedman@chromium.org,scottmg@chromium.org,jdduke@chromium.org,brettw@chromium.org,mkosiba@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=405532, 351558

Review URL: https://codereview.chromium.org/625543002

Cr-Commit-Position: refs/heads/master@{#297793}
parent 86a0c99d
......@@ -42,19 +42,18 @@ LOCAL_GENERATED_SOURCES := \
$(call intermediates-dir-for,GYP,shared)/enums/bitmap_format_java/org/chromium/ui/gfx/BitmapFormat.java \
$(call intermediates-dir-for,GYP,shared)/enums/cert_verify_status_android_java/org/chromium/net/CertVerifyStatusAndroid.java \
$(call intermediates-dir-for,GYP,shared)/enums/certificate_mime_types_java/org/chromium/net/CertificateMimeType.java \
$(call intermediates-dir-for,GYP,shared)/enums/content_gamepad_mapping/org/chromium/content/browser/input/CanonicalAxisIndex.java \
$(call intermediates-dir-for,GYP,shared)/enums/content_gamepad_mapping/org/chromium/content/browser/input/CanonicalButtonIndex.java \
$(call intermediates-dir-for,GYP,shared)/enums/gesture_event_type_java/org/chromium/content/browser/GestureEventType.java \
$(call intermediates-dir-for,GYP,shared)/enums/popup_item_type_java/org/chromium/content/browser/input/PopupItemType.java \
$(call intermediates-dir-for,GYP,shared)/enums/private_key_types_java/org/chromium/net/PrivateKeyType.java \
$(call intermediates-dir-for,GYP,shared)/enums/result_codes_java/org/chromium/content_public/common/ResultCode.java \
$(call intermediates-dir-for,GYP,shared)/enums/screen_orientation_values_java/org/chromium/content_public/common/ScreenOrientationValues.java \
$(call intermediates-dir-for,GYP,shared)/enums/selection_event_type_java/org/chromium/content/browser/input/SelectionEventType.java \
$(call intermediates-dir-for,GYP,shared)/enums/speech_recognition_error_java/org/chromium/content_public/common/SpeechRecognitionErrorCode.java \
$(call intermediates-dir-for,GYP,shared)/enums/top_controls_state_java/org/chromium/content_public/common/TopControlsState.java \
$(call intermediates-dir-for,GYP,shared)/enums/window_open_disposition_java/org/chromium/ui/WindowOpenDisposition.java \
$(call intermediates-dir-for,GYP,shared)/templates/org/chromium/base/ApplicationState.java \
$(call intermediates-dir-for,GYP,shared)/templates/org/chromium/base/MemoryPressureLevelList.java \
$(call intermediates-dir-for,GYP,shared)/templates/org/chromium/content/browser/GestureEventType.java \
$(call intermediates-dir-for,GYP,shared)/templates/org/chromium/content/browser/SpeechRecognitionError.java \
$(call intermediates-dir-for,GYP,shared)/templates/org/chromium/content/browser/input/CanonicalAxisIndex.java \
$(call intermediates-dir-for,GYP,shared)/templates/org/chromium/content/browser/input/CanonicalButtonIndex.java \
$(call intermediates-dir-for,GYP,shared)/templates/org/chromium/content/browser/input/PopupItemType.java \
$(call intermediates-dir-for,GYP,shared)/templates/org/chromium/content/browser/input/SelectionEventType.java \
$(call intermediates-dir-for,GYP,shared)/templates/org/chromium/content/common/ResultCodes.java \
$(call intermediates-dir-for,GYP,shared)/templates/org/chromium/content_public/common/ScreenOrientationValues.java \
$(call intermediates-dir-for,GYP,shared)/templates/org/chromium/media/AndroidImageFormat.java \
$(call intermediates-dir-for,GYP,shared)/templates/org/chromium/net/NetError.java \
$(call intermediates-dir-for,GYP,shared)/templates/org/chromium/ui/base/PageTransitionTypes.java \
......
......@@ -22,7 +22,6 @@
'../content/content.gyp:screen_orientation_values_java',
'../content/content.gyp:selection_event_type_java',
'../content/content.gyp:speech_recognition_error_java',
'../content/content.gyp:top_controls_state_java',
'../media/media.gyp:media_android_imageformat_list',
'../net/net.gyp:cert_verify_status_android_java',
'../net/net.gyp:certificate_mime_types_java',
......
......@@ -301,7 +301,7 @@ template("java_cpp_enum") {
assert(defined(invoker.outputs))
action("${target_name}__generate_enum") {
sources = invoker.sources
sources = rebase_path(invoker.sources, root_build_dir)
script = "//build/android/gyp/java_cpp_enum.py"
gen_dir = "${target_gen_dir}/${target_name}/enums"
outputs = get_path_info(
......@@ -313,7 +313,7 @@ template("java_cpp_enum") {
foreach(output, rebase_path(outputs, root_build_dir)) {
args += ["--assert_file", output]
}
args += rebase_path(invoker.sources, root_build_dir)
args += sources
}
generate_enum_outputs = get_target_outputs(":${target_name}__generate_enum")
......
......@@ -58,7 +58,6 @@ def print_landmines():
print 'ninja dependency cycle: crbug.com/408192'
if platform() == 'android':
print 'Clobber: To delete stale generated .java files.'
print 'Delete stale generated .java files again. crbug.com/349592'
def main():
......
......@@ -70,17 +70,10 @@ using blink::WebInputEvent;
// Describes the type and enabled state of a select popup item.
namespace {
// A Java counterpart will be generated for this enum.
// GENERATED_JAVA_ENUM_PACKAGE: org.chromium.content.browser.input
enum PopupItemType {
// Popup item is of type group
POPUP_ITEM_TYPE_GROUP,
// Popup item is disabled
POPUP_ITEM_TYPE_DISABLED,
// Popup item is enabled
POPUP_ITEM_TYPE_ENABLED,
enum {
#define DEFINE_POPUP_ITEM_TYPE(name, value) POPUP_ITEM_TYPE_##name = value,
#include "content/browser/android/popup_item_type_list.h"
#undef DEFINE_POPUP_ITEM_TYPE
};
} //namespace
......@@ -115,37 +108,37 @@ ScopedJavaLocalRef<jobject> CreateJavaRect(
int ToGestureEventType(WebInputEvent::Type type) {
switch (type) {
case WebInputEvent::GestureScrollBegin:
return GESTURE_EVENT_TYPE_SCROLL_START;
return SCROLL_START;
case WebInputEvent::GestureScrollEnd:
return GESTURE_EVENT_TYPE_SCROLL_END;
return SCROLL_END;
case WebInputEvent::GestureScrollUpdate:
return GESTURE_EVENT_TYPE_SCROLL_BY;
return SCROLL_BY;
case WebInputEvent::GestureFlingStart:
return GESTURE_EVENT_TYPE_FLING_START;
return FLING_START;
case WebInputEvent::GestureFlingCancel:
return GESTURE_EVENT_TYPE_FLING_CANCEL;
return FLING_CANCEL;
case WebInputEvent::GestureShowPress:
return GESTURE_EVENT_TYPE_SHOW_PRESS;
return SHOW_PRESS;
case WebInputEvent::GestureTap:
return GESTURE_EVENT_TYPE_SINGLE_TAP_CONFIRMED;
return SINGLE_TAP_CONFIRMED;
case WebInputEvent::GestureTapUnconfirmed:
return GESTURE_EVENT_TYPE_SINGLE_TAP_UNCONFIRMED;
return SINGLE_TAP_UNCONFIRMED;
case WebInputEvent::GestureTapDown:
return GESTURE_EVENT_TYPE_TAP_DOWN;
return TAP_DOWN;
case WebInputEvent::GestureTapCancel:
return GESTURE_EVENT_TYPE_TAP_CANCEL;
return TAP_CANCEL;
case WebInputEvent::GestureDoubleTap:
return GESTURE_EVENT_TYPE_DOUBLE_TAP;
return DOUBLE_TAP;
case WebInputEvent::GestureLongPress:
return GESTURE_EVENT_TYPE_LONG_PRESS;
return LONG_PRESS;
case WebInputEvent::GestureLongTap:
return GESTURE_EVENT_TYPE_LONG_TAP;
return LONG_TAP;
case WebInputEvent::GesturePinchBegin:
return GESTURE_EVENT_TYPE_PINCH_BEGIN;
return PINCH_BEGIN;
case WebInputEvent::GesturePinchEnd:
return GESTURE_EVENT_TYPE_PINCH_END;
return PINCH_END;
case WebInputEvent::GesturePinchUpdate:
return GESTURE_EVENT_TYPE_PINCH_BY;
return PINCH_BY;
case WebInputEvent::GestureTwoFingerTap:
case WebInputEvent::GestureScrollUpdateWithoutPropagation:
default:
......
......@@ -7,31 +7,10 @@
namespace content {
// This file contains a list of GestureEventType's usable by ContentViewCore,
// providing a direct mapping to and from their corresponding
// blink::WebGestureEvent types.
//
// A Java counterpart will be generated for this enum.
// GENERATED_JAVA_ENUM_PACKAGE: org.chromium.content.browser
enum GestureEventType {
GESTURE_EVENT_TYPE_SHOW_PRESS,
GESTURE_EVENT_TYPE_DOUBLE_TAP,
GESTURE_EVENT_TYPE_SINGLE_TAP_UP,
GESTURE_EVENT_TYPE_SINGLE_TAP_CONFIRMED,
GESTURE_EVENT_TYPE_SINGLE_TAP_UNCONFIRMED,
GESTURE_EVENT_TYPE_LONG_PRESS,
GESTURE_EVENT_TYPE_SCROLL_START,
GESTURE_EVENT_TYPE_SCROLL_BY,
GESTURE_EVENT_TYPE_SCROLL_END,
GESTURE_EVENT_TYPE_FLING_START,
GESTURE_EVENT_TYPE_FLING_CANCEL,
GESTURE_EVENT_TYPE_FLING_END,
GESTURE_EVENT_TYPE_PINCH_BEGIN,
GESTURE_EVENT_TYPE_PINCH_BY,
GESTURE_EVENT_TYPE_PINCH_END,
GESTURE_EVENT_TYPE_TAP_CANCEL,
GESTURE_EVENT_TYPE_LONG_TAP,
GESTURE_EVENT_TYPE_TAP_DOWN,
#define DEFINE_GESTURE_EVENT_TYPE(name, value) name = value,
#include "content/browser/android/gesture_event_type_list.h"
#undef DEFINE_GESTURE_EVENT_TYPE
};
} // namespace content
......
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file intentionally does not have header guards because this file
// is meant to be included inside a macro to generate enum values.
// This file contains a list of GestureEventType's usable by ContentViewCore,
// providing a direct mapping to and from their corresponding
// blink::WebGestureEvent types.
#ifndef DEFINE_GESTURE_EVENT_TYPE
#error "Please define DEFINE_GESTURE_EVENT_TYPE before including this file."
#endif
DEFINE_GESTURE_EVENT_TYPE(SHOW_PRESS, 0)
DEFINE_GESTURE_EVENT_TYPE(DOUBLE_TAP, 1)
DEFINE_GESTURE_EVENT_TYPE(SINGLE_TAP_UP, 2)
DEFINE_GESTURE_EVENT_TYPE(SINGLE_TAP_CONFIRMED, 3)
DEFINE_GESTURE_EVENT_TYPE(SINGLE_TAP_UNCONFIRMED, 4)
DEFINE_GESTURE_EVENT_TYPE(LONG_PRESS, 5)
DEFINE_GESTURE_EVENT_TYPE(SCROLL_START, 6)
DEFINE_GESTURE_EVENT_TYPE(SCROLL_BY, 7)
DEFINE_GESTURE_EVENT_TYPE(SCROLL_END, 8)
DEFINE_GESTURE_EVENT_TYPE(FLING_START, 9)
DEFINE_GESTURE_EVENT_TYPE(FLING_CANCEL, 10)
DEFINE_GESTURE_EVENT_TYPE(FLING_END, 11)
DEFINE_GESTURE_EVENT_TYPE(PINCH_BEGIN, 12)
DEFINE_GESTURE_EVENT_TYPE(PINCH_BY, 13)
DEFINE_GESTURE_EVENT_TYPE(PINCH_END, 14)
DEFINE_GESTURE_EVENT_TYPE(TAP_CANCEL, 15)
DEFINE_GESTURE_EVENT_TYPE(LONG_TAP, 16)
DEFINE_GESTURE_EVENT_TYPE(TAP_DOWN, 17)
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file intentionally does not have header guards because this file
// is meant to be included inside a macro to generate enum values.
// This file contains a list of sync PopupItemTypes which describe the type
// and enabled state of a select popup item. List is used by Android when
// displaying a new select popup menu.
#ifndef DEFINE_POPUP_ITEM_TYPE
#error "Please define DEFINE_POPUP_ITEM_TYPE before including this file."
#endif
// Popup item is of type group
DEFINE_POPUP_ITEM_TYPE(GROUP, 0)
// Popup item is disabled
DEFINE_POPUP_ITEM_TYPE(DISABLED, 1)
// Popup item is enabled
DEFINE_POPUP_ITEM_TYPE(ENABLED, 2)
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file intentionally does not have header guards, it's included
// inside a macro to generate enum values.
// This file defines the canonical axes mapping order for gamepad-like devices.
// TODO(SaurabhK): Consolidate with CanonicalAxisIndex enum in
// gamepad_standard_mappings.h, crbug.com/351558.
CANONICAL_AXIS_INDEX(AXIS_LEFT_STICK_X, 0)
CANONICAL_AXIS_INDEX(AXIS_LEFT_STICK_Y, 1)
CANONICAL_AXIS_INDEX(AXIS_RIGHT_STICK_X, 2)
CANONICAL_AXIS_INDEX(AXIS_RIGHT_STICK_Y, 3)
CANONICAL_AXIS_INDEX(NUM_CANONICAL_AXES, 4)
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file intentionally does not have header guards, it's included
// inside a macro to generate enum values.
// This defines the canonical button mapping order for gamepad-like devices.
// TODO(SaurabhK): Consolidate with CanonicalButtonIndex enum in
// gamepad_standard_mappings.h, crbug.com/351558.
CANONICAL_BUTTON_INDEX(BUTTON_PRIMARY, 0)
CANONICAL_BUTTON_INDEX(BUTTON_SECONDARY, 1)
CANONICAL_BUTTON_INDEX(BUTTON_TERTIARY, 2)
CANONICAL_BUTTON_INDEX(BUTTON_QUATERNARY, 3)
CANONICAL_BUTTON_INDEX(BUTTON_LEFT_SHOULDER, 4)
CANONICAL_BUTTON_INDEX(BUTTON_RIGHT_SHOULDER, 5)
CANONICAL_BUTTON_INDEX(BUTTON_LEFT_TRIGGER, 6)
CANONICAL_BUTTON_INDEX(BUTTON_RIGHT_TRIGGER, 7)
CANONICAL_BUTTON_INDEX(BUTTON_BACK_SELECT, 8)
CANONICAL_BUTTON_INDEX(BUTTON_START, 9)
CANONICAL_BUTTON_INDEX(BUTTON_LEFT_THUMBSTICK, 10)
CANONICAL_BUTTON_INDEX(BUTTON_RIGHT_THUMBSTICK, 11)
CANONICAL_BUTTON_INDEX(BUTTON_DPAD_UP, 12)
CANONICAL_BUTTON_INDEX(BUTTON_DPAD_DOWN, 13)
CANONICAL_BUTTON_INDEX(BUTTON_DPAD_LEFT, 14)
CANONICAL_BUTTON_INDEX(BUTTON_DPAD_RIGHT, 15)
CANONICAL_BUTTON_INDEX(BUTTON_META, 16)
CANONICAL_BUTTON_INDEX(NUM_CANONICAL_BUTTONS, 17)
\ No newline at end of file
......@@ -51,14 +51,14 @@ void DpadFromAxis(blink::WebGamepad* mapped, float dir) {
left = dir >= .4f && dir <= 1.f;
}
mapped->buttons[BUTTON_INDEX_DPAD_UP].pressed = up;
mapped->buttons[BUTTON_INDEX_DPAD_UP].value = up ? 1.f : 0.f;
mapped->buttons[BUTTON_INDEX_DPAD_RIGHT].pressed = right;
mapped->buttons[BUTTON_INDEX_DPAD_RIGHT].value = right ? 1.f : 0.f;
mapped->buttons[BUTTON_INDEX_DPAD_DOWN].pressed = down;
mapped->buttons[BUTTON_INDEX_DPAD_DOWN].value = down ? 1.f : 0.f;
mapped->buttons[BUTTON_INDEX_DPAD_LEFT].pressed = left;
mapped->buttons[BUTTON_INDEX_DPAD_LEFT].value = left ? 1.f : 0.f;
mapped->buttons[kButtonDpadUp].pressed = up;
mapped->buttons[kButtonDpadUp].value = up ? 1.f : 0.f;
mapped->buttons[kButtonDpadRight].pressed = right;
mapped->buttons[kButtonDpadRight].value = right ? 1.f : 0.f;
mapped->buttons[kButtonDpadDown].pressed = down;
mapped->buttons[kButtonDpadDown].value = down ? 1.f : 0.f;
mapped->buttons[kButtonDpadLeft].pressed = left;
mapped->buttons[kButtonDpadLeft].value = left ? 1.f : 0.f;
}
} // namespace content
......@@ -24,39 +24,33 @@ GamepadStandardMappingFunction GetGamepadStandardMappingFunction(
// general, err towards leaving it *unmapped* so that content can handle
// appropriately.
// A Java counterpart will be generated for this enum.
// GENERATED_JAVA_ENUM_PACKAGE: org.chromium.content.browser.input
// GENERATED_JAVA_PREFIX_TO_STRIP: BUTTON_INDEX_
enum CanonicalButtonIndex {
BUTTON_INDEX_PRIMARY,
BUTTON_INDEX_SECONDARY,
BUTTON_INDEX_TERTIARY,
BUTTON_INDEX_QUATERNARY,
BUTTON_INDEX_LEFT_SHOULDER,
BUTTON_INDEX_RIGHT_SHOULDER,
BUTTON_INDEX_LEFT_TRIGGER,
BUTTON_INDEX_RIGHT_TRIGGER,
BUTTON_INDEX_BACK_SELECT,
BUTTON_INDEX_START,
BUTTON_INDEX_LEFT_THUMBSTICK,
BUTTON_INDEX_RIGHT_THUMBSTICK,
BUTTON_INDEX_DPAD_UP,
BUTTON_INDEX_DPAD_DOWN,
BUTTON_INDEX_DPAD_LEFT,
BUTTON_INDEX_DPAD_RIGHT,
BUTTON_INDEX_META,
BUTTON_INDEX_COUNT
kButtonPrimary,
kButtonSecondary,
kButtonTertiary,
kButtonQuaternary,
kButtonLeftShoulder,
kButtonRightShoulder,
kButtonLeftTrigger,
kButtonRightTrigger,
kButtonBackSelect,
kButtonStart,
kButtonLeftThumbstick,
kButtonRightThumbstick,
kButtonDpadUp,
kButtonDpadDown,
kButtonDpadLeft,
kButtonDpadRight,
kButtonMeta,
kNumButtons
};
// A Java counterpart will be generated for this enum.
// GENERATED_JAVA_ENUM_PACKAGE: org.chromium.content.browser.input
// GENERATED_JAVA_PREFIX_TO_STRIP: AXIS_INDEX_
enum CanonicalAxisIndex {
AXIS_INDEX_LEFT_STICK_X,
AXIS_INDEX_LEFT_STICK_Y,
AXIS_INDEX_RIGHT_STICK_X,
AXIS_INDEX_RIGHT_STICK_Y,
AXIS_INDEX_COUNT
kAxisLeftStickX,
kAxisLeftStickY,
kAxisRightStickX,
kAxisRightStickY,
kNumAxes
};
// Matches XInput's trigger deadzone
......
......@@ -7,21 +7,10 @@
namespace content {
// This file contains a list of events relating to selection and insertion, used
// for notifying Java when the renderer selection has changed.
//
// A Java counterpart will be generated for this enum.
// GENERATED_JAVA_ENUM_PACKAGE: org.chromium.content.browser.input
enum SelectionEventType {
SELECTION_SHOWN,
SELECTION_CLEARED,
SELECTION_DRAG_STARTED,
SELECTION_DRAG_STOPPED,
INSERTION_SHOWN,
INSERTION_MOVED,
INSERTION_TAPPED,
INSERTION_CLEARED,
INSERTION_DRAG_STARTED,
#define DEFINE_SELECTION_EVENT_TYPE(name, value) name = value,
#include "content/browser/renderer_host/input/selection_event_type_list.h"
#undef DEFINE_SELECTION_EVENT_TYPE
};
} // namespace content
......
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file intentionally does not have header guards because this file
// is meant to be included inside a macro to generate enum values.
// This file contains a list of events relating to selection and insertion, used
// for notifying Java when the renderer selection has changed.
#ifndef DEFINE_SELECTION_EVENT_TYPE
#error "Please define DEFINE_SELECTION_EVENT_TYPE before including this file."
#endif
DEFINE_SELECTION_EVENT_TYPE(SELECTION_SHOWN, 0)
DEFINE_SELECTION_EVENT_TYPE(SELECTION_CLEARED, 1)
DEFINE_SELECTION_EVENT_TYPE(SELECTION_DRAG_STARTED, 2)
DEFINE_SELECTION_EVENT_TYPE(SELECTION_DRAG_STOPPED, 3)
DEFINE_SELECTION_EVENT_TYPE(INSERTION_SHOWN, 4)
DEFINE_SELECTION_EVENT_TYPE(INSERTION_MOVED, 5)
DEFINE_SELECTION_EVENT_TYPE(INSERTION_TAPPED, 6)
DEFINE_SELECTION_EVENT_TYPE(INSERTION_CLEARED, 7)
DEFINE_SELECTION_EVENT_TYPE(INSERTION_DRAG_STARTED, 8)
......@@ -20,23 +20,23 @@ namespace content {
// ScreenOrientationValues
COMPILE_ASSERT_MATCHING_ENUM(blink::WebScreenOrientationLockDefault,
SCREEN_ORIENTATION_VALUES_DEFAULT);
DEFAULT);
COMPILE_ASSERT_MATCHING_ENUM(blink::WebScreenOrientationLockPortraitPrimary,
SCREEN_ORIENTATION_VALUES_PORTRAIT_PRIMARY);
PORTRAIT_PRIMARY);
COMPILE_ASSERT_MATCHING_ENUM(blink::WebScreenOrientationLockPortraitSecondary,
SCREEN_ORIENTATION_VALUES_PORTRAIT_SECONDARY);
PORTRAIT_SECONDARY);
COMPILE_ASSERT_MATCHING_ENUM(blink::WebScreenOrientationLockLandscapePrimary,
SCREEN_ORIENTATION_VALUES_LANDSCAPE_PRIMARY);
LANDSCAPE_PRIMARY);
COMPILE_ASSERT_MATCHING_ENUM(blink::WebScreenOrientationLockLandscapeSecondary,
SCREEN_ORIENTATION_VALUES_LANDSCAPE_SECONDARY);
LANDSCAPE_SECONDARY);
COMPILE_ASSERT_MATCHING_ENUM(blink::WebScreenOrientationLockAny,
SCREEN_ORIENTATION_VALUES_ANY);
ANY);
COMPILE_ASSERT_MATCHING_ENUM(blink::WebScreenOrientationLockLandscape,
SCREEN_ORIENTATION_VALUES_LANDSCAPE);
LANDSCAPE);
COMPILE_ASSERT_MATCHING_ENUM(blink::WebScreenOrientationLockPortrait,
SCREEN_ORIENTATION_VALUES_PORTRAIT);
PORTRAIT);
COMPILE_ASSERT_MATCHING_ENUM(blink::WebScreenOrientationLockNatural,
SCREEN_ORIENTATION_VALUES_NATURAL);
NATURAL);
// SupportsType
COMPILE_ASSERT_MATCHING_ENUM(blink::WebMimeRegistry::IsNotSupported,
......
......@@ -463,69 +463,89 @@
'../build/java_strings_grd.gypi',
],
},
{
'target_name': 'content_gamepad_mapping',
'type': 'none',
'variables': {
'source_file': 'browser/gamepad/gamepad_standard_mappings.h',
},
'includes': [ '../build/android/java_cpp_enum.gypi' ],
},
{
'target_name': 'gesture_event_type_java',
'type': 'none',
'sources': [
'public/android/java/src/org/chromium/content/browser/GestureEventType.template',
],
'variables': {
'source_file': 'browser/android/gesture_event_type.h',
'package_name': 'org/chromium/content/browser',
'template_deps': ['browser/android/gesture_event_type_list.h'],
},
'includes': [ '../build/android/java_cpp_enum.gypi' ],
'includes': [ '../build/android/java_cpp_template.gypi' ],
},
{
'target_name': 'popup_item_type_java',
'type': 'none',
'sources': [
'public/android/java/src/org/chromium/content/browser/input/PopupItemType.template',
],
'variables': {
'source_file': 'browser/android/content_view_core_impl.cc',
'package_name': 'org/chromium/content/browser/input',
'template_deps': ['browser/android/popup_item_type_list.h'],
},
'includes': [ '../build/android/java_cpp_enum.gypi' ],
'includes': [ '../build/android/java_cpp_template.gypi' ],
},
{
'target_name': 'result_codes_java',
'type': 'none',
'sources': [
'public/android/java/src/org/chromium/content/common/ResultCodes.template',
],
'variables': {
'source_file': 'public/common/result_codes.h',
'package_name': 'org/chromium/content/common',
'template_deps': ['public/common/result_codes_list.h'],
},
'includes': [ '../build/android/java_cpp_enum.gypi' ],
'includes': [ '../build/android/java_cpp_template.gypi' ],
},
{
'target_name': 'selection_event_type_java',
'type': 'none',
'sources': [
'public/android/java/src/org/chromium/content/browser/input/SelectionEventType.template',
],
'variables': {
'source_file': 'browser/renderer_host/input/selection_event_type.h',
'package_name': 'org/chromium/content/browser/input',
'template_deps': ['browser/renderer_host/input/selection_event_type_list.h'],
},
'includes': [ '../build/android/java_cpp_enum.gypi' ],
'includes': [ '../build/android/java_cpp_template.gypi' ],
},
{
'target_name': 'speech_recognition_error_java',
'type': 'none',
'sources': [
'public/android/java/src/org/chromium/content/browser/SpeechRecognitionError.template',
],
'variables': {
'source_file': 'public/common/speech_recognition_error.h',
'package_name': 'org/chromium/content/browser',
'template_deps': ['public/common/speech_recognition_error_list.h'],
},
'includes': [ '../build/android/java_cpp_enum.gypi' ],
'includes': [ '../build/android/java_cpp_template.gypi' ],
},
{
'target_name': 'top_controls_state_java',
'type': 'none',
'sources': [
'public/android/java/src/org/chromium/content/common/TopControlsState.template',
],
'variables': {
'source_file': 'public/common/top_controls_state.h',
'package_name': 'org/chromium/content/common',
'template_deps': ['public/common/top_controls_state_list.h'],
},
'includes': [ '../build/android/java_cpp_enum.gypi' ],
'includes': [ '../build/android/java_cpp_template.gypi' ],
},
{
'target_name': 'screen_orientation_values_java',
'type': 'none',
'sources': [
'public/android/java/src/org/chromium/content_public/common/ScreenOrientationValues.template',
],
'variables': {
'source_file': 'public/common/screen_orientation_values.h',
'package_name': 'org/chromium/content_public/common',
'template_deps': ['public/common/screen_orientation_values_list.h'],
},
'includes': [ '../build/android/java_cpp_enum.gypi' ],
'includes': [ '../build/android/java_cpp_template.gypi' ],
},
{
'target_name': 'java_set_jni_headers',
......@@ -570,6 +590,22 @@
}],
],
},
{
'target_name': 'content_gamepad_mapping',
'type': 'none',
'sources': [
'public/android/java/src/org/chromium/content/browser/input/CanonicalButtonIndex.template',
'public/android/java/src/org/chromium/content/browser/input/CanonicalAxisIndex.template',
],
'variables': {
'package_name': 'org/chromium/content/browser/input',
'template_deps': [
'browser/gamepad/canonical_axis_index_list.h',
'browser/gamepad/canonical_button_index_list.h',
],
},
'includes': [ '../build/android/java_cpp_template.gypi' ],
},
],
}], # OS == "android"
],
......
......@@ -42,7 +42,14 @@ android_library("content_java") {
srcjar_deps = [
":common_aidl",
":content_public_android_java_enums_srcjar",
":content_gamepad_mapping_java",
":gesture_event_type_java",
":popup_item_type_java",
":result_codes_java",
":selection_event_type_java",
":speech_recognition_error_java",
":top_controls_state_java",
":screen_orientation_values_java",
]
DEPRECATED_java_in_dir = "java/src"
......@@ -103,27 +110,85 @@ java_strings_grd("content_strings_grd") {
]
}
java_cpp_enum("content_public_android_java_enums_srcjar") {
java_cpp_template("gesture_event_type_java") {
sources = [
"//content/browser/android/content_view_core_impl.cc",
"//content/browser/android/gesture_event_type.h",
"//content/browser/renderer_host/input/selection_event_type.h",
"//content/browser/gamepad/gamepad_standard_mappings.h",
"//content/public/common/result_codes.h",
"//content/public/common/screen_orientation_values.h",
"//content/public/common/speech_recognition_error.h",
"//content/public/common/top_controls_state.h",
"java/src/org/chromium/content/browser/GestureEventType.template",
]
outputs = [
"org/chromium/content/browser/GestureEventType.java",
"org/chromium/content/browser/input/CanonicalAxisIndex.java",
"org/chromium/content/browser/input/CanonicalButtonIndex.java",
"org/chromium/content/browser/input/PopupItemType.java",
"org/chromium/content/browser/input/SelectionEventType.java",
"org/chromium/content_public/common/ResultCode.java",
"org/chromium/content_public/common/ScreenOrientationValues.java",
"org/chromium/content_public/common/SpeechRecognitionErrorCode.java",
"org/chromium/content_public/common/TopControlsState.java",
package_name = "org/chromium/content/browser"
inputs = [
"//content/browser/android/gesture_event_type_list.h"
]
}
java_cpp_template("popup_item_type_java") {
sources = [
"java/src/org/chromium/content/browser/input/PopupItemType.template",
]
package_name = "org/chromium/content/browser/input"
inputs = [
"//content/browser/android/popup_item_type_list.h"
]
}
java_cpp_template("result_codes_java") {
sources = [
"java/src/org/chromium/content/common/ResultCodes.template",
]
package_name = "org/chromium/content/common"
inputs = [
"//content/public/common/result_codes_list.h"
]
}
java_cpp_template("selection_event_type_java") {
sources = [
"java/src/org/chromium/content/browser/input/SelectionEventType.template",
]
package_name = "org/chromium/content/browser/input"
inputs = [
"//content/browser/renderer_host/input/selection_event_type_list.h"
]
}
java_cpp_template("speech_recognition_error_java") {
sources = [
"java/src/org/chromium/content/browser/SpeechRecognitionError.template",
]
package_name = "org/chromium/content/browser"
inputs = [
"//content/public/common/speech_recognition_error_list.h"
]
}
java_cpp_template("top_controls_state_java") {
sources = [
"java/src/org/chromium/content/common/TopControlsState.template",
]
package_name = "org/chromium/content/common"
inputs = [
"//content/public/common/top_controls_state_list.h"
]
}
java_cpp_template("screen_orientation_values_java") {
sources = [
"java/src/org/chromium/content_public/common/ScreenOrientationValues.template",
]
package_name = "org/chromium/content_public/common"
inputs = [
"//content/public/common/screen_orientation_values_list.h"
]
}
java_cpp_template("content_gamepad_mapping_java") {
sources = [
"java/src/org/chromium/content/browser/input/CanonicalAxisIndex.template",
"java/src/org/chromium/content/browser/input/CanonicalButtonIndex.template",
]
package_name = "org/chromium/content/common"
inputs = [
"//content/browser/gamepad/canonical_axis_index_list.h",
"//content/browser/gamepad/canonical_button_index_list.h",
]
}
......
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.content.browser;
public class GestureEventType {
#define DEFINE_GESTURE_EVENT_TYPE(name, value) \
public static final int name = value;
#include "content/browser/android/gesture_event_type_list.h"
#undef DEFINE_GESTURE_EVENT_TYPE
}
......@@ -19,7 +19,6 @@ import android.speech.SpeechRecognizer;
import org.chromium.base.CalledByNative;
import org.chromium.base.JNINamespace;
import org.chromium.content_public.common.SpeechRecognitionErrorCode;
import java.util.ArrayList;
import java.util.List;
......@@ -90,30 +89,30 @@ public class SpeechRecognition {
@Override
public void onError(int error) {
int code = SpeechRecognitionErrorCode.NONE;
int code = SpeechRecognitionError.NONE;
// Translate Android SpeechRecognizer errors to Web Speech API errors.
switch(error) {
case SpeechRecognizer.ERROR_AUDIO:
code = SpeechRecognitionErrorCode.AUDIO;
code = SpeechRecognitionError.AUDIO;
break;
case SpeechRecognizer.ERROR_CLIENT:
code = SpeechRecognitionErrorCode.ABORTED;
code = SpeechRecognitionError.ABORTED;
break;
case SpeechRecognizer.ERROR_RECOGNIZER_BUSY:
case SpeechRecognizer.ERROR_INSUFFICIENT_PERMISSIONS:
code = SpeechRecognitionErrorCode.NOT_ALLOWED;
code = SpeechRecognitionError.NOT_ALLOWED;
break;
case SpeechRecognizer.ERROR_NETWORK_TIMEOUT:
case SpeechRecognizer.ERROR_NETWORK:
case SpeechRecognizer.ERROR_SERVER:
code = SpeechRecognitionErrorCode.NETWORK;
code = SpeechRecognitionError.NETWORK;
break;
case SpeechRecognizer.ERROR_NO_MATCH:
code = SpeechRecognitionErrorCode.NO_MATCH;
code = SpeechRecognitionError.NO_MATCH;
break;
case SpeechRecognizer.ERROR_SPEECH_TIMEOUT:
code = SpeechRecognitionErrorCode.NO_SPEECH;
code = SpeechRecognitionError.NO_SPEECH;
break;
default:
assert false;
......@@ -143,7 +142,7 @@ public class SpeechRecognition {
// We assume that onResults is called only once, at the end of a session, thus we
// terminate. If one day the recognition provider changes dictation mode behavior to
// call onResults several times, we should terminate only if (!mContinuous).
terminate(SpeechRecognitionErrorCode.NONE);
terminate(SpeechRecognitionError.NONE);
}
@Override
......@@ -238,7 +237,7 @@ public class SpeechRecognition {
mState = STATE_IDLE;
}
if (error != SpeechRecognitionErrorCode.NONE)
if (error != SpeechRecognitionError.NONE)
nativeOnRecognitionError(mNativeSpeechRecognizerImplAndroid, error);
mRecognizer.destroy();
......@@ -271,7 +270,7 @@ public class SpeechRecognition {
return;
mRecognizer.cancel();
terminate(SpeechRecognitionErrorCode.ABORTED);
terminate(SpeechRecognitionError.ABORTED);
}
@CalledByNative
......
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.content.browser;
public class SpeechRecognitionError {
#define DEFINE_SPEECH_RECOGNITION_ERROR(x,y) public static final int x = y;
#include "content/public/common/speech_recognition_error_list.h"
#undef DEFINE_SPEECH_RECOGNITION_ERROR
}
......@@ -30,9 +30,9 @@ class GamepadDevice {
// All axis values must be linearly normalized to the range [-1.0 .. 1.0].
// As appropriate, -1.0 should correspond to "up" or "left", and 1.0
// should correspond to "down" or "right".
private final float[] mAxisValues = new float[CanonicalAxisIndex.COUNT];
private final float[] mAxisValues = new float[CanonicalAxisIndex.NUM_CANONICAL_AXES];
private final float[] mButtonsValues = new float[CanonicalButtonIndex.COUNT];;
private final float[] mButtonsValues = new float[CanonicalButtonIndex.NUM_CANONICAL_BUTTONS];;
// When the user agent recognizes the attached inputDevice, it is recommended
// that it be remapped to a canonical ordering when possible. Devices that are
......
......@@ -45,10 +45,10 @@ class GamepadMappings {
float b = rawButtons[KeyEvent.KEYCODE_BUTTON_B];
float x = rawButtons[KeyEvent.KEYCODE_BUTTON_X];
float y = rawButtons[KeyEvent.KEYCODE_BUTTON_Y];
mappedButtons[CanonicalButtonIndex.PRIMARY] = a;
mappedButtons[CanonicalButtonIndex.SECONDARY] = b;
mappedButtons[CanonicalButtonIndex.TERTIARY] = x;
mappedButtons[CanonicalButtonIndex.QUATERNARY] = y;
mappedButtons[CanonicalButtonIndex.BUTTON_PRIMARY] = a;
mappedButtons[CanonicalButtonIndex.BUTTON_SECONDARY] = b;
mappedButtons[CanonicalButtonIndex.BUTTON_TERTIARY] = x;
mappedButtons[CanonicalButtonIndex.BUTTON_QUATERNARY] = y;
}
private static void mapCommonStartSelectMetaButtons(
......@@ -56,23 +56,23 @@ class GamepadMappings {
float start = rawButtons[KeyEvent.KEYCODE_BUTTON_START];
float select = rawButtons[KeyEvent.KEYCODE_BUTTON_SELECT];
float mode = rawButtons[KeyEvent.KEYCODE_BUTTON_MODE];
mappedButtons[CanonicalButtonIndex.START] = start;
mappedButtons[CanonicalButtonIndex.BACK_SELECT] = select;
mappedButtons[CanonicalButtonIndex.META] = mode;
mappedButtons[CanonicalButtonIndex.BUTTON_START] = start;
mappedButtons[CanonicalButtonIndex.BUTTON_BACK_SELECT] = select;
mappedButtons[CanonicalButtonIndex.BUTTON_META] = mode;
}
private static void mapCommonThumbstickButtons(float[] mappedButtons, float[] rawButtons) {
float thumbL = rawButtons[KeyEvent.KEYCODE_BUTTON_THUMBL];
float thumbR = rawButtons[KeyEvent.KEYCODE_BUTTON_THUMBR];
mappedButtons[CanonicalButtonIndex.LEFT_THUMBSTICK] = thumbL;
mappedButtons[CanonicalButtonIndex.RIGHT_THUMBSTICK] = thumbR;
mappedButtons[CanonicalButtonIndex.BUTTON_LEFT_THUMBSTICK] = thumbL;
mappedButtons[CanonicalButtonIndex.BUTTON_RIGHT_THUMBSTICK] = thumbR;
}
private static void mapCommonTriggerButtons(float[] mappedButtons, float[] rawButtons) {
float l1 = rawButtons[KeyEvent.KEYCODE_BUTTON_L1];
float r1 = rawButtons[KeyEvent.KEYCODE_BUTTON_R1];
mappedButtons[CanonicalButtonIndex.LEFT_TRIGGER] = l1;
mappedButtons[CanonicalButtonIndex.RIGHT_TRIGGER] = r1;
mappedButtons[CanonicalButtonIndex.BUTTON_LEFT_TRIGGER] = l1;
mappedButtons[CanonicalButtonIndex.BUTTON_RIGHT_TRIGGER] = r1;
}
private static void mapCommonDpadButtons(float[] mappedButtons, float[] rawButtons) {
......@@ -80,32 +80,32 @@ class GamepadMappings {
float dpadUp = rawButtons[KeyEvent.KEYCODE_DPAD_UP];
float dpadLeft = rawButtons[KeyEvent.KEYCODE_DPAD_LEFT];
float dpadRight = rawButtons[KeyEvent.KEYCODE_DPAD_RIGHT];
mappedButtons[CanonicalButtonIndex.DPAD_DOWN] = dpadDown;
mappedButtons[CanonicalButtonIndex.DPAD_UP] = dpadUp;
mappedButtons[CanonicalButtonIndex.DPAD_LEFT] = dpadLeft;
mappedButtons[CanonicalButtonIndex.DPAD_RIGHT] = dpadRight;
mappedButtons[CanonicalButtonIndex.BUTTON_DPAD_DOWN] = dpadDown;
mappedButtons[CanonicalButtonIndex.BUTTON_DPAD_UP] = dpadUp;
mappedButtons[CanonicalButtonIndex.BUTTON_DPAD_LEFT] = dpadLeft;
mappedButtons[CanonicalButtonIndex.BUTTON_DPAD_RIGHT] = dpadRight;
}
private static void mapXYAxes(float[] mappedAxes, float[] rawAxes) {
mappedAxes[CanonicalAxisIndex.LEFT_STICK_X] = rawAxes[MotionEvent.AXIS_X];
mappedAxes[CanonicalAxisIndex.LEFT_STICK_Y] = rawAxes[MotionEvent.AXIS_Y];
mappedAxes[CanonicalAxisIndex.AXIS_LEFT_STICK_X] = rawAxes[MotionEvent.AXIS_X];
mappedAxes[CanonicalAxisIndex.AXIS_LEFT_STICK_Y] = rawAxes[MotionEvent.AXIS_Y];
}
private static void mapRXAndRYAxesToRightStick(float[] mappedAxes, float[] rawAxes) {
mappedAxes[CanonicalAxisIndex.RIGHT_STICK_X] = rawAxes[MotionEvent.AXIS_RX];
mappedAxes[CanonicalAxisIndex.RIGHT_STICK_Y] = rawAxes[MotionEvent.AXIS_RY];
mappedAxes[CanonicalAxisIndex.AXIS_RIGHT_STICK_X] = rawAxes[MotionEvent.AXIS_RX];
mappedAxes[CanonicalAxisIndex.AXIS_RIGHT_STICK_Y] = rawAxes[MotionEvent.AXIS_RY];
}
private static void mapZAndRZAxesToRightStick(float[] mappedAxes, float[] rawAxes) {
mappedAxes[CanonicalAxisIndex.RIGHT_STICK_X] = rawAxes[MotionEvent.AXIS_Z];
mappedAxes[CanonicalAxisIndex.RIGHT_STICK_Y] = rawAxes[MotionEvent.AXIS_RZ];
mappedAxes[CanonicalAxisIndex.AXIS_RIGHT_STICK_X] = rawAxes[MotionEvent.AXIS_Z];
mappedAxes[CanonicalAxisIndex.AXIS_RIGHT_STICK_Y] = rawAxes[MotionEvent.AXIS_RZ];
}
private static void mapTriggerAxexToShoulderButtons(float[] mappedButtons, float[] rawAxes) {
float lTrigger = rawAxes[MotionEvent.AXIS_LTRIGGER];
float rTrigger = rawAxes[MotionEvent.AXIS_RTRIGGER];
mappedButtons[CanonicalButtonIndex.LEFT_SHOULDER] = lTrigger;
mappedButtons[CanonicalButtonIndex.RIGHT_SHOULDER] = rTrigger;
mappedButtons[CanonicalButtonIndex.BUTTON_LEFT_SHOULDER] = lTrigger;
mappedButtons[CanonicalButtonIndex.BUTTON_RIGHT_SHOULDER] = rTrigger;
}
private static float negativeAxisValueAsButton(float input) {
......@@ -119,10 +119,10 @@ class GamepadMappings {
private static void mapHatAxisToDpadButtons(float[] mappedButtons, float[] rawAxes) {
float hatX = rawAxes[MotionEvent.AXIS_HAT_X];
float hatY = rawAxes[MotionEvent.AXIS_HAT_Y];
mappedButtons[CanonicalButtonIndex.DPAD_LEFT] = negativeAxisValueAsButton(hatX);
mappedButtons[CanonicalButtonIndex.DPAD_RIGHT] = positiveAxisValueAsButton(hatX);
mappedButtons[CanonicalButtonIndex.DPAD_UP] = negativeAxisValueAsButton(hatY);
mappedButtons[CanonicalButtonIndex.DPAD_DOWN] = positiveAxisValueAsButton(hatY);
mappedButtons[CanonicalButtonIndex.BUTTON_DPAD_LEFT] = negativeAxisValueAsButton(hatX);
mappedButtons[CanonicalButtonIndex.BUTTON_DPAD_RIGHT] = positiveAxisValueAsButton(hatX);
mappedButtons[CanonicalButtonIndex.BUTTON_DPAD_UP] = negativeAxisValueAsButton(hatY);
mappedButtons[CanonicalButtonIndex.BUTTON_DPAD_DOWN] = positiveAxisValueAsButton(hatY);
}
/**
......@@ -159,10 +159,10 @@ class GamepadMappings {
float b = rawButtons[KeyEvent.KEYCODE_BUTTON_B];
float x = rawButtons[KeyEvent.KEYCODE_BUTTON_X];
float y = rawButtons[KeyEvent.KEYCODE_BUTTON_Y];
mappedButtons[CanonicalButtonIndex.PRIMARY] = x;
mappedButtons[CanonicalButtonIndex.SECONDARY] = y;
mappedButtons[CanonicalButtonIndex.TERTIARY] = a;
mappedButtons[CanonicalButtonIndex.QUATERNARY] = b;
mappedButtons[CanonicalButtonIndex.BUTTON_PRIMARY] = x;
mappedButtons[CanonicalButtonIndex.BUTTON_SECONDARY] = y;
mappedButtons[CanonicalButtonIndex.BUTTON_TERTIARY] = a;
mappedButtons[CanonicalButtonIndex.BUTTON_QUATERNARY] = b;
mapCommonTriggerButtons(mappedButtons, rawButtons);
mapCommonThumbstickButtons(mappedButtons, rawButtons);
......
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.content.browser.input;
public class SelectionEventType {
#define DEFINE_SELECTION_EVENT_TYPE(name, value) \
public static final int name = value;
#include "content/browser/renderer_host/input/selection_event_type_list.h"
#undef DEFINE_SELECTION_EVENT_TYPE
}
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.content.common;
public class ResultCodes {
#define RESULT_CODE(label, value) public static final int \
RESULT_CODE_ ## label = value;
#include "content/public/common/result_codes_list.h"
#undef RESULT_CODE
}
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.content.common;
public class TopControlsState {
#define DEFINE_TOP_CONTROLS_STATE(name, value) public static final int name = value;
#include "content/public/common/top_controls_state_list.h"
#undef DEFINE_TOP_CONTROLS_STATE
}
......@@ -7,30 +7,11 @@
namespace content {
// This file consolidates all the return codes for the browser and renderer
// process. The return code is the value that:
// a) is returned by main() or winmain(), or
// b) specified in the call for ExitProcess() or TerminateProcess(), or
// c) the exception value that causes a process to terminate.
//
// It is advisable to not use negative numbers because the Windows API returns
// it as an unsigned long and the exception values have high numbers. For
// example EXCEPTION_ACCESS_VIOLATION value is 0xC0000005.
//
// A Java counterpart will be generated for this enum.
// GENERATED_JAVA_ENUM_PACKAGE: org.chromium.content_public.common
enum ResultCode {
// Process terminated normally.
RESULT_CODE_NORMAL_EXIT,
// Process was killed by user or system.
RESULT_CODE_KILLED,
// Process hung.
RESULT_CODE_HUNG,
// A bad message caused the process termination.
RESULT_CODE_KILLED_BAD_MESSAGE,
#define RESULT_CODE(label, value) RESULT_CODE_ ## label = value,
#include "content/public/common/result_codes_list.h"
#undef RESULT_CODE
// Last return code (keep this last).
RESULT_CODE_LAST_CODE
......
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Intentionally no include guards because this file is meant to be included
// inside a macro to generate enum values.
// This file consolidates all the return codes for the browser and renderer
// process. The return code is the value that:
// a) is returned by main() or winmain(), or
// b) specified in the call for ExitProcess() or TerminateProcess(), or
// c) the exception value that causes a process to terminate.
//
// It is advisable to not use negative numbers because the Windows API returns
// it as an unsigned long and the exception values have high numbers. For
// example EXCEPTION_ACCESS_VIOLATION value is 0xC0000005.
#include "build/build_config.h"
// Process terminated normally.
RESULT_CODE(NORMAL_EXIT, 0)
// Process was killed by user or system.
RESULT_CODE(KILLED, 1)
// Process hung.
RESULT_CODE(HUNG, 2)
// A bad message caused the process termination.
RESULT_CODE(KILLED_BAD_MESSAGE, 3)
......@@ -7,18 +7,10 @@
namespace content {
// A Java counterpart will be generated for this enum.
// GENERATED_JAVA_ENUM_PACKAGE: org.chromium.content_public.common
enum ScreenOrientationValues {
SCREEN_ORIENTATION_VALUES_DEFAULT,
SCREEN_ORIENTATION_VALUES_PORTRAIT_PRIMARY,
SCREEN_ORIENTATION_VALUES_PORTRAIT_SECONDARY,
SCREEN_ORIENTATION_VALUES_LANDSCAPE_PRIMARY,
SCREEN_ORIENTATION_VALUES_LANDSCAPE_SECONDARY,
SCREEN_ORIENTATION_VALUES_ANY,
SCREEN_ORIENTATION_VALUES_LANDSCAPE,
SCREEN_ORIENTATION_VALUES_PORTRAIT,
SCREEN_ORIENTATION_VALUES_NATURAL,
#define DEFINE_SCREEN_ORIENTATION_VALUE(name, value) name = value,
#include "content/public/common/screen_orientation_values_list.h"
#undef DEFINE_SCREEN_ORIENTATION_VALUE
};
} // namespace content
......
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_PUBLIC_COMMON_SCREEN_ORIENTATION_VALUES_LIST_H_
#define CONTENT_PUBLIC_COMMON_SCREEN_ORIENTATION_VALUES_LIST_H_
#ifndef DEFINE_SCREEN_ORIENTATION_VALUE
#error "DEFINE_SCREEN_ORIENTATION_VALUE should be defined before including this"
#endif
// These values are defined with macros so that a Java class can be generated
// for them.
DEFINE_SCREEN_ORIENTATION_VALUE(DEFAULT, 0)
DEFINE_SCREEN_ORIENTATION_VALUE(PORTRAIT_PRIMARY, 1)
DEFINE_SCREEN_ORIENTATION_VALUE(PORTRAIT_SECONDARY, 2)
DEFINE_SCREEN_ORIENTATION_VALUE(LANDSCAPE_PRIMARY, 3)
DEFINE_SCREEN_ORIENTATION_VALUE(LANDSCAPE_SECONDARY, 4)
DEFINE_SCREEN_ORIENTATION_VALUE(ANY, 5)
DEFINE_SCREEN_ORIENTATION_VALUE(LANDSCAPE, 6)
DEFINE_SCREEN_ORIENTATION_VALUE(PORTRAIT, 7)
DEFINE_SCREEN_ORIENTATION_VALUE(NATURAL, 8)
#endif // CONTENT_PUBLIC_COMMON_SCREEN_ORIENTATION_VALUES_LIST_H_
......@@ -7,34 +7,10 @@
namespace content {
// A Java counterpart will be generated for this enum.
// GENERATED_JAVA_ENUM_PACKAGE: org.chromium.content_public.common
// GENERATED_JAVA_PREFIX_TO_STRIP: SPEECH_RECOGNITION_ERROR_
enum SpeechRecognitionErrorCode {
// There was no error.
SPEECH_RECOGNITION_ERROR_NONE,
// The user or a script aborted speech input.
SPEECH_RECOGNITION_ERROR_ABORTED,
// There was an error with recording audio.
SPEECH_RECOGNITION_ERROR_AUDIO,
// There was a network error.
SPEECH_RECOGNITION_ERROR_NETWORK,
// Not allowed for privacy or security reasons.
SPEECH_RECOGNITION_ERROR_NOT_ALLOWED,
// No speech heard before timeout.
SPEECH_RECOGNITION_ERROR_NO_SPEECH,
// Speech was heard, but could not be interpreted.
SPEECH_RECOGNITION_ERROR_NO_MATCH,
// There was an error in the speech recognition grammar.
SPEECH_RECOGNITION_ERROR_BAD_GRAMMAR,
SPEECH_RECOGNITION_ERROR_LAST = SPEECH_RECOGNITION_ERROR_BAD_GRAMMAR,
#define DEFINE_SPEECH_RECOGNITION_ERROR(x, y) SPEECH_RECOGNITION_ERROR_##x = y,
#include "content/public/common/speech_recognition_error_list.h"
#undef DEFINE_SPEECH_RECOGNITION_ERROR
};
// Error details for the SPEECH_RECOGNITION_ERROR_AUDIO error.
......
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file intentionally does not have header guards, it's included
// inside a macro to generate enum values.
#ifndef DEFINE_SPEECH_RECOGNITION_ERROR
#error "DEFINE_SPEECH_RECOGNITION_ERROR must be defined before including this."
#endif
// There was no error.
DEFINE_SPEECH_RECOGNITION_ERROR(NONE, 0)
// The user or a script aborted speech input.
DEFINE_SPEECH_RECOGNITION_ERROR(ABORTED, 1)
// There was an error with recording audio.
DEFINE_SPEECH_RECOGNITION_ERROR(AUDIO, 2)
// There was a network error.
DEFINE_SPEECH_RECOGNITION_ERROR(NETWORK, 3)
// Not allowed for privacy or security reasons.
DEFINE_SPEECH_RECOGNITION_ERROR(NOT_ALLOWED, 4)
// No speech heard before timeout.
DEFINE_SPEECH_RECOGNITION_ERROR(NO_SPEECH, 5)
// Speech was heard, but could not be interpreted.
DEFINE_SPEECH_RECOGNITION_ERROR(NO_MATCH, 6)
// There was an error in the speech recognition grammar.
DEFINE_SPEECH_RECOGNITION_ERROR(BAD_GRAMMAR, 7)
// Reports the highest value. Update when adding a new error code.
DEFINE_SPEECH_RECOGNITION_ERROR(LAST, 7)
......@@ -7,12 +7,10 @@
namespace content {
// A Java counterpart will be generated for this enum.
// GENERATED_JAVA_ENUM_PACKAGE: org.chromium.content_public.common
enum TopControlsState {
TOP_CONTROLS_STATE_SHOWN = 1,
TOP_CONTROLS_STATE_HIDDEN = 2,
TOP_CONTROLS_STATE_BOTH = 3,
#define DEFINE_TOP_CONTROLS_STATE(name, value) name = value,
#include "content/public/common/top_controls_state_list.h"
#undef DEFINE_TOP_CONTROLS_STATE
};
} // namespace content
......
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_PUBLIC_COMMON_TOP_CONTROLS_STATE_LIST_H_
#define CONTENT_PUBLIC_COMMON_TOP_CONTROLS_STATE_LIST_H_
#ifndef DEFINE_TOP_CONTROLS_STATE
#error "DEFINE_TOP_CONTROLS_STATE should be defined before including this file"
#endif
// These values are defined with macros so that a Java class can be generated
// for them.
DEFINE_TOP_CONTROLS_STATE(SHOWN, 1)
DEFINE_TOP_CONTROLS_STATE(HIDDEN, 2)
DEFINE_TOP_CONTROLS_STATE(BOTH, 3)
#endif // CONTENT_PUBLIC_COMMON_TOP_CONTROLS_STATE_LIST_H_
......@@ -14,12 +14,9 @@
namespace content {
// Check content::TopControlsState and cc::TopControlsState are kept in sync.
COMPILE_ASSERT(int(TOP_CONTROLS_STATE_SHOWN) == int(cc::SHOWN),
mismatching_enums);
COMPILE_ASSERT(int(TOP_CONTROLS_STATE_HIDDEN) == int(cc::HIDDEN),
mismatching_enums);
COMPILE_ASSERT(int(TOP_CONTROLS_STATE_BOTH) == int(cc::BOTH),
mismatching_enums);
COMPILE_ASSERT(int(SHOWN) == int(cc::SHOWN), mismatching_enums);
COMPILE_ASSERT(int(HIDDEN) == int(cc::HIDDEN), mismatching_enums);
COMPILE_ASSERT(int(BOTH) == int(cc::BOTH), mismatching_enums);
cc::TopControlsState ContentToCcTopControlsState(
TopControlsState state) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment