2014-10-31 18:17:05 +00:00
|
|
|
// Copyright (c) 2014 GitHub, Inc.
|
2014-08-04 16:00:39 +00:00
|
|
|
// Use of this source code is governed by the MIT license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
#include "atom/common/native_mate_converters/accelerator_converter.h"
|
|
|
|
|
2014-08-05 00:46:06 +00:00
|
|
|
#include <string>
|
|
|
|
|
2014-08-04 16:00:39 +00:00
|
|
|
#include "atom/browser/ui/accelerator_util.h"
|
|
|
|
|
|
|
|
namespace mate {
|
|
|
|
|
|
|
|
// static
|
|
|
|
bool Converter<ui::Accelerator>::FromV8(
|
|
|
|
v8::Isolate* isolate, v8::Handle<v8::Value> val, ui::Accelerator* out) {
|
|
|
|
std::string keycode;
|
|
|
|
if (!ConvertFromV8(isolate, val, &keycode))
|
|
|
|
return false;
|
|
|
|
return accelerator_util::StringToAccelerator(keycode, out);
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace mate
|