Chromium Code Reviews| Index: third_party/WebKit/public/web/WindowFeaturesStructTraits.h |
| diff --git a/third_party/WebKit/public/web/WindowFeaturesStructTraits.h b/third_party/WebKit/public/web/WindowFeaturesStructTraits.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0209ba6486fed8208cd10a1e0733cc482ed2d442 |
| --- /dev/null |
| +++ b/third_party/WebKit/public/web/WindowFeaturesStructTraits.h |
| @@ -0,0 +1,58 @@ |
| +// Copyright 2016 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 WindowFeaturesStructTraits_h |
| +#define WindowFeaturesStructTraits_h |
| + |
| +#include "WebWindowFeatures.h" |
| +#include "mojo/public/cpp/bindings/struct_traits.h" |
| + |
| +namespace mojo { |
| + |
| +template <typename MojomDataViewType> |
| +struct StructTraits<MojomDataViewType, ::blink::WebWindowFeatures> { |
|
dcheng
2016/09/27 23:09:42
How come we can't fully specialize this one?
Ken Rockot(use gerrit already)
2016/09/28 00:20:05
We can, but Chromium and Blink cannot share genera
dcheng
2016/09/28 00:30:51
I'm going to need to think about this, but I thoug
Ken Rockot(use gerrit already)
2016/09/28 01:15:24
Indeed this was exactly the point of that work! Do
|
| + static float x(const ::blink::WebWindowFeatures& features) { return features.x; } |
| + static bool has_x(const ::blink::WebWindowFeatures& features) { return features.xSet; } |
| + static float y(const ::blink::WebWindowFeatures& features) { return features.y; } |
| + static bool has_y(const ::blink::WebWindowFeatures& features) { return features.ySet; } |
| + static float width(const ::blink::WebWindowFeatures& features) { return features.width; } |
| + static bool has_width(const ::blink::WebWindowFeatures& features) { return features.widthSet; } |
| + static float height(const ::blink::WebWindowFeatures& features) { return features.height; } |
| + static bool has_height(const ::blink::WebWindowFeatures& features) { return features.heightSet; } |
| + |
| + static bool menu_bar_visible(const ::blink::WebWindowFeatures& features) { return features.menuBarVisible; } |
| + static bool status_bar_visible(const ::blink::WebWindowFeatures& features) { return features.statusBarVisible; } |
| + static bool tool_bar_visible(const ::blink::WebWindowFeatures& features) { return features.toolBarVisible; } |
| + static bool location_bar_visible(const ::blink::WebWindowFeatures& features) { return features.locationBarVisible; } |
| + static bool scrollbars_visible(const ::blink::WebWindowFeatures& features) { return features.scrollbarsVisible; } |
| + static bool resizable(const ::blink::WebWindowFeatures& features) { return features.resizable; } |
| + |
| + static bool fullscreen(const ::blink::WebWindowFeatures& features) { return features.fullscreen; } |
| + static bool dialog(const ::blink::WebWindowFeatures& features) { return features.dialog; } |
| + |
| + static bool Read(MojomDataViewType data, ::blink::WebWindowFeatures* out) |
| + { |
| + out->x = data.x(); |
|
dcheng
2016/09/27 23:09:42
Nit: out-of-line
Also, I think the Read() portion
Ken Rockot(use gerrit already)
2016/09/28 00:20:05
Can't move it out-of-line unless we fully speciali
|
| + out->xSet = data.has_x(); |
| + out->y = data.y(); |
| + out->ySet = data.has_y(); |
| + out->width = data.width(); |
| + out->widthSet = data.has_width(); |
| + out->height = data.height(); |
| + out->heightSet = data.has_height(); |
| + out->menuBarVisible = data.menu_bar_visible(); |
| + out->statusBarVisible = data.status_bar_visible(); |
| + out->toolBarVisible = data.tool_bar_visible(); |
| + out->locationBarVisible = data.location_bar_visible(); |
| + out->scrollbarsVisible = data.scrollbars_visible(); |
| + out->resizable = data.resizable(); |
| + out->fullscreen = data.fullscreen(); |
| + out->dialog = data.dialog(); |
| + return true; |
| + } |
| +}; |
| + |
| +} // namespace mojo |
| + |
| +#endif |