webengine/osswebengine/WebCore/page/Chrome.h
changeset 0 dd21522fd290
child 25 0ed94ceaa377
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 // -*- mode: c++; c-basic-offset: 4 -*-
       
     2 /*
       
     3  * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
       
     4  *
       
     5  * This library is free software; you can redistribute it and/or
       
     6  * modify it under the terms of the GNU Library General Public
       
     7  * License as published by the Free Software Foundation; either
       
     8  * version 2 of the License, or (at your option) any later version.
       
     9  *
       
    10  * This library is distributed in the hope that it will be useful,
       
    11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    13  * Library General Public License for more details.
       
    14  *
       
    15  * You should have received a copy of the GNU Library General Public License
       
    16  * along with this library; see the file COPYING.LIB.  If not, write to
       
    17  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
       
    18  * Boston, MA 02110-1301, USA.
       
    19  */
       
    20 
       
    21 #ifndef Chrome_h
       
    22 #define Chrome_h
       
    23 
       
    24 #include "FocusDirection.h"
       
    25 #include <wtf/Forward.h>
       
    26 #include <wtf/RefPtr.h>
       
    27 
       
    28 #if PLATFORM(MAC)
       
    29 #ifndef __OBJC__
       
    30 class NSView;
       
    31 #endif
       
    32 #endif
       
    33 
       
    34 namespace WebCore {
       
    35 
       
    36     class ChromeClient;
       
    37     class ContextMenu;
       
    38     class FloatRect;
       
    39     class Frame;
       
    40     class HitTestResult;
       
    41     class IntRect;
       
    42     class Page;
       
    43     class String;
       
    44     
       
    45     struct FrameLoadRequest;
       
    46     
       
    47     enum MessageSource {
       
    48         HTMLMessageSource,
       
    49         XMLMessageSource,
       
    50         JSMessageSource,
       
    51         CSSMessageSource,
       
    52         OtherMessageSource
       
    53     };
       
    54 
       
    55     enum MessageLevel {
       
    56         ErrorMessageLevel,
       
    57         InfoMessageLevel,
       
    58         WarningMessageLevel,
       
    59         LogMessageLevel,
       
    60         DebugMessageLevel,
       
    61         AssertMessageLevel
       
    62     };
       
    63 
       
    64     class Chrome {
       
    65     public:
       
    66         Chrome(Page*, ChromeClient*);
       
    67         ~Chrome();
       
    68 
       
    69         ChromeClient* client() { return m_client; }
       
    70 
       
    71         void setWindowRect(const FloatRect&) const;
       
    72         FloatRect windowRect() const;
       
    73 
       
    74         FloatRect pageRect() const;
       
    75         
       
    76         float scaleFactor();
       
    77 
       
    78         void focus() const;
       
    79         void unfocus() const;
       
    80 
       
    81         bool canTakeFocus(FocusDirection) const;
       
    82         void takeFocus(FocusDirection) const;
       
    83 
       
    84         Page* createWindow(Frame*, const FrameLoadRequest&) const;
       
    85         Page* createModalDialog(Frame*, const FrameLoadRequest&) const;
       
    86         void show() const;
       
    87 
       
    88         bool canRunModal() const;
       
    89         bool canRunModalNow() const;
       
    90         void runModal() const;
       
    91 
       
    92         void setToolbarsVisible(bool) const;
       
    93         bool toolbarsVisible() const;
       
    94         
       
    95         void setStatusbarVisible(bool) const;
       
    96         bool statusbarVisible() const;
       
    97         
       
    98         void setScrollbarsVisible(bool) const;
       
    99         bool scrollbarsVisible() const;
       
   100         
       
   101         void setMenubarVisible(bool) const;
       
   102         bool menubarVisible() const;
       
   103         
       
   104         void setResizable(bool) const;
       
   105 
       
   106         void addMessageToConsole(MessageSource, MessageLevel, const String& message, unsigned lineNumber, const String& sourceID);
       
   107 
       
   108         bool canRunBeforeUnloadConfirmPanel();
       
   109         bool runBeforeUnloadConfirmPanel(const String& message, Frame* frame);
       
   110 
       
   111         void closeWindowSoon();
       
   112 
       
   113         void runJavaScriptAlert(Frame*, const String&);
       
   114         bool runJavaScriptConfirm(Frame*, const String&);
       
   115         bool runJavaScriptPrompt(Frame*, const String& message, const String& defaultValue, String& result);                
       
   116         void setStatusbarText(Frame*, const String&);
       
   117         bool shouldInterruptJavaScript();
       
   118 
       
   119         IntRect windowResizerRect() const;
       
   120         void addToDirtyRegion(const IntRect&);
       
   121         void scrollBackingStore(int dx, int dy, const IntRect& scrollViewRect, const IntRect& clipRect);
       
   122         void updateBackingStore();
       
   123 
       
   124         void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags);
       
   125 
       
   126         void setToolTip(const HitTestResult&);
       
   127 
       
   128         void print(Frame*);
       
   129 
       
   130 #if PLATFORM(MAC)
       
   131         void focusNSView(NSView*);
       
   132 #endif
       
   133 
       
   134 #if PLATFORM(SYMBIAN)
       
   135     void setElementVisibilityChanged(bool visibility);
       
   136 #endif
       
   137     private:
       
   138         Page* m_page;
       
   139         ChromeClient* m_client;
       
   140     };
       
   141 }
       
   142 
       
   143 #endif // Chrome_h