2014-10-31 11:17:05 -07:00
|
|
|
// Copyright (c) 2014 GitHub, Inc.
|
2014-08-05 00:00:39 +08:00
|
|
|
// Use of this source code is governed by the MIT license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2019-10-25 22:03:28 +09:00
|
|
|
#include "shell/common/gin_converters/accelerator_converter.h"
|
2014-08-05 00:00:39 +08:00
|
|
|
|
2014-08-05 08:46:06 +08:00
|
|
|
#include <string>
|
|
|
|
|
2019-06-19 13:46:59 -07:00
|
|
|
#include "shell/browser/ui/accelerator_util.h"
|
2014-08-05 00:00:39 +08:00
|
|
|
|
2019-10-25 22:03:28 +09:00
|
|
|
namespace gin {
|
2014-08-05 00:00:39 +08:00
|
|
|
|
|
|
|
// static
|
2018-04-17 21:55:30 -04:00
|
|
|
bool Converter<ui::Accelerator>::FromV8(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Value> val,
|
|
|
|
ui::Accelerator* out) {
|
2014-08-05 00:00:39 +08:00
|
|
|
std::string keycode;
|
|
|
|
if (!ConvertFromV8(isolate, val, &keycode))
|
|
|
|
return false;
|
|
|
|
return accelerator_util::StringToAccelerator(keycode, out);
|
|
|
|
}
|
|
|
|
|
2019-10-25 22:03:28 +09:00
|
|
|
} // namespace gin
|