Home | History | Annotate | Download | only in web
      1 /*
      2  * Copyright (C) 2010 Google Inc. All rights reserved.
      3  *
      4  * Redistribution and use in source and binary forms, with or without
      5  * modification, are permitted provided that the following conditions are
      6  * met:
      7  *
      8  *     * Redistributions of source code must retain the above copyright
      9  * notice, this list of conditions and the following disclaimer.
     10  *     * Redistributions in binary form must reproduce the above
     11  * copyright notice, this list of conditions and the following disclaimer
     12  * in the documentation and/or other materials provided with the
     13  * distribution.
     14  *     * Neither the name of Google Inc. nor the names of its
     15  * contributors may be used to endorse or promote products derived from
     16  * this software without specific prior written permission.
     17  *
     18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     21  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     22  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     23  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     24  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     29  */
     30 
     31 #ifndef WebWindowFeatures_h
     32 #define WebWindowFeatures_h
     33 
     34 #include "../platform/WebCommon.h"
     35 #include "../platform/WebString.h"
     36 #include "../platform/WebVector.h"
     37 
     38 #if WEBKIT_IMPLEMENTATION
     39 #include "core/page/WindowFeatures.h"
     40 #endif
     41 
     42 namespace WebKit {
     43 
     44 struct WebWindowFeatures {
     45     float x;
     46     bool xSet;
     47     float y;
     48     bool ySet;
     49     float width;
     50     bool widthSet;
     51     float height;
     52     bool heightSet;
     53 
     54     bool menuBarVisible;
     55     bool statusBarVisible;
     56     bool toolBarVisible;
     57     bool locationBarVisible;
     58     bool scrollbarsVisible;
     59     bool resizable;
     60 
     61     bool fullscreen;
     62     bool dialog;
     63     WebVector<WebString> additionalFeatures;
     64 
     65     WebWindowFeatures()
     66         : xSet(false)
     67         , ySet(false)
     68         , widthSet(false)
     69         , heightSet(false)
     70         , menuBarVisible(true)
     71         , statusBarVisible(true)
     72         , toolBarVisible(true)
     73         , locationBarVisible(true)
     74         , scrollbarsVisible(true)
     75         , resizable(true)
     76         , fullscreen(false)
     77         , dialog(false)
     78     {
     79     }
     80 
     81 
     82 #if WEBKIT_IMPLEMENTATION
     83     WebWindowFeatures(const WebCore::WindowFeatures& f)
     84         : x(f.x)
     85         , xSet(f.xSet)
     86         , y(f.y)
     87         , ySet(f.ySet)
     88         , width(f.width)
     89         , widthSet(f.widthSet)
     90         , height(f.height)
     91         , heightSet(f.heightSet)
     92         , menuBarVisible(f.menuBarVisible)
     93         , statusBarVisible(f.statusBarVisible)
     94         , toolBarVisible(f.toolBarVisible)
     95         , locationBarVisible(f.locationBarVisible)
     96         , scrollbarsVisible(f.scrollbarsVisible)
     97         , resizable(f.resizable)
     98         , fullscreen(f.fullscreen)
     99         , dialog(f.dialog)
    100         , additionalFeatures(f.additionalFeatures)
    101     {
    102     }
    103 
    104     operator WebCore::WindowFeatures() const
    105     {
    106         WebCore::WindowFeatures result;
    107         result.x = x;
    108         result.xSet = xSet;
    109         result.y = y;
    110         result.ySet = ySet;
    111         result.width = width;
    112         result.widthSet = widthSet;
    113         result.height = height;
    114         result.heightSet = heightSet;
    115         result.menuBarVisible = menuBarVisible;
    116         result.statusBarVisible = statusBarVisible;
    117         result.toolBarVisible = toolBarVisible;
    118         result.locationBarVisible = locationBarVisible;
    119         result.scrollbarsVisible = scrollbarsVisible;
    120         result.resizable = resizable;
    121         result.fullscreen = fullscreen;
    122         result.dialog = dialog;
    123         for (size_t i = 0; i < additionalFeatures.size(); ++i)
    124             result.additionalFeatures.append(additionalFeatures[i]);
    125         return result;
    126     }
    127 #endif
    128 };
    129 
    130 } // namespace WebKit
    131 
    132 #endif
    133