Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef WindowFeaturesStructTraits_h | |
| 6 #define WindowFeaturesStructTraits_h | |
| 7 | |
| 8 #include "WebWindowFeatures.h" | |
| 9 #include "mojo/public/cpp/bindings/struct_traits.h" | |
| 10 | |
| 11 namespace mojo { | |
| 12 | |
| 13 template <typename MojomDataViewType> | |
| 14 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
| |
| 15 static float x(const ::blink::WebWindowFeatures& features) { return features .x; } | |
| 16 static bool has_x(const ::blink::WebWindowFeatures& features) { return featu res.xSet; } | |
| 17 static float y(const ::blink::WebWindowFeatures& features) { return features .y; } | |
| 18 static bool has_y(const ::blink::WebWindowFeatures& features) { return featu res.ySet; } | |
| 19 static float width(const ::blink::WebWindowFeatures& features) { return feat ures.width; } | |
| 20 static bool has_width(const ::blink::WebWindowFeatures& features) { return f eatures.widthSet; } | |
| 21 static float height(const ::blink::WebWindowFeatures& features) { return fea tures.height; } | |
| 22 static bool has_height(const ::blink::WebWindowFeatures& features) { return features.heightSet; } | |
| 23 | |
| 24 static bool menu_bar_visible(const ::blink::WebWindowFeatures& features) { r eturn features.menuBarVisible; } | |
| 25 static bool status_bar_visible(const ::blink::WebWindowFeatures& features) { return features.statusBarVisible; } | |
| 26 static bool tool_bar_visible(const ::blink::WebWindowFeatures& features) { r eturn features.toolBarVisible; } | |
| 27 static bool location_bar_visible(const ::blink::WebWindowFeatures& features) { return features.locationBarVisible; } | |
| 28 static bool scrollbars_visible(const ::blink::WebWindowFeatures& features) { return features.scrollbarsVisible; } | |
| 29 static bool resizable(const ::blink::WebWindowFeatures& features) { return f eatures.resizable; } | |
| 30 | |
| 31 static bool fullscreen(const ::blink::WebWindowFeatures& features) { return features.fullscreen; } | |
| 32 static bool dialog(const ::blink::WebWindowFeatures& features) { return feat ures.dialog; } | |
| 33 | |
| 34 static bool Read(MojomDataViewType data, ::blink::WebWindowFeatures* out) | |
| 35 { | |
| 36 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
| |
| 37 out->xSet = data.has_x(); | |
| 38 out->y = data.y(); | |
| 39 out->ySet = data.has_y(); | |
| 40 out->width = data.width(); | |
| 41 out->widthSet = data.has_width(); | |
| 42 out->height = data.height(); | |
| 43 out->heightSet = data.has_height(); | |
| 44 out->menuBarVisible = data.menu_bar_visible(); | |
| 45 out->statusBarVisible = data.status_bar_visible(); | |
| 46 out->toolBarVisible = data.tool_bar_visible(); | |
| 47 out->locationBarVisible = data.location_bar_visible(); | |
| 48 out->scrollbarsVisible = data.scrollbars_visible(); | |
| 49 out->resizable = data.resizable(); | |
| 50 out->fullscreen = data.fullscreen(); | |
| 51 out->dialog = data.dialog(); | |
| 52 return true; | |
| 53 } | |
| 54 }; | |
| 55 | |
| 56 } // namespace mojo | |
| 57 | |
| 58 #endif | |
| OLD | NEW |