Skip to content

Commit

Permalink
[WebMIDI] Add "use-android-midi-api" flag for Android M+ devices.
Browse files Browse the repository at this point in the history
For experimental support for Android Midi API which is introduced in Android M,
this CL adds a chrome flag.

BUG=486584

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

Cr-Commit-Position: refs/heads/master@{#349360}
  • Loading branch information
yutakahirano authored and Commit bot committed Sep 17, 2015
1 parent fffc75b commit bbea627
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 1 deletion.
8 changes: 7 additions & 1 deletion chrome/app/generated_resources.grd
Original file line number Diff line number Diff line change
Expand Up @@ -15407,7 +15407,13 @@ After you create a new supervised user, you can manage their settings at any tim
<message name="IDS_FLAGS_NTP_POPULAR_SITES_DESCRIPTION" desc="Description for the flag to enable showing non-personalized popular suggestions on the New Tab Page, when no personal suggestions are available yet.">
Pre-populate the New Tab page with popular sites.
</message>
</if>
<message name="IDS_FLAGS_USE_ANDROID_MIDI_API_NAME" desc="Name for the flag to use android midi api.">
Use Android Midi API
</message>
<message name="IDS_FLAGS_USE_ANDROID_MIDI_API_DESCRIPTION" desc="Description for the flag to use android midi api.">
Use Android Midi API for WebMIDI (effective only with Android M+ devices).
</message>
</if>

<if expr="is_win">
<!-- Exporting tracing events to ETW -->
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ source_set("browser") {
"//components/web_modal",
"//content/app/resources",
"//media",
"//media/midi",
"//mojo/application/public/cpp",
"//mojo/common",
"//mojo/environment:chromium",
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ include_rules = [
"+jni",
"+media/audio", # For media audio hang monitor.
"+media/base", # For media switches
"+media/midi", # For midi switches
"+mojo/application/public/cpp",
"+policy", # For generated headers and source
"+ppapi/c", # For various types.
Expand Down
6 changes: 6 additions & 0 deletions chrome/browser/about_flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "components/version_info/version_info.h"
#include "content/public/browser/user_metrics.h"
#include "media/base/media_switches.h"
#include "media/midi/midi_switches.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/ui_base_switches.h"
#include "ui/display/display_switches.h"
Expand Down Expand Up @@ -2020,6 +2021,11 @@ const Experiment kExperiments[] = {
kOsAndroid,
ENABLE_DISABLE_VALUE_TYPE(switches::kEnableNTPPopularSites,
switches::kDisableNTPPopularSites)},
{"use-android-midi-api",
IDS_FLAGS_USE_ANDROID_MIDI_API_NAME,
IDS_FLAGS_USE_ANDROID_MIDI_API_DESCRIPTION,
kOsAndroid,
SINGLE_VALUE_TYPE(switches::kUseAndroidMidiApi)},
#endif // defined(OS_ANDROID)
#if defined(OS_WIN)
{"trace-export-events-to-etw",
Expand Down
1 change: 1 addition & 0 deletions chrome/chrome_browser.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -3269,6 +3269,7 @@
'../content/app/resources/content_resources.gyp:content_resources',
'../gpu/gpu.gyp:gpu',
'../media/media.gyp:media',
'../media/midi/midi.gyp:midi',
'../media/mojo/interfaces/mojo_bindings.gyp:platform_verification_api',
'../mojo/mojo_base.gyp:mojo_application_base',
'../mojo/mojo_base.gyp:mojo_common_lib',
Expand Down
2 changes: 2 additions & 0 deletions media/midi/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ component("midi") {
"midi_port_info.h",
"midi_scheduler.cc",
"midi_scheduler.h",
"midi_switches.cc",
"midi_switches.h",
]

configs += [ ":midi_config" ]
Expand Down
2 changes: 2 additions & 0 deletions media/midi/midi.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
'midi_port_info.h',
'midi_scheduler.cc',
'midi_scheduler.h',
'midi_switches.cc',
'midi_switches.h',
'usb_midi_device_android.cc',
'usb_midi_device_android.h',
'usb_midi_device_factory_android.cc',
Expand Down
14 changes: 14 additions & 0 deletions media/midi/midi_switches.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright 2015 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.

#include "media/midi/midi_switches.h"

namespace switches {

#if defined(OS_ANDROID)
// Use Android Midi API for WebMIDI
const char kUseAndroidMidiApi[] = "use-android-midi-api";
#endif

} // namespace switches
21 changes: 21 additions & 0 deletions media/midi/midi_switches.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright 2015 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.

// Defines all the "midi" command-line switches.

#ifndef MEDIA_MIDI_MIDI_SWITCHES_H_
#define MEDIA_MIDI_MIDI_SWITCHES_H_

#include "build/build_config.h"
#include "media/midi/midi_export.h"

namespace switches {

#if defined(OS_ANDROID)
MIDI_EXPORT extern const char kUseAndroidMidiApi[];
#endif

} // namespace switches

#endif // MEDIA_MIDI_MIDI_SWITCHES_H_
1 change: 1 addition & 0 deletions tools/metrics/histograms/histograms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64642,6 +64642,7 @@ To add a new entry, add it with any value and run test to compute valid value.
<int value="1668611601" label="enable-encrypted-media"/>
<int value="1694854500" label="disable-save-password-bubble"/>
<int value="1696139514" label="enable-ble-advertising-in-apps"/>
<int value="1705724232" label="use-android-midi-api"/>
<int value="1723601083" label="enable-app-window-controls"/>
<int value="1730236697" label="force-device-scale-factor"/>
<int value="1731522433" label="enable-offer-store-unmasked-wallet-cards"/>
Expand Down

0 comments on commit bbea627

Please sign in to comment.